on 492ae2f help sign in
38 lines 585 B history raw
1### `++scag`
3Prefix
5Accepts an atom `a` and [list]() `b`, producing the first `a` elements of
6the front of the list.
8Accepts
9-------
11`b` is a list.
13Produces
14--------
16A list of the same type as `b`.
18Source
19------
21 ++ scag :: prefix
22 ~/ %scag
23 |* [a=@ b=(list)]
24 |- ^+ b
25 ?: |(?=(~ b) =(0 a)) ~
26 [i.b $(b t.b, a (dec a))]
28Examples
29--------
31 ~zod/try=> (scag 2 (limo [0 1 2 3 ~]))
32 [i=0 t=[i=1 t=~]]
33 ~zod/try=> (scag 10 (limo [1 2 3 4 ~]))
34 [i=1 t=[i=2 t=[i=3 t=[i=4 t=~]]]]
38***