Created
May 19, 2010 14:43
-
-
Save tgk/406368 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(todo | |
"I'm not sure this function looks as nice as it could" | |
(defn converging-seq | |
"Generates a sequence with terminates when two succent elements | |
from coll are identical. | |
(converged-seq [1 2 3 4 4 5 6]) => [1 2 3 4]" | |
[coll] | |
(cons | |
(first coll) | |
(map second | |
(take-while (fn [[prev curr]] (not (= prev curr))) | |
(partition 2 1 coll))))) | |
) | |
(todo-report) | |
" | |
Item 1. | |
I'm not sure this function looks as nice as it could | |
Item 2. | |
Why is this a loop? | |
" | |
(todo-report 1) | |
" | |
I'm not sure this function looks as nice as it could | |
(defn converging-seq | |
"Generates a sequence with terminates when two succent elements | |
from coll are identical. | |
(converged-seq [1 2 3 4 4 5 6]) => [1 2 3 4]" | |
[coll] | |
(cons | |
(first coll) | |
(map second | |
(take-while (fn [[prev curr]] (not (= prev curr))) | |
(partition 2 1 coll))))) | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment