Re: The behaviour of arg
In this case I simply use (arg 1), I just wanted to check if perhaps (arg) defaulted to (arg 1) if no prior next had been called. On Sat, Nov 12, 2016 at 7:45 AM, Alexander Burgerwrote: > Hi Henrik, Andreas, > >> I guess this is the unforgiving punishment for calling (arg) without >> calling (next) previously, consider the reference: >> "If cnt is not given, the value that was returned from the last call >> to next" -> no previous call to next -> invalid usage -> punishment > > Exactly! In fact, 'arg' should check such illegal usage. It is a > secondary function, and not much used. > > > The main workhorse for variable arguments is 'next', and often > all that is needed: > >: (de f @ > (while (next) > (println @) ) ) > >-> f >: (f 1 2 3) >1 >2 >3 > > The purpose of 'arg' is to avoid the overhead of a local variable if > the value is used more than once. > > ♪♫ Alex > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: The behaviour of arg
Hi Henrik, Andreas, > I guess this is the unforgiving punishment for calling (arg) without > calling (next) previously, consider the reference: > "If cnt is not given, the value that was returned from the last call > to next" -> no previous call to next -> invalid usage -> punishment Exactly! In fact, 'arg' should check such illegal usage. It is a secondary function, and not much used. The main workhorse for variable arguments is 'next', and often all that is needed: : (de f @ (while (next) (println @) ) ) -> f : (f 1 2 3) 1 2 3 The purpose of 'arg' is to avoid the overhead of a local variable if the value is used more than once. ♪♫ Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
RE: The behaviour of arg
Hi Henrik Nice to read something from you, also the other emails, I'm looking forward to check out your new code! I immediately get SEGFAULT when calling your atst. Running pil64 on Linux 64bit (ubuntu). On which OS are you? I guess this is the unforgiving punishment for calling (arg) without calling (next) previously, consider the reference: "If cnt is not given, the value that was returned from the last call to next" -> no previous call to next -> invalid usage -> punishment The following works for me: (de atst @ (next) (println (arg)) ) arg seems to be a special purpose function. if you just want to have the whole list of arguments, use (rest) instead: : (de atst @ (println (rest) ) ) -> atst : (atst 1 2 3) (1 2 3) -> (1 2 3) Greatings, beneroth - Original Message - From: Henrik Sarvell [mailto:hsarv...@gmail.com] To: picolisp@software-lab.de Sent: Fri, 11 Nov 2016 23:08:04 +0100 Subject: The behaviour of arg Hi Alex and list. If I do like this: (de atst @ (println (arg)) ) (atst 1 2 3) (bye) I never reach (bye) and I can't even abort with ctrl-c or d (had to kill -9), is there a reason for this unforgiving punishment of arg abuse or did I find some minor bug? -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
The behaviour of arg
Hi Alex and list. If I do like this: (de atst @ (println (arg)) ) (atst 1 2 3) (bye) I never reach (bye) and I can't even abort with ctrl-c or d (had to kill -9), is there a reason for this unforgiving punishment of arg abuse or did I find some minor bug? -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe