Skip to content
lisp language, compute everything, change nothing
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
.travis.yml
LICENSE
README.md
bigchin.jpg
daft_wullie_and_horace_by_andrewsalt.jpg
pom.xml

README.md

bigchin Build Status Maven Central

terry

A lisp that keeps everything constant but detects everything.

(!let (isPrime isPrima divisible )
   (!set divisible (!lbd (x y) (== (remainder x y) 0)))
   (!set isPrima (!lbd (x y) 
         (!if (== x y)
              @t 
              (!if (divisible x y)
                    @f
                    (isPrima x (+ y 1))))))
   (!set isPrime (!lbd (x) (isPrima x 2)))
   (isPrime 1485863))
   
-> @f

No memory or number limitation. Number is natural number, no limit.

Standard basic objects: null, bool, number, list, stream

Print 50 prims. (stack overflow with more)

 (!let (isPrime isPrima divisible )
       (!set divisible (!lbd (x y) (== (remainder x y) 0)))
       (!set isPrima (!lbd (x y) 
             (!if (== x y)
                  @t 
                  (!if (divisible x y)
                        @f
                        (isPrima x (+ y 1))))))
       (!set isPrime (!lbd (x) (isPrima x 2)))
       (!flow (!lbd (x) (+ x 2))
               (:filter (!lbd (x) (isPrime x)))
               (:while (!lbd (x idx) (> 50 idx )))))
               
 ->  (2 3 5 7 ... 197 199 211 223 227)             

1000 primes by using the before found prime (Eratosthenes)

(!let (divisible firstdev)
     (!set divisible (!lbd (x y) (== (remainder x y) 0)))
     (!set firstdev (!lbd (z st) 
                    (!flow st
                           (:filter (!lbd (x) (divisible z x)))
                           (:find (!lbd (x) @t)))))
     (!flow (!lbd (x) (+ x 2))
            (:filter (!lbd (x idx bef) (== () (firstdev x bef))))
            (:while (!lbd (x idx) (> 1000 idx )))))
            
 -> (2 3 5 7 11 13 1 ... 7867 7873 7877 7879 7883 7901 7907)           

the 10000s prime, faster because only testing upto root

(!let (divisible firstdev)
     (!set divisible (!lbd (x y) (== (remainder x y) 0)))
     (!set firstdev (!lbd (z st) 
                    (!flow st
                           (:while (!lbd (x) (<= (* x x) z)))                   
                           (:filter (!lbd (x) (divisible z x)))
                           (:find (!lbd (x) @t)))))
     (!flow (!lbd (x) (+ x 2))
            (:filter (!lbd (x idx bef) (== () (firstdev x bef))))
            (:find (!lbd (x idx) (== idx 10000)))                 

 -> (104729)  

300 prime pairs

 (!let (divisible firstdev)
       (!set divisible (!lbd (x y) (== (remainder x y) 0)))
       (!set firstdev (!lbd (z st) (!flow st
                                          (:while (!lbd (x) (<= (* x x) z)))
                                          (:filter (!lbd (x) (divisible z x)))
                                          (:find (!lbd (x) @t)))))
       (!flow (!lbd (x) (+ x 2))
              (:filter (!lbd (x idx bef) (== () (firstdev x bef))))
              (:map (!lbd (x idx bef) (!if (== idx 0) (list 42 x) (list (rget (rget bef 0) 0) x))))
              (:filter (!lbd (x) (== (- (rget x 0) (rget x 1)) 2)))
              (:while (!lbd (_ idx) (< idx 300)))))
              
  ->  ((3 5) (5 7) (11 13) (17 19) (29 31)  ... (17027 17029) (17189 17191) (17207 17209))    

twin prime with extra frozen flow: ray

  (!let (divisible firstdev prime twinprime) 
         (!set divisible (!lbd (x y) (== (remainder x y) 0)))
         (!set firstdev (!lbd (z st) (!flow st
                                            (:while (!lbd (x) (<= (* x x) z)))     # try only while numbers are under root # 
                                            (:filter (!lbd (x) (divisible z x)))
                                            (:find (!lbd (x) @t)))))
         (!set prime
               (!ray (!lbd (x) (+ x 2))
                     (:filter (!lbd (x idx bef) (== () (firstdev x bef))))))
         (!set twinprime 
               (!ray prime
                     (:map (!lbd (x idx bef) (!if (== idx 0) (list 42 x) (list (rget (rget bef 0) 0) x))))
                     (:filter (!lbd (x) (== (- (rget x 0) (rget x 1)) 2)))))
         (twinprime 100))
         
   -> (3851 3853)      

the same without if but pattern check

    (!let (divisible firstdev prime twinprime lastOfLast) 
            (!set divisible (!lbd (x y) (== (remainder x y) 0)))
            (!set firstdev (!lbd (z st) (!flow st
                                               (:while (!lbd (x) (<= (* x x) z)))     # try only while numbers are under root # 
                                               (:filter (!lbd (x) (divisible z x)))
                                               (:find (!lbd (x) @t)))))
            (!set prime
                  (!ray (!lbd (x) (+ x 2))
                        (:filter (!lbd (x idx bef) (== () (firstdev x bef))))))
            (!set twinprime 
                  (!ray prime
                        (:map (!lbd (x _ bef) (list (!when bef (:one () 42) 
                                                               (:one (... (_ end)) end)) 
                                                     x))) 
                        (:filter (!lbd (x) (!when x (:one (... last2 last) (== (- last last2) 2))))))) 
            (twinprime 100))

why

Can control everything of the language, implement it tiny. Total freedom.

  • Syntax read: simple

  • Interpretation: simple

  • Extendable: simple

Base Design:

  • Absolute fix, no assignment, just definition

  • no limits for numbers, strings, lists, streams

You can’t perform that action at this time.