Share your thoughts in the 2024 State of Clojure Survey!

Welcome! Please see the About page for a little more info on how this works.

0 votes
in Sequences by

how about this version of some?

 (defn some [pred coll]
  (loop [s (seq coll)]
    (when s
      (or (pred (first s)) (recur (next s))))))

1 Answer

+1 vote
by
selected by
 
Best answer
by
i was not aware of that :-)

i did some performance tests as well, but i find that somewhat tricky, since there are many factors that have to be considered when going from clojure(script) to the bare metal.

i guess my main point is that regardless of the performance, to me at least, the 'logic' of the current version of some is just not right :-).... one could from a logical point of view use rest instead of next... but on newer clojure versions, for some reasons, that did not perform nearly as well as i would have hoped ( ... in my benchmarks at least,... so that does not have to mean very much... :-))

so in any case, i thought this version did fix the 'logical / imperative' problem of some, while also being reasonably clear and easy on the eyes, and so i was kind of hoping i would perhaps be able to make a contribution ( no matter how small ) to clojure itself. :-)

so now seeing, that somebody else has already thought about rewriting some ( in a more sophisticated way than i ever have... :-)) is kind of cool ( i really like the idea! ) but at the same time it is also kind of a bummer :-)

so,  i guess, i just wanted to say that clojure is really great and keep up the good work!
by
@alexmiller .... so i guess i have been thinking about this for two months straight now :-(.... ( ... https://clojureverse.org/t/some-rest-vs-next/4598 .... ).... yet somehow it feels to me like not only have i not been able to make any progress whatsoever in gaining any satisfactory understanding about what the heck is going on with next, rest and some... but ON THE CONTRARY!!!.... the more i am thinking about this stuff..... the less clear of a picture i am ending up with!!!.... so if you could provide some explanation ( ANYTHING!!! ) i would REALLY!!! REALLY!!! appreciate it.... now i realize that it is not your job to spoon-feed people... and that we're all super busy with work etc. .... so if nothing else.... at least tell me if i am missing something obvious... or if the matter is actually as involved and hairy as it is starting to appear to me :-( .... ( ....THIS IS DRIVING ME CRAZY!!! :-(... )
by
edited by
First, please don't let it drive you crazy :-)
Second, one place that you might be able to get some additional feedback and ideas is the #clojure-dev and/or #cljs-dev channels on clojurians.slack.com.
by
edited by
I agree with Andy that having a real-time discussion on Slack may be a lot more productive since right now it sounds like you can't even articulate any specific questions to help remove any confusion?
...