Commits

Taegyoon Kim committed 2ac6038

improved

  • Participants
  • Parent commits 81340df

Comments (0)

Files changed (2)

File ex/euler10.lpp

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

File ex/euler7.lpp

-(include "cstdio")
-
 (defn "bool" isPrime ("int n")
   (for (def i 2) (<= (* i i) n) (++ i)
     (if (== 0 (% n i)) (return false)))
   (return true))
   
-(defn "int" main ()
+(main
   (def count 0 i 2)
   (while true
     (when (isPrime i)
       (++ count)
       (when (== count 10001)
-        (std::printf "%d\n" i)
+        (prn i)
         (break)))
     (++ i)))