Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Textbook1

(print (cons 'a '(b c d)))

(cond ((> 1 6) (print 5))
        (t  (print 6))
)

(let* ((x 2) 
    (y (+ 2 x)))
    (print (+ x y))
)

(let ((x 1))
    (let ((y (+ x 1)))
    (print (+ y x))
    )
)

(defun absdiff(x y)
    (if (> x y)
        (- x y)
        (- y x)
    )
)

(print "Absolute value:") 
(print (absdiff 5 8))

(print (third '(a b c d)))
(print (sort (list 5 0 7 3 9 1 4 13 23) #'<))

(print (mapcar #'- '(8 12) '(4 5)))

(print (funcall #'+ 1 5 6))
(print (apply #'+ '(5 5 6)))

(defun make-quote (thing &optional arg)
    (list thing arg)
)

(print (make-quote 'all))
(defun fn (x)
    (cond   
        ((numberp x) #'+)
        ((listp x) #'append)
    )
)

(defun combine(&rest args)
    (apply (fn (car args)) args)
)
(print (combine '(a b)))

(defun consr (lst elt)
    (if (null lst)
        (list elt) 
        (cons (car lst) (consr (cdr lst) elt))
    )
)

(print (consr '(a b c e) 'd))

(print (mapcar #'* '(2 3) '(2 5 6)))
(defparameter *pi* 3.14)
(print *pi*)
(print (boundp '*pi*))

(defconstant limit 100)
(print limit)


Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.