; excl1.lisp example print string, integer, float (print "clisp excl1.lisp # running") #| block comments ( ) executes the function operation print a function result |# (setq mystr "my string") ; give a string a variable name (print mystr) (setq i 7) ; give a integer a variable name (print "i 7 =") (print i) (print "increment i") (setq i (+ i 1)) (print i) (setq x 76.54) ; give a real a variable name (setf xx 45.67) (setq y 1.2345D2) ; D allowed (setq z 3.456e+4) ; e+ more common (setq zz 3.456e-4) ; e- OK see how it prints (print "x 76.54 =") (print x) (print "xx 45.67 =") (print xx) (print "y 1.234D2 =") (print y) ; shifted (print "z 3.456e+4 =") (print z) ; shifted (print "zz 3.456e-4 =") (print zz) ; same (print "(+ x y) =") ; using variables set above (print (+ x y)) (print "(+ x z) =") (print (+ x z)) (print "(+ z zz} =") (print (+ z zz)) (print "(+ 2 3) =") ; operate on constants (write (+ 2 3)) (print "(newline) is not defined"); (print " ") (print "two blank lines") (FORMAT T "~% ~%" #\return #\linefeed ) NIL (print "end blank lines") ; a list, rather than an operation starts with '( (print '("text" 123 3.14159)) (print "(cons 123 (cons 3.14159 nil))=" ) (print (cons 123 (cons 3.14159 nil)) ) (print "why? (cons 123 3.14159)=" ) (print (cons 123 3.14159) ) (print (format t "string=~s int=~d real=~f" "abc" 123 3.24)) (print "T stands for true, NIL stands for false") (print "(print (eq 2 2))=") (print (eq 2 2)) (print "(print (eq 2 3))=") (print (eq 2 3)) (print "excl1.lisp finished")