on cf70879 help sign in
48 lines 955 B history raw
1### `++deft`
3Import URL path
5Parse the extension the from last element of url, which is delimited
6either by a `.` or a `/`.
8Accepts
9-------
11`rax` is a [`++list`]() of [`@t`]().
13Produces
14--------
16A [`++pork`]().
18Source
19------
21 ++ deft :: import url path
22 |= rax=(list ,@t)
23 |- ^- pork
24 ?~ rax
25 [~ ~]
26 ?~ t.rax
27 =+ den=(trip i.rax)
28 =+ ^= vex
29 %- %- full
30 ;~(plug sym ;~(pose (stag ~ ;~(pfix dot sym)) (easy ~)))
31 [[1 1] (trip i.rax)]
32 ?~ q.vex
33 [~ [i.rax ~]]
34 [+.p.u.q.vex [-.p.u.q.vex ~]]
35 =+ pok=$(rax t.rax)
36 :- p.pok
37 [i.rax q.pok]
38 ::
40Examples
41--------
43 ~zod/try=> (deft /foo/bar/'baz.txt')
44 [p=[~ ~.txt] q=<|foo bar baz|>]
45 ~zod/try=> (deft /foo/bar/baz)
46 [p=~ q=<|foo bar baz|>]