Advertisement
Guest User

weird repl behavoir

a guest
May 18th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (def prime?
  2.   (fn [x]
  3.     (loop [y 2]
  4.       (if (< y x)
  5.           (if (== (mod x y) 0)
  6.               false
  7.               (recur (inc y)))
  8.           true))))
  9.  
  10. (def primes  
  11.   (fn [max]
  12.     (take-while (fn [x] (< x max))
  13.                 (filter prime? (iterate inc 0)))))
  14.  
  15.  
  16.  
  17. When I try and paste (primes) as is, it cut off at the middle of take while, but if I paste it as one line it properly reads it as a whole block of code
  18.  
  19. Pasting with newlines:
  20. user=>
  21. (def primes
  22.   (fn [max]
  23.     (take-while (fn [x] (< x max))
  24. user=>                 (filter prime? (itereate inc 0)))))
  25. CompilerException java.lang.RuntimeException: Unable to resolve symbol: itereate in this context, compiling:(NO_SOURCE_PATH:64:32)
  26.  
  27. Pasting without newlines:
  28. user=> (def primes  (fn [max] (take-while (fn [x] (< x max))(filter prime? (iterate inc 0)))))
  29. #'user/primes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement