Created
April 17, 2012 17:13
-
-
Save rplevy/2407570 to your computer and use it in GitHub Desktop.
trystero furcula use case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns example | |
(:require [clojure-csv.core :as csv] | |
[swiss-arrows.core :refer [-<<]])) | |
(let [[headers rows] | |
((juxt (partial take 4) | |
(partial drop 4)) | |
(csv/parse-csv (slurp csv-file))))] | |
,,,) | |
;; versus | |
(let [[headers rows] | |
(-<< (csv/parse-csv (slurp csv-file)) | |
(take 4) | |
(drop 4))] | |
,,,) | |
;; the above is a bit artificial because split-at exists in core, but the point is about the more general case of reducing awkward juxts | |
;; and meaningless temporary lexical bindings | |
;; another example | |
(let [[foo bar] (-<>< [[1 2] [3 4] [5 6] [7 8] [9 10]] | |
(->> <> (take 2) flatten) | |
(drop 2 <>))] | |
[foo bar]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment