beneroth changed the topic of #picolisp to: PicoLisp language | The scalpel of software development | Channel Log: https://libera.irclog.whitequark.org/picolisp | Check www.picolisp.com for more information
aw- has joined #picolisp
brandelune has quit [Quit: This computer has gone to sleep]
peterhil has quit [Ping timeout: 252 seconds]
brandelune has joined #picolisp
cranium has joined #picolisp
clacke has joined #picolisp
peterhil has joined #picolisp
peterhil has quit [Ping timeout: 252 seconds]
razzy has joined #picolisp
razzy has quit [Ping timeout: 252 seconds]
beneroth has joined #picolisp
brandelune has quit [Quit: This computer has gone to sleep]
brandelune has joined #picolisp
brandelune has quit [Quit: This computer has gone to sleep]
peterhil has joined #picolisp
brandelune has joined #picolisp
brandelune has quit [Quit: This computer has gone to sleep]
brandelune has joined #picolisp
brandelune has quit [Client Quit]
olaf_h has joined #picolisp
<olaf_h> Hi all, question concerning my long-time promised :-) pilcode-annotater: if i have a list like '( "de" "foo" "de" "bar") and
<olaf_h> would like to store info in list items to get them by e.g. (get 'pos (car Lst)) and "de" at first pos should return 1
<olaf_h> and "de" at third pos should return 3: what would be recommended?
<beneroth> olaf_h, (index)
<olaf_h> hi beneroth :-)
<beneroth> :)
<beneroth> hi :)
<olaf_h> okay, my question did not ask what I'm looking for .. another try: what 'datatype to take instead of transient symbol
<olaf_h> to store individual properties in each
<olaf_h> .....?....
<olaf_h> (put (car Lst) 'pos 1)) would work, but also shows up when asking (get 'pos (cadddr Lst)) (3rd element is another "de")
<olaf_h> s/caddr/caddr/
<aw-> olaf_h: hi, do you know about (assoc) ?
<olaf_h> hi aw. yes, and I'm short before turning this list into assoc list - but wanted to ask before if s.o. suggests
<aw-> (assoc "de" '(("de" 1) ("foo" 2))) ?
<olaf_h> a list of symbols with string in val or so
<aw-> what problem are you having with your current approach?
<olaf_h> i try to simplify: 2 functions are using the same list for different purposes, so they count the elements differently
<aw-> ok
<olaf_h> i would like to put an additional mark on elements of list, so that function1 and function2 always can look up identiy
<aw-> i see
<aw-> i would use an assoc list
<aw-> you can always filter the list by "de", and then find the match by cdr instead of car
<olaf_h> okay, that's fine for me, i think because assoc lists i know.
<aw-> assoc list is simple and easy to grok
<aw-> if you make strange new data structures you'll just confuse yourself in a few years when you re-visit that code
<olaf_h> sure .... after days in my case .... :-)
<aw-> i think it's better to use a simple structure, and then use picolisp's many functions to parse differently
<olaf_h> yes. does order of assoc list change? Order of my list should not change.
<olaf_h> ahh no, you mean a list of assoc lists? each element of my list is its own assoc list. so all cars of the list of assocs show my list
<olaf_h> i'll try that. Thank you so far!
<aw-> like this maybe:
<aw-> (filter '((N) (= "de" (car N))) '(("de" 1) ("foo" 2) ("de" 3)))
<aw-> -> (("de" 1) ("de" 3))
<aw-> (filter '((N) (= 1 (cadr N))) '(("de" 1) ("foo" 2) ("de" 3)))
<aw-> -> (("de" 1))
<aw-> not sure if that's what you're looking for
<olaf_h> yeah, i see - and (mapcar 'car '(("de" 1)("foo" 2)("de" 3))) would return my list: '("de" "foo" "de" )
brandelune has joined #picolisp
<aw-> right
<aw-> (mapcar car ...) is fine
<aw-> hmmm i dont think Regenaxer would approve that
<olaf_h> cool, looks nice and feels easy to do - thanks
<olaf_h> what do you mean, he would not approve?
<olaf_h> the car without apostroph?
<olaf_h> thanks for the hints and snippets, aw- , i will check, if it fits
<aw-> no no, never mind it's fine ;)
<beneroth> sry, was away
<beneroth> aw-, the more advanced way (for big lists) would be (idx) and (lup) :-)
<aw-> beneroth: why? why use complex structures for something so simple?
<aw-> well yes i guess if the list is huge there might be a performance benefit from using indexes
<beneroth> T
<beneroth> exactly. only use for really big lists
<beneroth> for simple mappings I also just use a list with cons pairs in it, accessed via assoc and rassoc (very useful)
<aw-> right, cons pairs
<aw-> '(("de . 1) ("foo . 2) ("de" . 3))
<beneroth> for smaller amounts of data, a simple list has better performance than a tree, because the tree has additional branch nodes, so more storage and more indirections
<beneroth> yep
<beneroth> (rassoc) is very useful
<aw-> T
<aw-> ok i'm out
<aw-> g'nite
aw- has quit [Quit: Leaving.]
<Regenaxer> olaf_h sorry, was in a Meeting
<Regenaxer> For me (mapcar car ...) is fine
<Regenaxer> afp, going back home
<beneroth> :)
<olaf_h> np at all
olaf_h has quit [Quit: Leaving]
<Regenaxer> :)
cranium has quit [Quit: Leaving]
brandelune has quit [Quit: Leaving]
alexshendi has joined #picolisp
alexshe86 has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
alexshe86 has quit [Read error: Connection reset by peer]
alexshe4 has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshe4 has quit [Ping timeout: 265 seconds]
alexshendi has joined #picolisp
alexshendi has quit [Ping timeout: 245 seconds]
aw- has joined #picolisp
stux|away has joined #picolisp