Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,19 @@
;;Tested using CLISP
(defun VanEck (x) (reverse (VanEckh x 0 0 '(0))))
(defun VanEckh (final index curr lst)
(if (eq index final)
lst
(VanEckh final (+ index 1) (howfar curr lst) (cons curr lst))))
(defun howfar (x lst) (howfarh x lst 0))
(defun howfarh (x lst runningtotal)
(cond
((null lst) 0)
((eq x (car lst)) (+ runningtotal 1))
(t (howfarh x (cdr lst) (+ runningtotal 1)))))
(format t "The first 10 elements are ~a~%" (VanEck 9))
(format t "The 990-1000th elements are ~a~%" (nthcdr 990 (VanEck 999)))

View file

@ -0,0 +1,8 @@
(defun van-eck-nm-sequence (n m)
(loop with ac repeat m
for i = (position (car ac) (cdr ac)) do
(push (if i (1+ i) 0) ac)
finally (return (nthcdr (1- n) (nreverse ac)))))
(format t "The first 10 elements are: ~{~a ~}~%" (van-eck-nm-sequence 1 10))
(format t "The 991-1000th elements are: ~{~a ~}" (van-eck-nm-sequence 991 1000))