Re: Boolean property
Hi Jon, > Yes, but what I meant was that a "single KEY" cannot or will not > represent a boolean NIL (unless you show me), Ah, I see. Yes, I answered the wrong question! :-) You are right. NIL cannot be stored in that way. It is also not necessary, because any missing property is NIL, and 'put'ting NIL for a property deletes it from the list, so that further 'get's will return NIL again. > Each property in a symbol's tail is either a symbol (like the single > KEY above, then it represents a boolean value T), ... Good, I've changed the docs. Still, from the user perspective, storing T or NIL under a property involves only a single cell, and no storing of the actual value. Thanks for the input! Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: Boolean property
On 8/27/10 12:55 PM, Alexander Burger wrote: Hi Jon, Each property in a symbol's tail is either a symbol (like the single KEY above, then it represents a boolean value), ... Can such a "single KEY" represent anything else than the boolean 'T'? If it cannot, I think the docs should say so. If it can, I'd like to see an example! Yes, it can be any symbol. If you create a "normal" propery (not a single KEY but a KEY/VAL pair), you call it like (put 'A 'drink 'vodka) and you get a symbol tail of | V +-+-+ +-+-+ | | | ---+---> | 'A' | / | +--+--+-+ +-+-+ | V +---+---+ | vodka | drink | +---+---+ However, if the property _value_ is 'T' (i.e. you specify a boolean property), (put 'A 'thirsty T) then it the value is omitted as an optimization to save space, and only the key is stored: | V +-+-+ +-+-+ +-+-+ | thirsty | ---+---> | | | ---+---> | 'A' | / | +-+-+ +--+--+-+ +-+-+ | V +---+---+ | vodka | drink | +---+---+ In that way, boolean properties need only a single cell, instead of two! You can see the result with 'getl' : (getl 'A) -> (thirsty (vodka . drink)) and the 'get' family of functions knows about that speciality and returns 'T': : (get 'A 'thirsty) -> T : (get 'A 'drink) -> vodka Cheers, - Alex Hi Alex, Yes, but what I meant was that a "single KEY" cannot or will not represent a boolean NIL (unless you show me), and therefor I think the docs should say so, like this: Each property in a symbol's tail is either a symbol (like the single KEY above, then it represents a boolean value T), ... /Jon -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: Boolean property
Hi Jon, > Each property in a symbol's tail is either a symbol (like the single > KEY above, then it represents a boolean value), ... > > Can such a "single KEY" represent anything else than the boolean 'T'? > If it cannot, I think the docs should say so. If it can, I'd like to > see an example! Yes, it can be any symbol. If you create a "normal" propery (not a single KEY but a KEY/VAL pair), you call it like (put 'A 'drink 'vodka) and you get a symbol tail of | V +-+-+ +-+-+ | | | ---+---> | 'A' | / | +--+--+-+ +-+-+ | V +---+---+ | vodka | drink | +---+---+ However, if the property _value_ is 'T' (i.e. you specify a boolean property), (put 'A 'thirsty T) then it the value is omitted as an optimization to save space, and only the key is stored: | V +-+-+ +-+-+ +-+-+ | thirsty | ---+---> | | | ---+---> | 'A' | / | +-+-+ +--+--+-+ +-+-+ | V +---+---+ | vodka | drink | +---+---+ In that way, boolean properties need only a single cell, instead of two! You can see the result with 'getl' : (getl 'A) -> (thirsty (vodka . drink)) and the 'get' family of functions knows about that speciality and returns 'T': : (get 'A 'thirsty) -> T : (get 'A 'drink) -> vodka Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe