Sponsored links: Algebra eBooks
 

Related

values

a:1;

values;

Calculate

values

a:1;

values;

Calculate

values

a:1;

values;

Calculate

values

:lisp (values ...

Calculate

values

a:1;

values;

Calculate

values

:lisp (defvar *my-lis...

:lisp (defun count-no...

:lisp (count-nodes *m...

Calculate

values

:lisp (values ...

Calculate

values

:lisp (values ...

Calculate

values

Run Example
(%i1)a:1;
(%o1)                                  1
(%i2) b:2;
(%o2)                                  2
(%i3) c:a+b;
(%o3)                                  3
(%i4) values;
(%o4)                              [a, b, c]
(%i5) values[a];
(%o5)                                  a
(%i6) 
Run Example
:lisp (defun split-if (fn lst)  (let ((acc nil))    (do ((src lst (cdr src)))        ((or (null src) (funcall fn (car src)))         (values (nreverse acc) src))      (push (car src) acc))));

SPLIT-IF
(%i1) :lisp (defvar *my-list* '(1 2 3 4 5 6 7 8 9));

*MY-LIST*
(%i1) :lisp (let* ((result)            (final)           (list (dolist (x *my-list* (remove 'nil (nreverse result))) (push (split-if (lambda (x) (evenp x)) (list x)) result))))             (dolist (x list (nreverse final)) (push (car x) final)));

(1 3 5 7 9)
(%i1) :lisp (defun 2- (x) (- x 2));

2-
(%i1) :lisp (defun mkstr (&rest args)  (with-output-to-string (s)    (dolist (a args) (princ a s))));

MKSTR
(%i1) :lisp (defun symb (&rest args)  (values (intern (apply #'mkstr args))));

SYMB
(%i1) :lisp (symb 3 '-);

3-
(%i1) :lisp (defmacro gen-dec-n (n &rest body)          `(defun ,(symb n '-) (x) (- x ,n)));

GEN-DEC-N
(%i1) :lisp (macroexpand-1 '(gen-dec-n 3));

(DEFUN 3- (X) (- X 3))
T
(%i1) :lisp (gen-dec-n 3);

3-
(%i1) :lisp (gen-dec-n 5);

5-
(%i1) :lisp (5- 10);

5
(%i1) 
Run Example
:lisp (defun split-if (fn lst)  (let ((acc nil))    (do ((src lst (cdr src)))        ((or (null src) (funcall fn (car src)))         (values (nreverse acc) src))      (push (car src) acc))));

SPLIT-IF
(%i1) :lisp (defvar *my-list* '(1 2 3 4 5 6 7 8 9));

*MY-LIST*
(%i1) :lisp (let* ((result)            (final)           (list (dolist (x *my-list* (remove 'nil (nreverse result))) (push (split-if (lambda (x) (evenp x)) (list x)) result))))             (dolist (x list (nreverse final)) (push (car x) final)));

(1 3 5 7 9)
(%i1) :lisp (defun 2- (x) (- x 2));

2-
(%i1) :lisp (defun mkstr (&rest args)  (with-output-to-string (s)    (dolist (a args) (princ a s))));

MKSTR
(%i1) :lisp (defun symb (&rest args)  (values (intern (apply #'mkstr args))));

SYMB
(%i1) :lisp (symb 3 '-);

3-
(%i1) :lisp (defmacro gen-dec-n (n &rest body)          `(defun ,(symb n '-) (x) (- x ,n)));

GEN-DEC-N
(%i1) :lisp (macroexpand-1 '(gen-dec-n 3));

(DEFUN 3- (X) (- X 3))
T
(%i1) :lisp (gen-dec-n 3);

3-
(%i1) :lisp (loop for i from 2 below 10 do (gen-dec-n i));

NIL
(%i1) 

Related Help

Help for Values