ChanServ changed the topic of #picolisp to: PicoLisp language | Channel Log: https://irclog.whitequark.org/picolisp/ | Picolisp latest found at http://www.software-lab.de/down.html | check also http://www.picolisp.com for more information
aw- has joined #picolisp
<aw-> tankf33der, beneroth re: nanoseconds: (in '(date "+%s.%N") (line T))
<Regenaxer> Thanks aw-! Or, to get nanoseconds directly, (in '(date "+%s%N") (read))
rob_w has joined #picolisp
<beneroth> :)
<beneroth> hi aw-, Regenaxer
<Regenaxer> Hi beneroth
orivej has joined #picolisp
<aw-> hi bene
alexshendi has quit [Ping timeout: 248 seconds]
alexshendi has joined #picolisp
orivej has quit [Ping timeout: 248 seconds]
alexshendi has quit [Ping timeout: 240 seconds]
jibanes has quit [Ping timeout: 256 seconds]
jibanes has joined #picolisp
aw- has quit [Quit: Leaving.]
karswell has quit [Remote host closed the connection]
karswell_ has joined #picolisp
karswell_ has quit [Remote host closed the connection]
karswell_ has joined #picolisp
pchrist has quit [Quit: leaving]
pchrist has joined #picolisp
<beneroth> Regenaxer, why does picolisp date start with 1. March?
<beneroth> ^^
<Regenaxer> I don't know, it is the calendar formula I used
<Regenaxer> The Roman Empire started the year in March
<Regenaxer> February was the last month of the year, that's why it is shorter
<Regenaxer> And September, October ... December is the 7th, 8th .. 10th month
<Regenaxer> So makes sense somehow
<beneroth> so the answer is "Romans". fine, one more thing they caused :P
<beneroth> thanks Regenaxer :)
<Regenaxer> :)
orivej has joined #picolisp
* beneroth is using a programming language which uses concepts of the ancient Romans - ha
<beneroth> (well ok most languages do - latin alphabet. damn romans)
<Regenaxer> hehe ;)
<beneroth> Regenaxer, I'm confused. what is the (iter) variant of (collect 'id '+Drawing "01234") ? 'id is (+Aux +Ref +String)
rob_w has quit [Quit: Leaving]
<beneroth> found it. thanks to tracing 'collect (it is so handy when stuff is implemented in same language one uses!): (iter (tree 'id '+Drawing) NIL (cons "01234") (cons "01234" T))
beneroth has quit [Ping timeout: 248 seconds]
karswell_ has quit [Ping timeout: 256 seconds]
beneroth has joined #picolisp
<Regenaxer> beneroth, yes, tracing is often the best to see what is happening
orivej_ has joined #picolisp
orivej has quit [Ping timeout: 248 seconds]
orivej_ has quit [Ping timeout: 248 seconds]
<beneroth> Regenaxer,
<beneroth> I have an issue with (state) when using an explicit variable
<beneroth> Is this behaviour intended or a bug?
<beneroth> version 17.12.30
<Regenaxer> You pass a variable *in* a variable ;)
<beneroth> what?
<Regenaxer> Try (let ... State 'state ... (state State ...
<Regenaxer> The typical use case (state '(foo) uses a cell as 'var'
<Regenaxer> So (state '(foo) uses an anonymous variable
<Regenaxer> same as (let S 'foo (state S ...
<Regenaxer> "variable var holds the current state as a symbolic value"
<beneroth> "(let ... State 'state ... (state State ..." is wrong
<Regenaxer> in your case you pass a list
<Regenaxer> yes
<Regenaxer> sure
<Regenaxer> (state 'State ...
<beneroth> my example with (let ... State 'check ... (state State ... -> endless loop
<beneroth> ah
<Regenaxer> We must pass a 'var'
<beneroth> I see
<Regenaxer> '(foo) is also a var
<Regenaxer> as 'State
<beneroth> yep this was it works as expected
<Regenaxer> cool
<beneroth> '(foo) comes from the example in the ref
<Regenaxer> yes, I always used this pattern, ie. an inline "var"
<beneroth> how common is the use case for an anonymous var with (state) ? maybe having an example with a non-anonymous variable would be clearer...
<Regenaxer> But it keeps the state between invocations
<Regenaxer> it depends
<beneroth> well no way to access the state when using an anonymous var, right?
<Regenaxer> yep
<beneroth> I think (state) could benefit from having additional examples. or maybe better a full article? hmm...
<Regenaxer> For example, @lib/vip.l does it that way iirc
<beneroth> yeah I can see the benefits. also the example having (job) makes sense
<Regenaxer> ah, no, it uses 'S
<Regenaxer> yes, in 'job' it is all right
<beneroth> meant for re-usage
<beneroth> I use it for parsing, so when re-using, I want to start again at the first state ;)
<Regenaxer> it keeps the state between invocations
<Regenaxer> yes, same in vip.l
<Regenaxer> there it is markup, not parsing though
<beneroth> thanks for your help.
<Regenaxer> :)
<beneroth> :)
<beneroth> well the signature of the function in the ref is rather clear about the 'var
<Regenaxer> T
<Regenaxer> It is not a common case
<Regenaxer> perhaps
<Regenaxer> passing a var in this way?
* beneroth just wondered why first import runs fine but second one finishes, producing no results but neither having any errors
<Regenaxer> haha, yeah
<beneroth> tested and tested and got confused
<Regenaxer> :)
<beneroth> dunno I never used nor saw the '(anon-var) usage except for that (state) example
<beneroth> why a list? why not just 'state ?
<Regenaxer> I do it often in tasks
<Regenaxer> (task -2000 0 (msg (inc (0]
<beneroth> yeah I haven't used tasks yet. I work with single short-living processes. or now with a dedicated worker process. but not tasks, yet.
<Regenaxer> Another cool example is this pattern to measure the elapsed time between calls:
<Regenaxer> (msg (- (usec) (swap (0) (usec))))
<Regenaxer> I use that in some places
<beneroth> wow
<beneroth> strong stuff
<Regenaxer> No need for a special (global ?) var
* beneroth feels like a beginner again, him using (let U (usec) ... xD
<beneroth> yeah elegant!
<Regenaxer> (task -2000 0 (msg (- (usec) (swap (0) (usec)))))
<beneroth> this way just didn't occur to me
<Regenaxer> yeah, a bit tricky
<beneroth> not really actually.
<Regenaxer> It should not need to call (usec) twice though
<Regenaxer> But then it needs a var
<beneroth> he? you need to call (usec) twice to have two measurements, no?
<Regenaxer> no, they give almost the same value
<Regenaxer> So this would do too:
<Regenaxer> (task -2000 0 (msg (prog1 (usec) (- @ (swap (0) @)))))
<beneroth> I don't grok it now, it seems. too tired (dunno why). will copy this to txt and study again another time. THX :)
<Regenaxer> I found two (usec)s ok for simplicity
<beneroth> well what do you measure here?
<Regenaxer> Not important!
<Regenaxer> I want to know the time between calls to this place
<Regenaxer> eg measure the framerate of Canvas
<beneroth> where are the calls?
<Regenaxer> just insert this line into arbitrary places
<Regenaxer> eg at top of drawing a page
<Regenaxer> The first print is nonsense, as it gives the diff to 0
<Regenaxer> but after that it gives the diff to the time of the last call
<Regenaxer> (<num>) keeps the last
<beneroth> I think my understanding of (task) is the issue here
<Regenaxer> The task is only to test it
<beneroth> first 'num arg is just the identifier, right? second is the time value (unit?) to execute it?
<Regenaxer> (task -6000 1000
<Regenaxer> every 6 secs, first after 1 sec
<Regenaxer> so the first arg is the period length
<beneroth> ah
<beneroth> I see
<Regenaxer> the second is the start value of the state
<beneroth> so (task -2000 0 (msg (prog1 (usec) (- @ (swap (0) @))))) should execute every 2 seconds, if our process is active all this time?
<beneroth> ah now I see
<beneroth> no
<beneroth> wait phone
<Regenaxer> What do you mean with active?
<Regenaxer> ok
<Regenaxer> (task -2000 0 starts immediately (0 secs), next time after 2 secs etc.
jibanes has quit [Ping timeout: 256 seconds]
jibanes has joined #picolisp
<beneroth> ok, so you just use this to print every 2 seconds the microseconds which passed since the last print
<beneroth> ?
<Regenaxer> yes
<beneroth> ok. got it then. thanks :)
<Regenaxer> :)
orivej has joined #picolisp
jibanes has quit [Ping timeout: 240 seconds]
jibanes has joined #picolisp
alexshendi has joined #picolisp
karswell has joined #picolisp
shpx has joined #picolisp
shpx has quit [Ping timeout: 268 seconds]