using infix --> to define a lambda form
- Subject: using infix --> to define a lambda form
- From: Barton Willis
- Date: Wed, 18 Apr 2012 10:39:14 +0000
By the way: (not sure about lbp & rbp)
(%i20) infix("-->",90,90)$
(%i21) assume(x < 0)$
(%i22) f : x --> abs(x);
(%o22) lambda([x],abs(x))
(%i23) f : [] --> %pi;
(%o23) lambda([],%pi)
(%i24) f : [x,y] --> x+y;
(%o24) lambda([x,y],x+y)
(%i30) f : [x,y] --> -x;
(%o30) lambda([x,y],-x)
(defmspec $--> (l)
(let* ((op (car (pop l)))
(x (if l (pop l) (wna-err op)))
(e (if l (pop l) (wna-err op))))
(if l (wna-err op))
(take '(lambda) (if ($listp x) x (take '(mlist) x)) e)))
--bw