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