Hacker News new | past | comments | ask | show | jobs | submit login

There isn't any problem with this Clojure macro. If you would like to see problems with Clojure, take a look at keep function in core.clj.

There is a classic function:

  (define (filter fn l)
      (cond ((null? l) '())
	  ((fn (car l)) (cons (car l) (filter fn (cdr l))))
	  (else (filter fn (cdr l)))))
The point is that stuffing more data-structures into a lisp ruins it. Somehow switching to the prefix notation and adding parenthesis doesn't transform Java to Lisp.

For the second piece of code - are't semicolons and comas somehow redundant?

Moreover, what is the point of writing something this way?




Not sure what the objection to the keep function is, other than maybe the performance optimisations that chunked sequences allow. Taking away the chunked consideration gives something like:

    (let [x (f (first s))]
      (if (nil? x)
        (keep f (rest s))
        (cons x (keep f (rest s)))))
Which looks almost identical (with differences, as you seem to be giving filter rather than keep, which are different functions). The library function COULD be defined like this, it just wouldn't be as fast.


Taking away the chunked consideration...


>The point is that stuffing more data-structures into a lisp ruins it.

Could you please support this assertion?




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: