I need to run 3 separate filters on the same collection.
Can I do this in a single pass thru collection (as opposed to 3
separate passes)?
Basically I don't want to bind the head of 'idata' collection because
it holds the whole thing in memory. Also collection itself is coming
from a file.
Here is what I have right now:
(let [idata ... something ...
sales
(filter
#($ (% "Product Type Identifier") = "1" &&
% "Vendor Identifier" = "01010012"
)
idata
)
upgrades
(filter
#($ % "Product Type Identifier" = "7" &&
% "Vendor Identifier" = "01010012"
)
idata
)
demo
(filter
#($ % "Product Type Identifier" = "1" &&
% "Vendor Identifier" = "01010318"
)
idata
)
]
(println "Sales : " (sum-units sales))
(println "Upgrades: " (sum-units upgrades))
(println "Demo : " (sum-units demo))
I can of cause write my own custom filter fn that would return 3
collections, but I'm wondering if there is a generic way to do it.
- Dmitry
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---