set take echo on set sexp echo on (pi) (t) (nil) () (setq a 2 b -1.3) (+ a b) (- 9 5 2 1) (* a (+ b 1) 3) (/ b a 2) (^ 3 2) (++ a 1.2) (-- a) (setq a 2 b -1.3) (abs (* a b 3)) (max 1 2 3 4) (min 1 2 3 4) (mod 7 4 2) (float 1) (truncate 3.333) (ceiling 1.25) (floor 1.25) (round 1.75) (sqrt 2) (exp -1) (sin (/ pi 2)) (cos pi) (tan pi) (log 2.7183) (log10 1000) (++ a) (++ a 2) (-- a (* 2 pi)) (++ a 1 b 1 c 1 d) (= 1 1.0) (!= 1 1.0) (< 1 2 3) (<= 1 1 2 3) (> 3 2 1) (<= 3 3 2 1) (and 1 1 1 1 0) (or 1 1 1 1 0) (xor 3 1) (not 3) (& 7 2) (| 1 2 3 4) (# 3 1) (~ 1) (if (1) 2 3) (if t () t) (if t t ()) (if nil t ()) (if nil nil nil) set sexp echo off (setq t1 \v(ftime)) echo T LOOP START \m(t1)... (setq a 0 b 0 c 0 d 0) for \%i 1 10 1 { (setq x (+ \frandom(\%i) 1)) (setq a (+ a x)) (setq b (+ b (^ x 2))) (setq c (+ c (* x 2))) (setq d (+ d (/ x 2))) } (setq t2 \v(ftime)) echo T LOOP END \m(t2)... show mac a b c d echo TIME = \fsexp(- t2 t1) set sexp echo on (setq a 1.5) (setq b 2.3) (setq i 3) (setq j 4) (+ a b) (= a b) (= a 1.5) (+ a j) (+ j i) (* a b) (- a b) (* 1000 (- a b)) (/ a b) (mod a 1) (^ a b) (/ 10 3) (/ 10.0 3) (exp 1) (exp 2) (\v(math_pi)) (exp \v(math_pi)) (exp pi) (setq a 2) (setq b 3) (setq c (+ a b)) (* (+ a b) (- c a)) (^ b a) echo {----} (- 2) (+ 2) (* 2) (/ 2) (setq \\%a (* (+ a b) (- c a))) echo \%a (setq \\%b (^ \%a 3)) echo \%b (< a b) (> a b) (= a b) (= a 2) set sexp echo off set take echo off echo STARTING STATS \v(ntime)... dcl x = 2.7 3.14 -0.02 12.5 10 9 8 0 -4.2 3.1 10.01 6.666 dcl y = 8.3 4.00 9.413 0.22 11 3 8 9 12.8 7.8 23.99 3.333 (setq xsum 0 ysum 0 xsum2 0 ysum2 0 xysum 0) (setq xmin (setq xmax \&x[1]) ymin (setq ymax \&y[1])) (setq n \fdim(&x)) ; Loop through elements and accumulate sums, maxima, and minima for i 1 n 1 { (setq x \&x[i] y \&y[i]) ; Notational convenience (setq xmax (max xmax x) ymax (max ymax y)) ; X and Y maxima (setq xmin (min xmin x) ymin (min ymin y)) ; X and Y minima (++ xsum x ysum y) ; X and Y sums (++ xsum2 (^ x 2) ysum2 (^ y 2)) ; Sum of X and Y squares (++ xysum (* x y)) ; Sum of XY products } ; Calculate results (setq xmean (/ xsum n)) ; Mean X (setq ymean (/ ysum n)) ; Mean Y (setq xss (- xsum2 (/ (^ xsum 2) n))) ; Intermediate values (setq yss (- ysum2 (/ (^ ysum 2) n))) (setq xyss (- xysum (/ (* xsum ysum) n))) (setq xvar (/ xss n)) ; X variance (setq yvar (/ yss n)) ; Y variance (setq sdx (sqrt xvar)) ; Std deviation in X (setq sdy (sqrt yvar)) ; Std deviation in Y (setq tmp (* xss yss)) (setq cc (if tmp (/ xyss (sqrt tmp)) 1.0)) ; Correlation coefficient echo STATS DONE \v(ntime)... sho mac xmean ymean xvar yvar sdx sdy cc echo Macros... set tak ec on set sexp ec on define abc echo This is \%0 (abc) (abc) define def (* \%*) (def 2 3 4) define ghi (* \%*), return \v(svalue) (ghi 4 5 6) define objective return \fsexp(> \%1 100) define raise Echo Give a raise define demote Echo Take back company car define evaluate (if (objective \%1) raise demote) (setq result 120) (evaluate result) (setq result 90) (evaluate result) echo (.) (..) (. .) (+) (++) (+ +) define FIBONACCI { if < \%1 2 return \%1 return \fsexp(+ (fibonacci (- \%1 2)) (fibonacci (- \%1 1))) } (fibonacci 6) (setq a 2 b 4) (setq x (fibonacci (* a b ))) echo echo Done.