From: Eduardo O. <edu...@gm...> - 2024-09-23 12:22:41
|
Hi all, for more context, I wrote a function in Common Lisp called my-color-lerp that interpolates between colors, and now I am trying to call it from Maxima... this works, :lisp (my-color-lerp "#010203" "#112233" 0.93) but this doesn't: "?my-color-lerp"("#010203", "#112233", 0.93); I saw that I don't understand symbols in Maxima well enough and I decided to ask. Cheers, Eduardo On Mon, 23 Sept 2024 at 00:47, Eduardo Ochs <edu...@gm...> wrote: > Hi list, > > is there an easy way to distinguish the symbol "foo" from the symbol > "?foo" in Maxima? The question is bad, but look at the code below... > > "foo" in Maxima is "$FOO" in Lisp, and > "?foo" in Maxima is "FOO" in Lisp - > > ...but in Maxima the are displayed in the same way. > > Thanks in advance! > Eduardo Ochs > > Here is the code: > > --snip--snip-- > traverse_1 : lambda([o, action], > if is(action = 'op) then op(o) > elseif is(action = 'args) then args(o) > else args(o)[action])$ > traverse(o, [actions]) := xreduce('traverse_1, actions, o)$ > > :lisp (defun foo (x) (* 10 x)) > :lisp (foo 2) ;; 20 > ?foo(2); /* 20 */ > foo(2); /* foo(2) */ > > bar0 : lambda([x], foo(x)); > bar : lambda([x], ?foo(x)); > bar(2); /* 20 */ > traverse(bar); /* lambda([x], foo(x)) */ > traverse(bar, op); /* lambda */ > traverse(bar, args); /* [[x], foo(x)] */ > traverse(bar, args, 2); /* foo(x) */ > traverse(bar, args, 2, op); /* foo */ > > o : traverse(bar, args, 2, op); /* foo */ > foo; /* foo */ > > :lisp $o /* FOO */ > :lisp $bar0 /* ((LAMBDA SIMP) ((MLIST) $X) (($FOO) > $X)) */ > :lisp $bar /* ((LAMBDA SIMP) ((MLIST) $X) ((FOO) $X)) > */ > --snip--snip-- > > |