Commits

Taegyoon Kim committed d649718 Merge

merged

  • Participants
  • Parent commits 894cd07, 2ac6038

Comments (0)

Files changed (3)

File ex/euler10.lpp

-(include "iostream" "vector")
+(include "vector")
 
 (defn std::vector<int> primesUnder (int limit)
   (decl std::vector<bool> |p(limit)|)
     primes (primesUnder 2000000))
   (foreach p primes
     (+= sum p))
-  (<< std::cout sum std::endl))
+  (prn sum))

File ex/euler2.lpp

-(include "stdio.h")
-(defn int main ()
+(main
   (def a 1 b 1 s 0)
   (while 1
     (def c (+ a b))
-    (if (> c 4000000) break)
+    (if (> c 4000000) (break))
     (if (== (% c 2) 0) (+= s c))
     (= a b)
     (= b c))
-  (printf "%d\n" s))
+  (prn s))

File ex/euler3.lpp

-(include "stdio.h")
-(defn int main ()
+(main
   (def num 600851475143 p 2)
   (while true
     (while (== 0 (% num p))
       (/= num p))
     (when (<= num 1)
-      (printf "%d\n" p)
+      (prn p)
       (break))
     (++ p)))