Jose & Alex,

Please excuse my rudeness in not replying sooner (on business, then Yosemite
trip). Thanks for the pointers on idx trees.

--
Regards,
       Imran Rafique

2012/2/1 José Romero <jose.cyb...@gmail.com>:
> Why not use a 'idx tree then? http://software-lab.de/doc/refI.html#idx
>
> ##################################################
> # I used 'name here to prevent accidental clobbering
> (de iset (Tree Key Value)
>   (set
>      (or
>         (car (idx Tree Key))
>         (prog1 (name Key) (idx Tree @ T)) )
>      Value ) )
>
> (de iget (Tree Key)
>   (val (car (idx Tree Key))) )
>
> ###### Tests ######
> : (iset 'mydict "Foo" 42)
> -> 42
>
> : (iset 'mydict "Bar" T)
> -> T
>
> : (iset 'mydict "Bam" "Baz")
> -> "Baz"
>
> : (iget 'mydict "Foo")
> -> 42
>
> : (iget 'mydict "Bam")
> -> "Baz"
>
> : (iget 'mydict "Bar")
> -> T
>
> : (mapcar show (idx 'mydict))
> "Bam" "Baz"
> "Bar" T
> "Foo" 42
> -> ("Bam" "Bar" "Foo")
> ###################################################

On 1 February 2012 19:59, Alexander Burger <a...@software-lab.de> wrote:
>> didn't fully grok the explanation of idx tree's from the ref - is there a
>> Rosetta example (or other snippet) which you can point me to to explain them?
>
> Yes, for example
>
>   http://rosettacode.org/wiki/Associative_arrays/Iteration
>   http://rosettacode.org/wiki/Anagrams
>   http://rosettacode.org/wiki/Anagrams/Deranged anagrams
>   http://rosettacode.org/wiki/Hamming_numbers
>   http://rosettacode.org/wiki/Huffman_coding
>   http://rosettacode.org/wiki/Inverted_index
>   http://rosettacode.org/wiki/LZW_compression
>   http://rosettacode.org/wiki/Priority_queue
>   http://rosettacode.org/wiki/Set
>   http://rosettacode.org/wiki/Sokoban
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to