Ad
  • Custom User Avatar
  • 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

    This is not best practices. This makes an entire copy of the ISeq.

    Whoever is voting this stuff "Best Practices", it would be nice to see some explanation...