Re: help with list of capital letters as symbol property key

2016-12-17 Thread dean
Ok thank you for that On 16 December 2016 at 21:02, Joh-Tob Schäg wrote: > Maybe can hepl you with that it inserts 15 numbers with different keys and > prints the result after each insert or at least it should. Could not try it

Re: help with list of capital letters as symbol property key

2016-12-16 Thread Joh-Tob Schäg
Maybe can hepl you with that it inserts 15 numbers with different keys and prints the result after each insert or at least it should. Could not try it

Re: help with list of capital letters as symbol property key

2016-12-16 Thread dean
Ok there won't be many associations in this instance so thank you for the advice. I'd still like to understand how that idx tree hierarchy gets formed from what looks like a load of "homogenous" insertions (suggesting linear to me) and how d gets to be first in a sorted tree i.e. before the number

Re: help with list of capital letters as symbol property key

2016-12-16 Thread Joh-Tob Schäg
assoc '(a) '(((a) vlu_a1 vlu_a2) ((a b).vlu_ab1))) #'(a) is the key (vlu_a1 vlu_a2 ) to be exact. Since ((a) vlu_a1 vlu_a2) is ((a) . (vlu_a1 vlu_a2)) Am 17.12.2016 04:53 schrieb "dean" : > >'assoc'iation list for such purposes. That is probably the fastest, and > surely most lispy :) > > Then tha

Re: help with list of capital letters as symbol property key

2016-12-16 Thread Joh-Tob Schäg
You can use idx to store associations but it is slower for lower number of elements. If i do things with idx they tend to be more messy. Am 17.12.2016 04:53 schrieb "dean" : > >'assoc'iation list for such purposes. That is probably the fastest, and > surely most lispy :) > > Then that's what I sho

Re: help with list of capital letters as symbol property key

2016-12-16 Thread dean
>'assoc'iation list for such purposes. That is probably the fastest, and surely most lispy :) Then that's what I should really be doing...I wasn't familiar with this but looking on the net it seems to involve "assoc" but I've also seen "idx" in the lists part of the reference. I think I "get" as

Re: help with list of capital letters as symbol property key

2016-12-14 Thread Alexander Burger
Hi Bruno, > I'm surprised that (pick '((A B) (and (= A Value) B)) ListA ListB) is > faster than (get ListB (index Value ListA)). > It's true that get traverses ListB right after a traversal of ListA, but > pick seems to do the same traversal of > the same number of elements. The only difference i

Re: help with list of capital letters as symbol property key

2016-12-14 Thread Bruno Franco
@Alex I'm surprised that (pick '((A B) (and (= A Value) B)) ListA ListB) is faster than (get ListB (index Value ListA)). It's true that get traverses ListB right after a traversal of ListA, but pick seems to do the same traversal of the same number of elements. The only difference is that pick trav

Re: help with list of capital letters as symbol property key

