Add take-until

Description

Discussion: https://groups.google.com/d/topic/clojure-dev/NaAuBz6SpkY/discussion

It comes up when I would otherwise use (take-while pred coll), but I need to include the first item for which (pred item) is false.

Patch: clj-1451.patch

  • Includes transducer arity of take-until

  • Includes inclusion in transducer generative tests

Environment

None

Activity

Show:
Ghadi Shayban
June 30, 2016, 3:01 AM

I feel like this is superceded by CLJ-1906

Ghadi Shayban
October 28, 2016, 4:56 PM

And this is definitely superseded by `halt-when`

Alex Miller
October 28, 2016, 8:11 PM

It's not lazy but this is one way to write take-until with halt-when:

Steve Miner
October 28, 2016, 9:00 PM

I wanted to suggest: `(sequence (halt-when p conj) s)` but sequence doesn't support stopping short on a reduced value so that won't work.

Alex Miller
October 28, 2016, 9:02 PM

Yeah, halt-when is a little tricky to use in transducible contexts other than transduce.

Assignee

Unassigned

Reporter

Alexander Taggart

Labels

Approval

Triaged

Patch

Code and Test

Priority

Major