ChanServ changed the topic of #picolisp to: PicoLisp language | Channel Log: https://irclog.whitequark.org/picolisp/ | Check also http://www.picolisp.com for more information
orivej has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]
orivej has joined #picolisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
_whitelogger has joined #picolisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
patrixl has quit [Read error: Connection reset by peer]
patrixl has joined #picolisp
orivej has quit [Ping timeout: 264 seconds]
<tankf33der> morning
<tankf33der> pilog crash.
<tankf33der> about pilog crash:
<tankf33der> on picture all code with word 'permute'.
<tankf33der> first calling pilog-rosetta.l in the row
<tankf33der> and crashing on first call of simul~permute in 1-atom-atom.l file.
<tankf33der> maybe i need call permute in pilog via pilog~permute or something like this ?
<Regenaxer> Hi tankf33der
<Regenaxer> yes, make sure you have the *right* symbol
<Regenaxer> (show 'permute)
<Regenaxer> value = function, T propery = pilog clauses
<tankf33der> so what is right way to call permute for pilog usecase ?
<Regenaxer> Are the permute rules defined in a separate namespace?
<Regenaxer> The rule is simple: Pil takes the symbol it finds first in the namespace
<Regenaxer> At *read* time
<Regenaxer> Not run time
<tankf33der> there are two permutes
<tankf33der> in simul and somewhere for pilog
<Regenaxer> yes
<Regenaxer> "somewhere" is 'pico' probably
<Regenaxer> if you read it without changing the ns
<Regenaxer> (symbols) -> (pico) ?
<Regenaxer> or (symbols) -> (simul pico) ?
<tankf33der> also
<tankf33der> if i comment second (load "@lib/simul.l") no crash.
<Regenaxer> I don't know which code you are talking about
<tankf33der> i cant combine code to repeat.
<Regenaxer> ok
<Regenaxer> anyway, it should not crash in such a case
<Regenaxer> but, well, yeah, possible
<Regenaxer> anything is possible ;)
<tankf33der> $ pil21 +
<tankf33der> : (simul~permute (range 1 3))
<tankf33der> -> "border"
<tankf33der> : (load "@lib/simul.l")
<tankf33der> -> ((1 2 3) (1 3 2) (2 1 3) (2 3 1) (3 1 2) (3 2 1))
<tankf33der> : (symbols)
<tankf33der> -> (pico)
<tankf33der> :
<tankf33der> i dont see simul ns
<Regenaxer> correct
<Regenaxer> this is ok
<tankf33der> ok
<Regenaxer> you could also do (symbols '(simul pico)) (permute ...
<Regenaxer> depends
<Regenaxer> or
<Regenaxer> in pico
<Regenaxer> (import simul~permute)
<Regenaxer> then 'permute' is in both namespaces
<Regenaxer> ah, ok
<Regenaxer> this gives a conflict
<Regenaxer> because 'pilog' exported 'permute' to pico
<tankf33der> afk.
<Regenaxer> ok
<Regenaxer> so we *do* have 2 'permute's
<Regenaxer> which is all right
<tankf33der> can you clone my repo and type make in it?
<Regenaxer> git
<Regenaxer> I have no git
<tankf33der> ok
<Regenaxer> I could download the zip
<Regenaxer> What purpose?
<Regenaxer> I try to avoid ~ usually
<Regenaxer> I would do
<Regenaxer> (symbols '(simul pico))
<Regenaxer> (permute ...)
<Regenaxer> (symbols '(pico))
<Regenaxer> (? (permute ...
<tankf33der> purpose to try repeat a crash
<tankf33der> ulimit -s 16000
<tankf33der> make
<Regenaxer> tar: Unexpected EOF in archive
<Regenaxer> hmm
<tankf33der> no crash if run under (gc 5120
<tankf33der> no crash if run under (gc 512)
<Regenaxer> OK, some more gc issues
<tankf33der> and crash happens not on calling simul~permute but inside it.
<Regenaxer> ok
<Regenaxer> Probably has nothing to do with namespaces
<Regenaxer> I try too
<Regenaxer> Permute calls pretty normal stuff
Regenaxer has left #picolisp [#picolisp]
Regenaxer has joined #picolisp
<Regenaxer> cons, map, delete etc.
orivej has joined #picolisp
<Regenaxer> "crash happens not on calling simul~permute but inside it"
<Regenaxer> What is the difference of calling and inside?
<tankf33der> i cant post a picture but i remember it was (cdr Lst) as last line
<tankf33der> also i should check backtrace
<tankf33der> i can easily step in gc issue if i remember correctly how to do it
<tankf33der> vacation is over, tomorrow i will sit in office at this time
orivej has quit [Ping timeout: 265 seconds]
<Regenaxer> oh
<Regenaxer> Backtrace might help again
<Regenaxer> (cdr Lst) itself will not trigger gc
orivej has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]
orivej has joined #picolisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
orivej has quit [Ping timeout: 256 seconds]
orivej has joined #picolisp
<aw-> Regenaxer: hi
<aw-> if (char (bin "00110010")) = "2", does this mean PicoLisp is reading the least significant bit first?
orivej has quit [Ping timeout: 240 seconds]
orivej has joined #picolisp
<Regenaxer> Hi aw-
<Regenaxer> (char <num>) does not read, but convert
<Regenaxer> ASCII 50 = "2"
<aw-> right, but my question was whether the first bits are '0' then '1' then '0'
<aw-> or if it's '0' then '0' then '1'
<Regenaxer> In the string argument to 'bin'?
<Regenaxer> The lowest bit is rightmost
<aw-> ok that's what i thought
<aw-> thanks
<Regenaxer> Isn't that the standard?
<Regenaxer> like decimal digits too
<Regenaxer> lowest is rightmost
<aw-> yes yes
<aw-> you read my mind ;)
<Regenaxer> :)
<aw-> because i was playing with Redis bitmaps, and they seem to reverse the bits when using the bitmap utilities. It's completely brain dead.
<Regenaxer> uh, yeah
<aw-> if you set bit 2 in an 8-bit string, it sets '0010000' instead of '00000100'
<aw-> i have no ideae why they do that
<Regenaxer> I see, like a vector
<Regenaxer> Perhaps a little easier to address the bits
<tankf33der> Regenaxer: all backtraces like this:
<tankf33der> http://ix.io/2sWo
<tankf33der> crash itself:
<tankf33der> ...
<tankf33der> ^^^ crypto finished!
<tankf33der> ...
<tankf33der> whirlpool-OK
<tankf33der> twofish-OK
<tankf33der> [1-atom-atom.l:670] !? (cdr Lst)
<tankf33der> make: *** [Makefile:2: all] Segmentation fault (core dumped)
<tankf33der> [mpech@lambda pil21-tests]$
<Regenaxer> Looks not like a gc issue
<Regenaxer> Rather infinite recursion?
<tankf33der> yea
<tankf33der> simul permute is recursion
<tankf33der> :)
<Regenaxer> yes
<Regenaxer> Sorry, I misread. You said ulimit -s ...
<tankf33der> ulimit -s 16000
<Regenaxer> T
<Regenaxer> One thing is that pil21 needs more stack space
<Regenaxer> changed stack structures
alexshendi has joined #picolisp
<tankf33der> i can enable gc+ and run file by file again.
<Regenaxer> gc not needed I think
<alexshendi> Hello, Mahlzeit! Is the next Functional Fridaz
<Regenaxer> pil21 needs 2 or 3 times more stack (I don't know exactly)
<Regenaxer> What if you decrease stack size on pil64?
<Regenaxer> hi alexshendi!
<Regenaxer> yes, next Friday
<alexshendi> Hello, Mahlzeit! Is the next Functional Friday at 8am CEST again?
<Regenaxer> Fr 07aug20
<Regenaxer> at 10 CEST
<tankf33der> pil21 tests cant run on pil64.
<Regenaxer> 8 UTC
<Regenaxer> tankf33der, true
<Regenaxer> never mind
<alexshendi> That probably means 10am CEST, correct?
<Regenaxer> yep
orivej has quit [Quit: No Ping reply in 180 seconds.]
<alexshendi> Thanks
orivej has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]
orivej has joined #picolisp
<tankf33der> warning: Unexpected size of section `.reg-xstate/191993' in core file.
<tankf33der> #0 0x000055c9206f90ff in mark ()
<tankf33der> Undefined command: "". Try "help".
<tankf33der> (gdb) (bt)
<tankf33der> (gdb) bt
<tankf33der> #1 0x000055c9206f8bf8 in gc ()
<tankf33der> #0 0x000055c9206f90ff in mark ()
<tankf33der> #3 0x000055c9206f2bd2 in _delete ()
<tankf33der> #2 0x000055c9206f8b03 in cons ()
<tankf33der> #5 0x000055c9206fe618 in evExpr ()
<tankf33der> #4 0x000055c9206f89e9 in evList ()
<tankf33der> #6 0x000055c9206f8a04 in evList ()
<tankf33der> test
<Regenaxer> ok, now gc
<tankf33der> do you see my post?
<Regenaxer> yes, fine
<tankf33der> i've got warning from freenode :)
<Regenaxer> yeah
<Regenaxer> if too long
<tankf33der> this delete from simul~permute
orivej has quit [Ping timeout: 260 seconds]
<tankf33der> Regenaxer:
<tankf33der> http://ix.io/2sWE
<tankf33der> delete cant work if gc+ enabled :)
<Regenaxer> wow
<Regenaxer> strong hint!
<tankf33der> i have to run again all tests.
<Regenaxer> Give me a little time. Will check later
<Regenaxer> Will investigate 'delete'
<tankf33der> delq the same.
<tankf33der> rest list functions ok
<Regenaxer> Seems obvious. Very simple stupid error
<Regenaxer> 'save' for 'R' is missing
<tankf33der> all passed.
<tankf33der> sym.l is still running.
<tankf33der> math.l will run weeks, ignored.
<Regenaxer> Released 'delete' and 'delq'
<tankf33der> ok
<Regenaxer> :)
<tankf33der> i will wait till sym finished
<tankf33der> no hurry.
<Regenaxer> T
<tankf33der> sym passed.
<Regenaxer> Great
<Regenaxer> I'm sure delete/delq is fixed too
<tankf33der> fixed. no crash anymore.
<Regenaxer> elementary mistake
<Regenaxer> Thx!
<Regenaxer> I saw immediately when looking at the source
<tankf33der> afk. enough good job for today.
<Regenaxer> yeah, really good job
<Regenaxer> big progresses
alexshendi has quit [Ping timeout: 260 seconds]
<aw-> Regenaxer: hi again
<aw-> just curious, how can I tell on my own which functions are "slow" compared to other functions?
<Regenaxer> difficult to say
<Regenaxer> bignums vs. short?
<aw-> ?
<Regenaxer> bignums are slow
<Regenaxer> What is the background of the question?
<aw-> ex: if i do (index "a" (reverse (chop Lst))) VS some other thing to find "a" in the Lst
<aw-> how can I compare to see which is less efficient?
<Regenaxer> With 'bench'
<Regenaxer> (reverse (chop Lst ... is for example not optimal
<Regenaxer> (flip (chop
<aw-> bench.. ok
<Regenaxer> destructive, because the list is "fresh"
<Regenaxer> not referred to anywhere
<aw-> ohh i see
<aw-> (reverse) makes a copy?
<Regenaxer> yes
<Regenaxer> Another rule is to avoid function *call* overhead
<Regenaxer> calls are expensive
<aw-> what do you mean 'call' overhead?
<Regenaxer> calling a function
<Regenaxer> (member x Lst) is fast
<Regenaxer> only 1 fun (member)
<Regenaxer> (find foo List) calls a function for each element
<Regenaxer> and (find '((X) ... is even more expensive
<aw-> ohhh right, i see
<Regenaxer> cause EXPRs are a lot more expensive than SUBRs
<aw-> that's a good one
<aw-> thank you
<Regenaxer> I think a good rule is to call the cells
<Regenaxer> a smaller expr is usually faster
<Regenaxer> "call the cells" -> count the cells
<Regenaxer> (size Expr)
<Regenaxer> I often count manually
<Regenaxer> ie the number of open parens plus atoms
<Regenaxer> (except the first paren)
<Regenaxer> (a (b c) d) is 5 cells
<aw-> wow you count the cells
<aw-> my code is always so verbose, i can't imagine doing that :(
<Regenaxer> only small fragments
<Regenaxer> when in question which solution to pick
<aw-> right right
<Regenaxer> count manually or use 'size'
<Regenaxer> Copy/paste an expr after (size '
<Regenaxer> I also count to decide when to indent
<Regenaxer> like 'pretty' does
<Regenaxer> it indents a subexpr when bigger than 12
<Regenaxer> Less cells is simply also faster because of less memory fetches and better caching
<aw-> is (index) considered "slow" ?
<aw-> in my previous example, which would be faster: (index "a" (flip (chop Lst))) or (car (member "a" (flip (chop Lst)))) ?
<Regenaxer> yes, it traverses the list
<aw-> i guess i can use bench to test
<Regenaxer> it gives different results
<aw-> sorry i know my example is bad
<aw-> haha
<Regenaxer> I prefer 'member'
<Regenaxer> index counts, the the count is used to traverse again
<Regenaxer> all not critical if the list is short
<Regenaxer> then the overhead of *call*ing the function overweighs
<aw-> but member won't give the position in the list
<Regenaxer> right
<Regenaxer> depends what is needed
<aw-> position
<Regenaxer> as a number?
<aw-> yes
<Regenaxer> then index is the only way
<aw-> i was first going to compared the size of the original list and size of list after using (member)
<aw-> but that can't be faster
<Regenaxer> yeah, that's involving length
<Regenaxer> which traverses again
<Regenaxer> twice
<Regenaxer> So if you really need the numeric position, there is only index
<Regenaxer> (let N 0 (find '((X) (inc 'N) ... is *very* slow compared
<Regenaxer> but may be necessary sometimes
<Regenaxer> depends on the condition
<Regenaxer> I would estimate traversing a list of a dozen elements is less than a SUBR call overhead
<Regenaxer> So for short lists, better look at the number of necessary function calls
<Regenaxer> and an EXPR overhead is a lot more
<Regenaxer> binding the parameters etc.
<aw-> right
<aw-> i'm looking at all my code as you type these wonderful tips
<aw-> i have a lot of these nested (mapcar '((N) ... (mapcar '((S) ...)
<aw-> hurts my eyes
<aw-> i should look into optimizing those
<aw-> simplifying
<Regenaxer> I would not worry too early :)
<Regenaxer> mapcar makes sense
<Regenaxer> But less may be more ;)
<Regenaxer> (mapcar '((X) (foo X)) (mapcar '((X) (bar X)) Lst))
<Regenaxer> can of course be
<Regenaxer> (mapcar '((X) (foo (bar X))) Lst
<Regenaxer> )
<Regenaxer> it avoids building a garbage list
<Regenaxer> this is another rule
<Regenaxer> avoid building unnecessary structures
<aw-> interesting
<Regenaxer> I saw things like (mapcar print List)
<Regenaxer> instead of (mapc
<Regenaxer> each 'cons' is fast, but eventually triggers a 'gc'
<aw-> right, because mapcar builds a list
<Regenaxer> yeah
<aw-> which is uncessary for just printing
<beneroth> I would also say: if you have similar code, especially larger anonymous functions, rework them into single functions you can reuse.
<Regenaxer> hi beneroth
<beneroth> because then it is only stored once, uses RAM only once
<Regenaxer> right
<beneroth> Regenaxer, aw- yeah hi :)
<beneroth> and usually also nicer to read
<Regenaxer> yeah
<aw-> hi bene
<Regenaxer> if the names are good
<Regenaxer> that's the problem ;)
<beneroth> yeah.. well the top 3 software engineering problems being 1. naming 2. off by one
<beneroth> it is sooo true
<Regenaxer> hihi, yes
<beneroth> well, and knowing what we want to achieve anyway.. that is also hard.
<beneroth> often goes neglected
orivej has joined #picolisp
beneroth has quit [Ping timeout: 240 seconds]
alexshendi has joined #picolisp
orivej has quit [Ping timeout: 260 seconds]
orivej has joined #picolisp
orivej_ has joined #picolisp
orivej has quit [Ping timeout: 246 seconds]
orivej_ has quit [Ping timeout: 272 seconds]
_whitelogger has joined #picolisp