| Problem: arc> (for i 1 5 (thread:prn i))
nil
arc> 6 ; "6" is not some input here
6
6
6
6
Eventual patch, change the definition of 'for in arc.arc by: (mac for (v init max . body)
(w/uniq (gv gi gm)
`(with (,gv nil ,gi ,init ,gm (+ ,max 1))
(loop (assign ,gv ,gi) (< ,gv ,gm) (assign ,gv (+ ,gv 1))
((fn (,v) ,@body) ,gv)))))
w/patch: arc> (for i 1 5 (thread:prn i))
nil
arc> 5
3
1
4
2
(The example here is useless, but I found this "bug" while wanting to consecutively spawn n threads to do some work and then report they were done with their "numero", i.e something like: "thread 4: job's done". Maybe the patch breaks some things, not intensively tested. And maybe the current behaviour is actually expected, don't know.) |