Hi Wilhelm, > that (get ...) has a side effect! It moves the > key that was accessed to the head of the > symbol "tail". I assume this is a performance > optimization to cause recently accessed > properties to "bubble up" to the front of the > list in case they are re-accessed soon.
Yes, exactly. > 1. I understand why (cdr) doesn't function on > a symbol (semantically it's not a pair) but > I'm curious why (car) is allowed to work > (returning the VAL)? This is a result of the pointer structure of PicoLisp. As you may know (from e.g. doc64/structures), a cell is | V +-----+-----+ | CAR | CDR | +-----+-----+ while a symbol is | V +-----+-----+ | | VAL | +--+--+-----+ This means, a pointer to a cell points direcly to its CAR, while a pointer to a symbol points to its VAL. In both cases (car ...) or (val ...) are just a single pointer derefernces (memory fetches). > 2. Is there anyway within the REPL to inspect > the tail structure of the symbol directly? It is in fact possible, with some tricky pointer arithmetics: : (put 'A 'a 1) -> 1 : (put 'A 'b 2) -> 2 : (val (adr (abs (adr 'A)))) -> ((2 . b) (1 . a) . 65) > 3. Again from curiosity, I'm wondering why the > bytes of the name are seemingly stored > "backwards"? I'm assuming this also provides > some performance optimization. Correct. The first character(s) need to be accessed more prominently. ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe