Skip to content

Instantly share code, notes, and snippets.

@unthingable
unthingable / euclidean.clj
Last active March 22, 2016 19:17
Euclidean Rhythm generator in Clojure
(defn split-seq [s]
"Extract a tail of all same elements: [1 1 0 0 0] -> [[1 1] [0 0 0]]"
(let [l (last s)]
(split-with #(not= l %) s)))
(defn recombine
"Distribute tail: [[1] [1] [1] [0] [0]] -> [[1 0] [1 0] [1]]"
([a b] [a b])
([a b c] [a b c])
([a b c & more]
from abc import abstractmethod
from itertools import chain, imap
from typing import Any, Iterable
from typing import Callable, Generic, List
from typing import TypeVar
A = TypeVar('A')
B = TypeVar('B')
C = TypeVar('C')