Fork me on GitHub

@codonnell @thomasdeutsch that bug you guys ran into yesterday is now fixed in master


also deployed 0.12.0-SNAPSHOT to clojars if you want to use it


@nathanmarz I'm curious why select* really needs each navigator to return one of its navigated values as the return value. If you really want select-any, you could traverse with the final continuation being to deliver to a promise (where only the first value matters).


it's the most efficient way


don't need to create any anonymous function, don't need to write anywhere


an anonymous function that closes over local environment requires object creation and field setting


for cases like (select-any [:a :b :c] {:a {:b {:c 1}}}) these things make a noticeable difference

Chris O’Donnell19:06:34

@nathanmarz: (reduce afn init (traverse apath structure)) should always return the same thing as (reduce afn init (select apath structure)), right? But it is more memory efficient because it only store the reduction value, rather than instantiating the entire seq?


@codonnell: that's exactly right


not just memory efficient but also faster


also useful if you want something like a set of results back, e.g. (into #{} (traverse ...))

Chris O’Donnell20:06:32

Is collected? the same as pred, but it takes the collected values as input rather than the structure?

Chris O’Donnell20:06:55

alright, these new operations should be pretty easy to write up

Chris O’Donnell21:06:06

I pushed the 0.12.0 macros and navigators up to Pretty sure they are accurate.

Chris O’Donnell21:06:57

perhaps jumping the gun, but it's there on my wiki if needed


added another traverse example and merged in


how would I implement REST? i.e. (select-one REST [1 2 3]) => [2 3]?


I can use srange but then I need to know the length of the collection in the selector


I was trying to figure out how to do it by looking at ALL and FIRST but the code looks so optimized that I can't really figure out how to write it

Chris O’Donnell23:06:20

@luxbock: you should be able to do it with defnav (see for a similar example)

Chris O’Donnell23:06:40

I'm not sure if there's a better way to do it

Chris O’Donnell23:06:08

@luxbock: (select (transformed STAY rest) (range 10))

Chris O’Donnell23:06:25

no, (select (view rest) (range 10))

Chris O’Donnell23:06:40

pretty sure (view rest) is optimal