2016-12-14 Thread dean
Great!thank you very much indeed! Best Regards Dean On 14 December 2016 at 08:03, Alexander Burger wrote: > On Wed, Dec 14, 2016 at 07:18:42AM +, dean wrote: > > : (setq LstA (chop 'dOg)) > > -> ("d" "O" "g") > > : (pick '((Ch) (and (= Ch (uppc Ch)) Ch)) LstA) > > -> "O" > > > > but wond

Re: help with list of capital letters as symbol property key

2016-12-14 Thread Alexander Burger
On Wed, Dec 14, 2016 at 07:18:42AM +, dean wrote: > : (setq LstA (chop 'dOg)) > -> ("d" "O" "g") > : (pick '((Ch) (and (= Ch (uppc Ch)) Ch)) LstA) > -> "O" > > but wonder if there's a slicker way? Yes: : (find upp? (chop "dOg")) -> "O" - Alex -- UNSUBSCRIBE: mailto:picolisp@software-l

Re: help with list of capital letters as symbol property key

2016-12-13 Thread dean
>Sorry, that was too cryptic :) No...it was fine thanks to the last example in your documentation and mention of multiple lists. I wasn't sure about anonymous functions and wrote a named function so showing how to do anonymous ones is very helpful. The next stage is to find the first (and hopefully

Re: help with list of capital letters as symbol property key

2016-12-13 Thread Alexander Burger
On Tue, Dec 13, 2016 at 09:27:27PM +0100, Alexander Burger wrote: > On Tue, Dec 13, 2016 at 08:58:23PM +0100, Alexander Burger wrote: > > Instead, I recommend 'pick' where you pass the two lists. > > Sorry, that was too cryptic :) > > I think of something like: > >(pick '((A B) (and (= A Val

Re: help with list of capital letters as symbol property key

2016-12-13 Thread dean
Hi Alex I changed those 'Key 'Keys and 'Fn_to_call shortly after posting. There'll also be a 3rd list call 'Args. Because there are numerous associated bits and pieces they seem a good candidate for an object. Thank you for "pick" and the above corrections. Best Regards Dean On 13 December 2016 a

Re: help with list of capital letters as symbol property key

2016-12-13 Thread Alexander Burger
On Tue, Dec 13, 2016 at 08:58:23PM +0100, Alexander Burger wrote: > Instead, I recommend 'pick' where you pass the two lists. Sorry, that was too cryptic :) I think of something like: (pick '((A B) (and (= A Value)) B) LstA LstB) - Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjec

Re: help with list of capital letters as symbol property key

2016-12-13 Thread Alexander Burger
Hi Dean, > (setq I '(() (a) (a b))) > (setq V '(empty a_vlu ab_vlu)) > (de vlu4key (K 'I 'V) This is fatal! A function needs a list of *symbols*, not expressions like 'I ;) > > (de vlu4key (Vlu 'I 'V) > > (setq Ix (index Vlu I)) > > (get V Ix) ) Using 'index' to find an element and then

Re: help with list of capital letters as symbol property key

2016-12-13 Thread dean
Vlu above misleads a bit because it represents Key...or K below (setq I '(() (a) (a b))) (setq V '(empty a_vlu ab_vlu)) (de vlu4key (K 'I 'V) (get V (index K I))) On 13 December 2016 at 11:35, dean wrote: > This seems to work fine... > (setq I '(() (a) (a b))) > (setq V '(empty a_vlu ab_vlu)

Re: help with list of capital letters as symbol property key

2016-12-13 Thread dean
This seems to work fine... (setq I '(() (a) (a b))) (setq V '(empty a_vlu ab_vlu)) (de vlu4key (Vlu 'I 'V) (setq Ix (index Vlu I)) (get V Ix) ) ? (setq K '(a)) -> (a) ? (vlu4key K I V) -> a_vlu ? (setq K '(a b)) -> (a b) ? (vlu4key K I V) -> ab_vlu On 13 December 2016 at 10:58, dean wr

Re: help with list of capital letters as symbol property key

2016-12-13 Thread dean
Ok...I'm going to just going to use a list of lists for the index and a list of values i.e. two separate variables. On 12 December 2016 at 15:37, dean wrote: > Having thought about this I was intending to use the SAME list variable to > represent multiple property keys i.e. as I type keys (to tr

Re: help with list of capital letters as symbol property key

2016-12-12 Thread dean
Having thought about this I was intending to use the SAME list variable to represent multiple property keys i.e. as I type keys (to traverse a menu tree) I was hoping to use the key "trail" at any point (stored as a list) as a unique key. Having now realised what == means...it looks like pointer e

Re: help with list of capital letters as symbol property key

2016-12-12 Thread dean
Thank you for the clarification. On 12 December 2016 at 06:19, Alexander Burger wrote: > Hi Dean, > > > On 11 December 2016 at 20:06, Alexander Burger > wrote: > > > > > On Sun, Dec 11, 2016 at 07:05:13PM +, dean wrote: > > > > but I'd like a list of letters to be a single key. > > > > Is t

Re: help with list of capital letters as symbol property key

2016-12-11 Thread Alexander Burger
Hi Dean, > On 11 December 2016 at 20:06, Alexander Burger wrote: > > > On Sun, Dec 11, 2016 at 07:05:13PM +, dean wrote: > > > but I'd like a list of letters to be a single key. > > > Is this not possible? > > Properties are handled (searched) by pointer-equality, the '==' function. I shoul

Re: help with list of capital letters as symbol property key

2016-12-11 Thread dean
Hi Alex Thank you very much for explaining that. Best Regards Dean On 11 December 2016 at 20:06, Alexander Burger wrote: > On Sun, Dec 11, 2016 at 07:05:13PM +, dean wrote: > > In the tutorial '(X Y Z) in a get statement seemed to refer to several > keys > > but I'd like a list of letters to

Re: help with list of capital letters as symbol property key

2016-12-11 Thread Alexander Burger
On Sun, Dec 11, 2016 at 07:05:13PM +, dean wrote: > In the tutorial '(X Y Z) in a get statement seemed to refer to several keys > but I'd like a list of letters to be a single key. > Is this not possible? > > (setq X "") > (put 'X '(D E) 'some_value) > : (get 'X '(D E)) >-> NIL Properties