Are nested anonymous function legal or not? I wrote the following for the problem #107 of 4clojure:
(fn [n] #(reduce * (repeat n %))) which passed all the 3 tests, however when i try it with the test 3 in repl i get an IllegalStateException saying that nested #()s are not allowed:
IllegalStateException Nested #()s are not allowed clojure.lang.LispReader$FnReader.invoke (LispReader.java:628) CompilerException java.lang.RuntimeException: Unable to resolve symbol: n in this context, compiling:(NO_SOURCE_PATH:1:44) RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:221) RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:221) CompilerException java.lang.RuntimeException: Unable to resolve symbol: % in this context, compiling:(NO_SOURCE_PATH:0:0) RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:221) RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:221) RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:221) RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:221) Why this cant be passed on repl but on 4clojure?