No that is not true. : (setq "ABC" 3) -> 3 : "ABC" -> 3 : (setq "ABD" 2) -> 2 : (> "ABC" "ABD") -> T But it is always true if the transient symbols do not refer to themselves. See Comparing in the docs.
> Numbers are comparable by their numeric value, strings by their name, and > lists recursively by their elements (if the CAR's are equal, their CDR's > are > compared). For differing types, the following rule applies: Numbers are > less > than symbols, and symbols are less than lists. > 2017-04-01 14:04 GMT+02:00 Christopher Howard < christopher.how...@qlfiles.net>: > Additional question: Should I expect any weird behavior with transient > symbols and the '< or '> operators? E.g. (assuming the symbols have not > been assigned strange values) is it true that "abc" will always be less > than "abd" regardless of the scope of the transient symbols? > > On 04/01/2017 03:56 AM, Christopher Howard wrote: > > Ah, okay. Somehow in my mind I had reversed the meaning of "==" and "=". > > > > @Joh-Tob: I am writing a text-adventure game, using a balanced binary > > tree as the primary data structure for managing game data. I wrote my > > own AA Tree implementation (with guidance from Wikipedia). I see the idx > > and balance functions in PicoLisp reference, but my concern is I don't > > see how you do with those an (efficient) self-balance after single > > inserts to an existing tree, nor how to do self-balancing deletes from > > an existing tree. > > > > On 04/01/2017 01:46 AM, Alexander Burger wrote: > >> Hi Christopher, > >> > >>> : (aa-search '(("threshold" (("long-description" "You stand in front of > >>> a wooden door, reputed to be the home of one Dr. Theobold. The door has > >>> a small keyhole.") NIL NIL 1)) NIL NIL 1) "threshold") > >>> -> ("threshold" ... > >> > >>> However, if I run this command, I get a different result: > >>> > >>> : (aa-search (rooms) "threshold") > >>> ... > >> > >> > >> The problem is the '==' in > >> > >>> (if (== Key (car (aa-kv Tree))) > >> > >> > >> You pass a transient symbol "threshold", and '==' checks for exactly > this > >> symbol. The scope of transient symbols is per file or REPL instance, so > you ran > >> the first test probably in the same instance, while "threshold" in the > second > >> was a new, different, symbol. > >> > >> Either use '=' for comparison, or use only internal symbols as keys. > >> > >> ♪♫ Alex > >> > > > > -- > https://qlfiles.net > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >