Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,30 @@
|
|||
(defmacro mfor (:form f (var . range-triplets) . forms)
|
||||
(with-gensyms (body toval stepval test)
|
||||
^(let (,var)
|
||||
(flet ((,body () ,*forms))
|
||||
,*(append-each ((rt (tuples 3 range-triplets)))
|
||||
(mac-param-bind f (from to step) rt
|
||||
^((set ,var ,from)
|
||||
(for* ((,toval ,to)
|
||||
(,stepval ,step)
|
||||
(,test (if (<= ,var ,toval)
|
||||
(fun <=) (fun >=))))
|
||||
([,test ,var ,toval])
|
||||
((inc ,var ,stepval))
|
||||
(,body)))))))))
|
||||
|
||||
(let ((prod 1) (sum 0)
|
||||
(x 5) (y -5) (z -2)
|
||||
(one 1) (three 3) (seven 7))
|
||||
(mfor (j (- three) (expt 3 3) three
|
||||
(- seven) seven x
|
||||
555 (- 550 y) 1
|
||||
22 -28 (- three)
|
||||
1927 1939 1
|
||||
x y z
|
||||
(expt 11 x) (succ (expt 11 x)) 1)
|
||||
(upd sum (+ (abs j)))
|
||||
(if (and (< (abs prod) (ash 1 27))
|
||||
(nzerop j))
|
||||
(upd prod (* j))))
|
||||
(put-line `sum = @sum; prod = @prod`))
|
||||
Loading…
Add table
Add a link
Reference in a new issue