ok, now I see how to work it with '@. It refers to the value of the first argument:
(task -5000 (/ @ 5) N 0 (tty (println (inc 'N)))) I guess (eval (++ Prg) 1) is the idiom to let your functions use @. Though you have to be thoughtful of how you do it. This '@ comes from the 'when, which is the enclosing caller of the (eval (++ Prg) 1) expression. On Sun, May 16, 2021 at 7:19 PM polifemo <brunofrancosala...@gmail.com> wrote: > ok, I've found a way to pass an expression to eval: > (task -5000 (* 10 100) N 0 (tty (println (inc 'N)))) > > the next step is to figure a way to use @ inside that expression > > On Sun, May 16, 2021 at 7:14 PM polifemo <brunofrancosala...@gmail.com> > wrote: > >> I'm studying 'trace in @lib.l, and I've run into a question. >> I don't understand why must 'eval be called on the second number on the >> case that the first number is negative. I'm especially confused by giving 1 >> as an argument to 'eval. That's supposed to give you the context from which >> to extract the value of @, but since its a number, it should never have an >> @ to affect the result. If it was an expression, then I could understand, >> but I've tried passing an expression as a second argument several times and >> its always failed. >> >> My question would be, why eval the second argument, and why pass a 1 to >> eval when @ does not seem to be relevant in this context? >> >> Here's the body of the 'trace function, as a refresher. >> >> (de task (Key . Prg) >> (nond >> (Prg (del (assoc Key *Run) '*Run)) >> ((num? Key) (quit "Bad Key" Key)) >> ((assoc Key *Run) >> (push '*Run >> (conc >> (make >> (when (lt0 (link Key)) >> (link (+ (eval (++ Prg) 1))) ) ) #the line that >> confuses me >> (ifn (sym? (car Prg)) >> Prg >> (cons >> (cons 'job >> (cons >> (lit >> (make >> (while (atom (car Prg)) >> (link >> (cons (++ Prg) (eval (++ Prg) 1)) >> ) ) ) ) # the same pattern in another line. >> Prg ) ) ) ) ) ) ) >> (NIL (quit "Key conflict" Key)) ) ) >> >> >>