Re: can I make a list of records?
Re: can I make a list of records?
- Subject: Re: can I make a list of records?
- From: "Serge Belleudy-d'Espinose" <email@hidden>
- Date: Tue, 29 Jan 2002 17:53:51 +0100
At 16:25 +0000 29/01/02, Nigel Garvey wrote:
>
>set MyList to {}
>
>set myFirstRecord to {a:1, b:2}
>
>set mySecondRecord to {a:3, b:4}
>
>set MyList to MyList & myFirstRecord & mySecondRecord
>
>
>
>--> {a:1, b:2}
>
>
This is really odd. Could it be that MyList is starting life as an empty
>
record rather than an empty list?
set myVar to {} as list
set myVar to myVar & {myRec:"rec"}
class of myVar
-- record
set myVar to {1} as list
set myVar to myVar & {myRec:"rec"}
class of myVar
-- list
So: empty list gets coerced to record, non-empty list gets record coerced to list. Seems there is at least an exception to the rule of coercing from right to left...
Serge
--
\\//\//\// Serge Belleudy-d'Espinose Institut Jacques Monod - Jussieu
// // //
http://www.ijm.jussieu.fr/ Universites Paris VI, VII - CNRS
//\//\//\\