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
(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] |
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
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') |
OlderNewer