blob: 1012223e24b6928f95dc276a388eb7d50097cbfe (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# TODO: Too slow to be published. Probably needs Maps/Sets/Vectors/sth.
:import std/Combinator .
:import std/Char C
:import std/Math .
:import std/List .
# very slow but elegant
de-bruijn y [[[C.?infix? (take 0 1) ~1 case-end case-rec]]]
case-rec max-by (compare ⋔ length) ([3 (0 : 2) 1] <$> (C.?nub 1))
case-end drop 0 1
:test (de-bruijn "abcd" (+2)) ("dccaadbbacbdabcd")
main [[0]]
|