March 2014 update
This commit is contained in:
parent
09687c4926
commit
a25938f123
1846 changed files with 21876 additions and 5203 deletions
|
|
@ -1,8 +1,29 @@
|
|||
;; The -> notation is not part of Lisp, it is used in examples indicate the output of a form.
|
||||
;;
|
||||
;;
|
||||
(comprehend 'list-monad (cons x y) (x '(1 2 3)) (y '(A B C)))
|
||||
|
||||
-> ((1 . A) (1 . B) (1 . C)
|
||||
(2 . A) (2 . B) (2 . C)
|
||||
(3 . A) (3 . B) (3 . C))
|
||||
(system::expand-form
|
||||
'(loop for count from 1
|
||||
for x in '(1 2 3 4 5)
|
||||
summing x into sum
|
||||
summing (* x x) into sum-of-squares
|
||||
finally
|
||||
(return
|
||||
(let* ((mean (/ sum count))
|
||||
(spl-var (- (* count sum-of-squares) (* sum sum)))
|
||||
(spl-dev (sqrt (/ spl-var (1- count)))))
|
||||
(values mean spl-var spl-dev))))))
|
||||
(BLOCK NIL
|
||||
(LET ((COUNT 1))
|
||||
(LET ((#:LIST-3230 '(1 2 3 4 5)))
|
||||
(LET ((X NIL))
|
||||
(LET ((SUM-OF-SQUARES 0) (SUM 0))
|
||||
(TAGBODY SYSTEM::BEGIN-LOOP
|
||||
(WHEN (ENDP #:LIST-3230) (GO SYSTEM::END-LOOP))
|
||||
(SETQ X (CAR #:LIST-3230))
|
||||
(PROGN (SETQ SUM (+ SUM X))
|
||||
(SETQ SUM-OF-SQUARES (+ SUM-OF-SQUARES (* X X))))
|
||||
(PSETQ COUNT (+ COUNT 1)) (PSETQ #:LIST-3230 (CDR #:LIST-3230))
|
||||
(GO SYSTEM::BEGIN-LOOP) SYSTEM::END-LOOP
|
||||
(RETURN-FROM NIL
|
||||
(LET*
|
||||
((MEAN (/ SUM COUNT))
|
||||
(SPL-VAR (- (* COUNT SUM-OF-SQUARES) (* SUM SUM)))
|
||||
(SPL-DEV (SQRT (/ SPL-VAR (1- COUNT)))))
|
||||
(VALUES MEAN SPL-VAR SPL-DEV)))))))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue