Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
20
Task/Executable-library/PicoLisp/executable-library-1.l
Normal file
20
Task/Executable-library/PicoLisp/executable-library-1.l
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/picolisp /usr/lib/picolisp/lib.l
|
||||
|
||||
(de hailstone (N)
|
||||
(make
|
||||
(until (= 1 (link N))
|
||||
(setq N
|
||||
(if (bit? 1 N)
|
||||
(inc (* N 3))
|
||||
(/ N 2) ) ) ) ) )
|
||||
|
||||
(de hailtest ()
|
||||
(let L (hailstone 27)
|
||||
(test 112 (length L))
|
||||
(test (27 82 41 124) (head 4 L))
|
||||
(test (8 4 2 1) (tail 4 L)) )
|
||||
(let N (maxi '((N) (length (hailstone N))) (range 1 100000))
|
||||
(test 77031 N)
|
||||
(test 351 (length (hailstone N))) )
|
||||
(println 'OK)
|
||||
(bye) )
|
||||
11
Task/Executable-library/PicoLisp/executable-library-2.l
Normal file
11
Task/Executable-library/PicoLisp/executable-library-2.l
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/picolisp /usr/lib/picolisp/lib.l
|
||||
|
||||
(load "hailstone.l")
|
||||
|
||||
(let Len NIL
|
||||
(for N 100000
|
||||
(accu 'Len (length (hailstone N)) 1) )
|
||||
(let M (maxi cdr Len)
|
||||
(prinl "The hailstone length returned most often is " (car M))
|
||||
(prinl "It is returned " (cdr M) " times") ) )
|
||||
(bye)
|
||||
Loading…
Add table
Add a link
Reference in a new issue