<CORDIC>
I remember "for" was difficult for me, too. Even today I use "doc" in REPL for almost everything. FWIW I would use recursion.
tankf33der has joined #picolisp
<tankf33der>
o/
<CORDIC>
razzy: Perhaps "loop" would be a better choice than "for"?
<CORDIC>
Good morning tankf33der.
<Regenaxer>
Hi CORDIC, tankf33der
<Regenaxer>
'for' is rather overloaded indeed
<Regenaxer>
The third form is analog to 'for' in C or Java. It was historically the first one in pil.
<Regenaxer>
The other two are simplifications
<Regenaxer>
So (3) is e.g.
<Regenaxer>
: (for (N 1 (>= 7 N) (+ N 2))
<Regenaxer>
(println N) )
<razzy>
i like first two fors :]
<razzy>
now i get it :D
<Regenaxer>
:)
<razzy>
this i will put in my examples :]
CORDIC has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
orivej has joined #picolisp
razzy has quit [Ping timeout: 240 seconds]
razzy has joined #picolisp
razzy has quit [Remote host closed the connection]
razzy has joined #picolisp
xkapastel has joined #picolisp
alexshendi has joined #picolisp
xkapastel has quit [Quit: Connection closed for inactivity]
alexshendi has quit [Ping timeout: 240 seconds]
<razzy>
i have trouble understanding why my code rewrite itself when i use (setq (eval LocalVar) Var ) http://ix.io/1FsO combo (set LocalVar Var) is ok http://ix.io/1FsR. maybe you ansvered to me already. but i forgoten. it is confusing.
alexshendi has joined #picolisp
<Regenaxer>
Why do you eval it? Is 'Tim' an exe?
alexshendi has quit [Read error: Connection reset by peer]
<Regenaxer>
you seem to pass 't', which is a function
<Regenaxer>
not an exe
<Regenaxer>
'Prg' is a misnomer, it indicates usuall a list or 'exe's, ie. a 'prg'
<Regenaxer>
Anyway, I think you must find out yourself. It is more work to explain than to find it out by oneself ;)
<razzy>
i will post good version with ussage
<Regenaxer>
ok
alexshendi has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
<razzy>
http://ix.io/1FsZ works as expected. http://ix.io/1FsO rewriting itself, propably because i am misusing setq, because setq is only "macro" idk.
<Regenaxer>
Please call it 'Exe', not 'Prg'
<razzy>
ok, np
<Regenaxer>
This code still looks wrong
<Regenaxer>
You 'set' to the global 't'
<Regenaxer>
(usect 't '(size C))
<razzy>
yes i am exporting value
<Regenaxer>
look at the value of 't', it is probably destroyed
<Regenaxer>
't' is a function
<Regenaxer>
a built-in
<razzy>
upsie
<Regenaxer>
(use t (usect 't '(size C))) perhaps, but still not good
<Regenaxer>
(use T ... is of course also not good
<razzy>
ha ha, never thought t is build-in function :D
<Regenaxer>
You should not use lower case for such local variables!
<Regenaxer>
You could use '@@', it is a kind of standard for a second return value
<razzy>
t was testing variable for storing time. and i knew T is taken :]
<razzy>
thx
<Regenaxer>
yes, good
<Regenaxer>
I would do something like that:
<Regenaxer>
(de usect Prg
<Regenaxer>
(let A (usec)
<Regenaxer>
(prog1
<Regenaxer>
(run Prg 1)
<Regenaxer>
(setq @@ (- (usec) A)) ) ) )
<Regenaxer>
or
<Regenaxer>
if you want to go with a variable
<Regenaxer>
(de usect (Var . Prg)
<Regenaxer>
(let A (usec)
<Regenaxer>
(prog1
<Regenaxer>
(run Prg 1)
<Regenaxer>
(set Var (- (usec) A)) ) ) )
<Regenaxer>
(use Tim (usect 'Tim '(size C)) ...)
<Regenaxer>
oops
<Regenaxer>
(use Tim (usect 'Tim (size C)) ...)
<razzy>
why is (run) important?
<Regenaxer>
ie a 'prg'
<Regenaxer>
not imprtant, but more useful
<Regenaxer>
must go, afp
<razzy>
i do not see difference between eval and run
<Regenaxer>
ret
<Regenaxer>
Also of course better protect the vars
<Regenaxer>
More "correct" is
<Regenaxer>
(de usect ("Var" . "Prg")
<Regenaxer>
(let A (usec)
<Regenaxer>
(prog1
<Regenaxer>
(run "Prg")
<Regenaxer>
(set "Var" (- (usec) A)) ) ) )
<Regenaxer>
Think about it!
<razzy>
afk, i will answer later
xkapastel has joined #picolisp
jibanes has quit [Ping timeout: 250 seconds]
jibanes has joined #picolisp
orivej has quit [Ping timeout: 268 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 268 seconds]
alexshendi has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
ubLIX has joined #picolisp
alexshendi has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
ubLIX has quit [Ping timeout: 268 seconds]
alexshendi has quit [Read error: Connection reset by peer]
ubLIX has joined #picolisp
ubLX has joined #picolisp
ubLIX has quit [Ping timeout: 250 seconds]
alexshendi has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
alexshendi has quit [Read error: No route to host]
alexshendi has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
_whitelogger has joined #picolisp
xkapastel has quit [Quit: Connection closed for inactivity]
xkapastel has joined #picolisp
_whitelogger has joined #picolisp
freemint has joined #picolisp
xkapastel has quit [Quit: Connection closed for inactivity]