## Tuesday, February 6, 2018

• January 8th, 2018: from Nicoλas‏ @BeRewt

> foo 3 [1..5]
[([1,2,3], 4), ([2,3,4], 5)]

> foo 2 [1..4]
[([1,2], 3), ([2,3], 4)]

> foo 2 [1..20]
[([1,2],3), ([2,3],4), ..., ([18,19],20)]

> foo 20 [1..2]
[]
• Demiurge With a Teletype @mrkgrnao
foo n
= tails
# filter (length # (> n))
# map (splitAt n # second head)

(#) = flip (.)
• Andreas Källberg @Anka213
I haven't tested it, but this should work:
foo n xs = [ (hd,x) | (hd , x:_) <- n="" splitat=""> tails xs ]
• <- n="" splitat="">Nicoλas @BeRewt foo n = zip <\$> fmap (take n) . tails <*> drop n
• January 5th, 2018: You have the following DAG-paths:

a -> b -> c -> e
a -> b -> d -> e
q -> r -> s
w -> x
y -> z

and many more.

From a path, provide a bi-directional encoding* given maximum graph depth is, say, 7, max number of roots is, say, 10, and max number of nodes is, say, 1000.
• *bi-directional encoding of a graph path:

DAG path -> enc is unique for an unique DAG path
enc -> DAG path yields the same DAG path that created the unique enc.

*DAG: "Directed, acyclic graph."
• January 5th, 2018: given s :: Ord k => a -> (k,[v])

define f using s

f :: Ord k => [a] -> Map k [v]

with no duplicate k in [a]
• Christian Bay @the_greenbourne f = foldr (\e acc -> uncurry M.insert (s e) acc) M.empty
• me: you can curry away the acc variable easily
• Christian Bay @the_greenbourne You're right :)
f = foldr (uncurry M.insert . s) M.empty
• Bazzargh @bazzargh fromList.(map s) ?
• me: Yuppers