<Regenaxer>
Instead of '(apply max' I would use @@ after 'maxi'
<Regenaxer>
And constants like
<Regenaxer>
(def 'Costs '((A . 1) (B . 2) (
<Regenaxer>
cold be
<Regenaxer>
(de Costs (A . 1) (B . ...
<rick42>
ok
<rick42>
yes, in fact I did use @@ after mini
<rick42>
ah, you mean in `cost`
<rick42>
got it. thanks
<Regenaxer>
ok, not sure :)
<rick42>
(prob (maxi ...) @@) seems to be slightly faster than (apply (max ...))
<Regenaxer>
Perfect
<Regenaxer>
The basic problem with 'apply' is that it expands the arguments on the stack, so it is expensive in terms of stack space and time (relatively)
<Regenaxer>
So I don't use 'apply' for potentially unlimited lists (short lists are perfectly fine)
ubLIX has joined #picolisp
<rick42>
got it. thanks again
<rick42>
i now have the `cost` function as:
<rick42>
(let cost-person '((Person) (cdr (assoc Person Costs)))
<rick42>
got rid of the `lookup` function; everything can be localized
<rick42>
tankf33der: you have reached heights in your picolisp journey that i could not hope to reach: literally coding in your sleep. maybe in a few more years of hacking picolisp, you will be able to levitate like Regenaxer does :)
clacke_movim has left #picolisp [#picolisp]
clacke_movim has joined #picolisp
<tankf33der>
pil32 passed tests on gcc 9.1
<Regenaxer>
rick42, if 'Person' is an internal or external symbol, you can replace 'cost-person' with 'get'
<Regenaxer>
(get Costs Person)
<rick42>
so Regenaxer I could "tag" each symbol A, B, C or D with a Cost property?
<Regenaxer>
Yes, that too. But 'get' on a list does a (cdr (asoq ...))
<Regenaxer>
'asoq' uses '==', so the CARs should be symbols
<Regenaxer>
(or short numbers in pil64)
<Regenaxer>
: (get '((a . 1) (b . 2) (c . 3)) 'b)
<Regenaxer>
-> 2
<rick42>
ok that's looks good
<Regenaxer>
But properties are more general and useful in my tyste
<Regenaxer>
taste
<rick42>
thanks!
* rick42
is not levitating yet, but merely feels "a bit" lighter