adds list +join gate to stdlib

This commit is contained in:
Joe Bryan 2019-06-24 13:35:50 -07:00
parent 8356ce737f
commit 5758bad98a

View File

@ -555,6 +555,17 @@
|@ ++ $ ?:(*? ~ [i=(snag 0 a) t=$])
--
a
:: +join: construct a new list, placing .sep between every pair in .lit
::
++ join
|* [sep=* lit=(list)]
=. sep `_?>(?=(^ lit) i.lit)`sep
?~ lit ~
=| out=(list _?>(?=(^ lit) i.lit))
|- ^+ out
?~ t.lit
(flop [i.lit out])
$(out [sep i.lit out], lit t.lit)
::
:: +bake: convert wet gate to dry gate by specifying argument mold
::