Ad
  • Custom User Avatar

    Fair enough. I suppose decades of review have made the Haskell source a bit cleaner.

    It always makes me a bit disappointed to review the definition of the for macro in the Clojure source :(

  • Custom User Avatar

    AFAIK not nessecarily.
    The way the clojure language bootstraps itself causes some core functions to be written in a weird reduced subset of the langauage.
    Also a lot of the core functions are optimized in nonintuitive ways which might not be idiomatic either.

    Besides idiomaticity, I don't think that reimplementing core functions is an easy (8 or 7 Kyu) task in clojure. Some of the design choises of clojure are weird to newcommers (see this super long discussion about the time complexity of last https://groups.google.com/forum/#!topic/clojure/apkNXk08Xes), and the devil is often in the detail when it comes to interactions between high level abstractions (seq) and lowlevel constructs (vectors and maps).

  • Custom User Avatar

    I don't know, I ported this from Haskell, where the "best practices" generally looks identical to the code in Prelude.hs.

    Wouldn't the best practices for clojure be to write something like the original clojure.core/last source code?

  • Custom User Avatar

    Yeah but reimplementing core functionality can't be idiomatic by definiton. Because using the buildin would be the idiomatic way.

  • Custom User Avatar

    Thats what I am returning, I'm returning its @next field. I've tried it both with that and a new EmptyList just to be sure.

    Nevermind, that was the issue. My problem wasn't with the ListNode code, but with the EmptyList push function.

  • Custom User Avatar

    I understand what the error message means, but mine won't pass that one either. I am returning an empty list in that case, I've tested it with my own test cases successfully. I KNOW I am returning an EmptyList and that it returns true for isEmpty(), but still no dice. Anyone else have this issue?