|
From: Barton W. <wi...@un...> - 2024-09-23 12:30:51
|
Suggestion: In CL, define a user-level function for my-color-lerp; something like
(defun $my_color_lerp (a b c)
(my-color-lerp a b c))
Alternatively, rename the CL function my-color-lerp to $my_color_lerp.
Or possibly you can call my-color-lerp from a Maxima command line as
?my\-color\lerp("#010203", "#112233", 0.93);
--Barton
________________________________
From: Eduardo Ochs <edu...@gm...>
Sent: Monday, September 23, 2024 07:22
To: <max...@li...> <max...@li...>
Subject: Re: [Maxima-discuss] How do I distinguish foo from ?foo, i.e., $FOO from FOO, in Maxima?
Caution: Non-NU Email
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...<mailto: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--
|