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
rob_w has quit [Quit: Leaving]
orivej has joined #picolisp
orivej has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp
orivej has quit [Quit: No Ping reply in 180 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 [Ping timeout: 264 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 264 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 264 seconds]
orivej_ has joined #picolisp
orivej_ has quit [Ping timeout: 260 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 258 seconds]
orivej has joined #picolisp
razzy has joined #picolisp
orivej has quit [Ping timeout: 256 seconds]
orivej has joined #picolisp
_whitelogger has joined #picolisp
orivej has joined #picolisp
orivej has quit [Ping timeout: 258 seconds]
orivej has joined #picolisp
mtsd has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]
orivej has joined #picolisp
orivej_ has joined #picolisp
orivej has quit [Ping timeout: 264 seconds]
orivej_ has quit [Ping timeout: 260 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 258 seconds]
orivej has joined #picolisp
<beneroth> hi all
<tankf33der> o/
<beneroth> \o tankf33der
<Regenaxer> Hi beneroth, tankf33der
<tankf33der> picoLisp works on Linux kernel 5.7
<razzy> Hi all :]
<beneroth> tankf33der, yay!
<Regenaxer> Hi razzy
<beneroth> tankf33der, thanks for testing
<beneroth> Hi razzy :)
<beneroth> hi Regenaxer :)
<beneroth> Regenaxer, I like to do some code rewriting while loading, a bit like C macros.. so `(foo ...) is the way to go. But how to guarantee that no accidental (foo ...) (without read macro) remains? zapping or redef 'foo after load?
<Regenaxer> yes, zap is good
<Regenaxer> or a transient symbol
<beneroth> well the definition for 'foo needs to be outside of the loaded file
<Regenaxer> ah, ok
<Regenaxer> and the 'zap' too?
<beneroth> aye
<beneroth> I imagine:
<beneroth> (de foo ...) (load ...) (zap 'foo) ?
<Regenaxer> You could also (let foo '((X) ...) (load ...
<beneroth> T
<beneroth> could also be (let foo nsp~bar (load ...)) right?
<Regenaxer> yes
<beneroth> got it, thanks :-)
<Regenaxer> :)
orivej has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp
<aw-> hi all
<aw-> tankf33der here?
<tankf33der> here.
<Regenaxer> Hi aw-
<aw-> i'm looking for a hash algorithm in pure picolisp
<aw-> the smallest one possible
<aw-> same input, same output
<tankf33der> take this one.
<aw-> hmm.. kinda big
<tankf33der> passed tests against wireguard :)
<tankf33der> modern and secure. you dont want use md2
<Regenaxer> Does it need to be cryptographically secure?
<Regenaxer> or just hash values?
<aw-> no
<aw-> just hash
<tankf33der> aaaa
<Regenaxer> Then use the built-in 'hash' ?
<aw-> yeah i looked but it only takes 16-bit input.. i guess i could split my str and run it multiple times?
<Regenaxer> No, it takes arbitrary input
<aw-> oh wait.. 16-bit output
<Regenaxer> any s-expr
<Regenaxer> yes
<aw-> i just saw
<aw-> oops
<aw-> ok that's perfect then
<aw-> thanks
<tankf33der> aw-: yes, use it.
<Regenaxer> It returns a symbol, you can use it to store a zayload there btw
<tankf33der> it is crc-16-ansi inside.
<Regenaxer> where?
orivej has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp
<tankf33der> code for hash
<Regenaxer> Not crc, it is based on the 64-bit random generator
orivej has quit [Ping timeout: 260 seconds]
<tankf33der> i see this comment in big.c /* CRC Polynom x**16 + x**15 + x**2 + 1 */
orivej has joined #picolisp
<tankf33der> and crc16 ansi name from wikipedia
<Regenaxer> ah, ok, pil32
<Regenaxer> correct
<Regenaxer> and pil64 too, sorry, I forgot ;)
<Regenaxer> Thanks for mentioning!
<Regenaxer> So it first produces a 64-bit number from 'seed', by randomizing the argument expression, then builds a 16-bit CRC from it
rob_w has joined #picolisp
orivej has quit [Ping timeout: 258 seconds]
orivej has joined #picolisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
<tankf33der> :)
orivej has joined #picolisp
<cyborg_ar> LOL
<cyborg_ar> i wonder if this ever happened to anyone here
<cyborg_ar> digikey sent me a strip of resistor labelled 1K
<cyborg_ar> they are 10K
<cyborg_ar> no wonder my LEDs were so dim
patrixl has quit [Quit: Leaving.]
orivej has quit [Ping timeout: 256 seconds]
orivej has joined #picolisp
<beneroth> hey cyborg_ar !
<beneroth> long time not seen
<cyborg_ar> woops. i meant to put that in another channel, but yeah
<cyborg_ar> haha
<beneroth> what did you use the LEDs for?
orivej has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp
<Regenaxer> Hi cyborg_ar
<Regenaxer> :)
<cyborg_ar> they were indicators in a battery charging PCB
<Regenaxer> 20 years ago I still could read the color codes without thinking ... now completely gc'd I'm afraid
<cyborg_ar> oh these were 0402 surface mount resistors, no markings at all
<cyborg_ar> i need to invest on those tweezer type multimeters
<Regenaxer> hehe
<beneroth> Regenaxer, same, I liked to play with Kosmos kits as a 10 year old xD
<Regenaxer> :)
<Regenaxer> tankf33der, 'unwind' now almost implemented. Only unwinding the coroutine frames is still missing
<Regenaxer> Concerning the gc bug, I did not investigate further
<tankf33der> ok
<aw-> haha i knew they were surface mount as soon as you said "strip"
<aw-> 0402 are... quite small
orivej has quit [Ping timeout: 256 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 256 seconds]
orivej_ has joined #picolisp
razzy has quit [Quit: Connection closed]
orivej_ has quit [Ping timeout: 256 seconds]
orivej has joined #picolisp
orivej_ has joined #picolisp
orivej has quit [Ping timeout: 264 seconds]
orivej_ has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
mtsd has quit [Quit: Leaving]
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
orivej has quit [Ping timeout: 246 seconds]
<aw-> task question
<aw-> when doing (task -3000 5000 (dosomething)) ... how can the (dosomething) function end the task?
<aw-> (task -3000), but what if -3000 is a variable?
<Regenaxer> Yes, (task -3000) is whe way. -3000 is constant
<aw-> ex: [de dotask (Time) (task Time 5000 (task Time)] ?
<aw-> doesn't work for me
<Regenaxer> you can use a variable
<Regenaxer> or global
<aw-> it remains in *Run even after 5s
<Regenaxer> (setq *MyTimer -3000)
<Regenaxer> (task *MyTimer 2000 ...
<aw-> hmmm.. before calling (task) ?
<Regenaxer> In any way
<aw-> ok let me try
<Regenaxer> The first arg(s) of task are evaluated the normal way
<aw-> ohh i have to send arguments to task?
<aw-> like (task Time 5000 N 0 ...)
<Regenaxer> (task 'num ['num] [sym 'any ..] [. prg])
<aw-> yes i see it
<Regenaxer> So there may be many evaluated args
<Regenaxer> ie the env values
<Regenaxer> The 'sym's and the 'prg' are not evaluated
<aw-> hmmmm
<aw-> (setq *Timer -3000) (task *Mytimer 2000 (prinl "Removing timer") (task *Mytimer))
<aw-> doesnt work
<aw-> oops sorry
<aw-> let me try again
* beneroth looks forward to aw-'s EXPLAIN on this topic ^^
<aw-> yeah.. if I get it working
<aw-> oh that' weird
<aw-> Regenaxer: if I do (use *Timer (setq *Timer -3000) (task *Timer .... ) doesn't work
<aw-> (use *Timer ..) seems to be the issue
<Regenaxer> sure
<Regenaxer> It is dynamic binding
<Regenaxer> You can pass it in the env
<Regenaxer> (let Tim -3000 (task Tim 1000 'Tim Tim ... (task Tim)))
<Regenaxer> The task has then its own environment
<Regenaxer> 'Tim' in this case
<Regenaxer> Local bindings with 'let' or 'use' are gone when the task runs later in its own env
<aw-> ahhhhh
<aw-> ok that's why (let N ...) wasn't working either
<aw-> ok that makes sense
<aw-> i'll try this
<Regenaxer> sorry, one quote too much
<Regenaxer> as I said, the syms are not evaluated
<Regenaxer> (task -2000 0 N 7 (msg (inc 'N)))
<aw-> great!
<aw-> ok it works now
<Regenaxer> great :)
<aw-> i was looking at that example but slow to grok ;)
<Regenaxer> One problem with timers calculated at runtime is that you must make sure that they don't conflict
<Regenaxer> each timer needs a (slightly) different value
patrixl has joined #picolisp
<Regenaxer> No problem if you have only one timer, and it stops before being started again
<aw-> i plan to have many
<Regenaxer> So it needs some care
<aw-> but i'm using a key to store the unique number of the task
<aw-> (dec '*Timer)
<Regenaxer> ok
<Regenaxer> You could also check with (assoc ... *Run)
<Regenaxer> and increment if it runs already
<aw-> hmmm
<aw-> so since a task runs in a different env, it can't change the value of global variables?
<Regenaxer> No, globals can be changed normally
<Regenaxer> 'env' means local variable bindings
<Regenaxer> Works with 'job's
<aw-> oh ok
<aw-> perfect
<aw-> i have one more question for you if you don't mind
<Regenaxer> no problem
<aw-> i don't fully understand the difference between (set 'Var 123) and (setq Var 123).. i know it has to do with evaluation but it ends there
<Regenaxer> These two are 100% equivalent
<aw-> i know
<aw-> but why use one or the other?
<Regenaxer> setq is shorter
<Regenaxer> and faster
<aw-> so they're = equivalent, no == equivalent
<Regenaxer> (set (quote . Var) 123) calls a function
<Regenaxer> equivalent in behavior
<aw-> yes i knew that
<aw-> why is (set) slower?
<Regenaxer> The call to the quote function is some overhead
<Regenaxer> very little though
<aw-> oh i see
<Regenaxer> and the program size is one cell bigger
<Regenaxer> So gc has more to do ;)
<aw-> (setq (quote . Var) 123) is very clear for me
<aw-> thank you
<Regenaxer> but it is useless
<Regenaxer> (set (quote ... makes sense
<Regenaxer> (setq (quote . Var) will modify the *cell* (quote . Var)
<Regenaxer> (de f (N) (setq (quote . Var) N))
<Regenaxer> (f 1)
<Regenaxer> (pp 'f)
<Regenaxer> afp
orivej has joined #picolisp
patrixl has quit [Read error: Connection reset by peer]
patrixl has joined #picolisp
<Regenaxer> ret
orivej has quit [Ping timeout: 264 seconds]
<aw-> Regenaxer: if I install a task, and then listen on a named pipe (blocking), will the task continue running?
<aw-> or.. will the task run at all after N seconds?
orivej has joined #picolisp
<aw-> seems to freeze in my tests
<Regenaxer> yes, it is cooperative
<Regenaxer> A blocking read always stops the whole process
<Regenaxer> The pipe must be in a task too
<Regenaxer> You must understand how task (or, to be exact, *Run) works
<Regenaxer> ie the select() or poll() system call
<Regenaxer> The term "multiplexed I/O" in Unix terminology
<Regenaxer> *Run is just a front-end to select()
<Regenaxer> or poll() in pil21
<Regenaxer> select() and poll() is the same system call in the Unix kernel
orivej has quit [Ping timeout: 256 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 260 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 256 seconds]
orivej_ has joined #picolisp
<tankf33der> Regenaxer: remember how select is broken in musl? repl does not working. i will try pil21 on musl, was the same monthes ago. maybe try reimplement via poll then?
<Regenaxer> pil21 does not use select()
<Regenaxer> IIRC on musl the problem was that the "time not slept" (as written in the Linux man page of select()) was not set in musl
<Regenaxer> poll() does not have this feature anyway
<Regenaxer> Also, select() limits to 1024 file descriptors
<Regenaxer> poll() has no limit, so we can fork more child processes in pil21
orivej_ has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp
<tankf33der> ok, then add glibc only as dependency
<Regenaxer> in Makefile?
<Regenaxer> Just take the C default of the target system
<Regenaxer> i.e. -lc
<tankf33der> add to readme of doc/diff or readme
<tankf33der> just note
<Regenaxer> Why should we mention glibc?
<Regenaxer> It is all the job of llvm
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
<tankf33der> because it hangs on musl
<tankf33der> so this is glibc only lisp
<Regenaxer> pil21 also hangs?
<Regenaxer> without select()?
<Regenaxer> I think it hung because the timer was mis-calculated
<tankf33der> yea
orivej has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp
<Regenaxer> So no problem?
<Regenaxer> Because the tests you made with musl was pil64?
orivej has quit [Ping timeout: 264 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 246 seconds]
orivej_ has joined #picolisp
orivej_ has quit [Ping timeout: 260 seconds]