6Contains converters of [`++json`]() to [`++unit`]()s of well-typed structures.
11A `fist` is a gate that produces a `grub`.
13A `grub` is a unit of some JSON value.
18 ++ jo :: json reparser
19 => |% ++ grub (unit ,*)
28Reparser modifier. Reparses an array to the [`++unit`]() of a homogenous
29[`++list`]() using `wit` to reparse every element.
31`wit` is a [`++fist`](), a JSON reparser.
46 ++ ar :: array as list
53 [i=(wit i.p.jon) t=$(p.jon t.p.jon)]
59 ~zod/try=> :type; ((ar ni):jo a/~[n/'1' n/'2'])
68Reparser generator. Reparses an array as a fixed-length tuple of
69[`++unit`]()s, using a list of `++fist`s.
74`wil` is a [`++pole`](), a [`face`]()less list of [`++fist`]()s.
84 ++ at :: array as tuple
88 =+ raw=((at-raw wil) p.jon)
89 ?.((za raw) ~ (some (zp raw)))
95 ~zod/try=> ((at ni so ni ~):jo a/~[n/'3' s/'to' n/'4'])
97 ~zod/try=> :type; ((at ni so ni ~):jo a/~[n/'3' s/'to' n/'4'])
99 {{[%~ u=[q=@ @ta q=@]] %~} %~}
100 ~zod/try=> ((at ni so ni ~):jo a/~[n/'3' s/'to' n/''])
105Reparse array to tuple
107Reparser generator. Reparses a list of [`++json`]() with `wil` to a tuple of [`++unit`]()s.
112`wil` is a [`++pole`](), a [face]()less list of [`++fist`]()s.
122 ++ at-raw :: array as tuple
126 :- ?~(jol ~ (-.wil i.jol))
127 ((at-raw +.wil) ?~(jol ~ t.jol))
133 ~zod/try=> ((at-raw ni ni bo ~):jo ~[s/'hi' n/'1' b/&])
134 [~ [~ 1] [~ u=%.y] ~]
140Reparser modifier. Reparses a boolean to the [`++unit`]() of a
157 |=(jon=json ?.(?=([%b *] jon) ~ [~ u=p.jon]))
163 ~zod/try=> (bo:jo [%b &])
165 ~zod/try=> (bo:jo [%b |])
167 ~zod/try=> (bo:jo [%s 'hi'])
174Reparser modifier. Reparses the inverse of a boolean to the [`++unit`]()
192 |=(jon=json ?.(?=([%b *] jon) ~ [~ u=!p.jon]))
198 ~zod/try=> (bu:jo [%b &])
200 ~zod/try=> (bu:jo [%b |])
202 ~zod/try=> (bu:jo [%s 'hi'])
209Reparser modifier. Reparses `jon` and slams the result through `wit`,
210producing a [`++unit`]().
215`wit` is a [`++fist`]().
217`poq` is a [`gate`]() that accepts and returns a [noun]().
228 |* [poq=$+(* *) wit=fist]
236 ~zod/try=> ((cu dec ni):jo [%n '20'])
238 ~zod/try=> ((cu dec ni):jo [%b &])
245Reparser modifier. Reparses a UTC date string to a [`++unit`]().
250`jon` is a [`++json`]().
263 (bind (stud (trip p.jon)) |=(a=date (year a)))
269 ~zod/try=> (da:jo [%s 'Wed, 29 Oct 2014 0:26:15 +0000'])
270 [~ ~2014.10.29..00.26.15]
271 ~zod/try=> (da:jo [%s 'Wed, 29 Oct 2012 0:26:15'])
272 [~ ~2012.10.29..00.26.15]
273 ~zod/try=> (da:jo [%n '20'])
278Reparse millisecond date
280Reparser modifier. Reparses the javascript millisecond date integer to a
286`jon` is a [`++json`]().
296 ++ di :: millisecond date
300 (add ~1970.1.1 (div (mul ~s1 a) 1.000))
306 ~zod/try=> (di:jo [%s '2014-10-29'])
308 ~zod/try=> (di:jo [%n '1414545548325'])
309 [~ ~2014.10.29..01.19.08..5333.3333.3333.3333]
310 ~zod/try=> (di:jo [%n '1414545615128'])
311 [~ ~2014.10.29..01.20.15..20c4.9ba5.e353.f7ce]
312 ~zod/try=> (di:jo [%n '25000'])
313 [~ ~1970.1.1..00.00.25]
319Reparser modifier. Reparses `wit` to a [`++unit`]().
321JSON units are considered to be either JSON null or the requested
322value, and are reparsed to results of \~ or (some {value}) respectively.
327`wit` is a [`++fist`]().
340 ?~(jon (some ~) (bind (wit jon) some))
346 ~zod/try=> ((mu ni):jo [%n '20'])
348 ~zod/try=> ((mu ni):jo [%n '15'])
350 ~zod/try=> ((mu ni):jo ~)
352 ~zod/try=> ((mu ni):jo [%s 'ma'])
357Reparse number as real
359XX Currently unimplemented
361A- yup, this will eventually reparse a floating point atom, but
362interfaces for the latter are not currently stable.
366Reparse number as integer
368Reparser modifier. Reparses an integer representation to a [`++unit]().
373`jon` is a ++[`++json`]().
378The `++unit` of an atom.
383 ++ ni :: number as integer
392 ~zod/try=> (ni:jo [%n '0'])
394 ~zod/try=> (ni:jo [%n '200'])
396 ~zod/try=> (ni:jo [%n '-2.5'])
398 ~zod/try=> (ni:jo [%s '10'])
400 ~zod/try=> (ni:jo [%b |])
402 ~zod/try=> (ni:jo [%n '4'])
404 ~zod/try=> (ni:jo [%a ~[b/& b/& b/& b/&]])
409Reparse number as text
411Reparser modifier. Reparses a numeric representation to a [++cord]().
421The [`++unit`]() of a `++cord`.
426 ++ no :: number as text
435 ~zod/try=> (no:jo [%n '0'])
437 ~zod/try=> (no:jo [%n '200'])
439 ~zod/try=> (no:jo [%n '-2.5'])
441 ~zod/try=> (no:jo [%s '10'])
443 ~zod/try=> (no:jo [%b |])
445 ~zod/try=> (no:jo [%n '4'])
447 ~zod/try=> (no:jo [%a ~[b/& b/& b/& b/&]])
452Reparse object to frond
454Reparser generator. Reparses an object, succeeding if it corresponds to
455one of the key-value pairs in `wer`.
460`wer` is a [`++pole`](), a [`++face`]()less list of [`++cord`]() and
461[`++fist`]() key-value pairs.
466The [`++unit`]() of a cell of a.....
471 ++ of :: object as frond
472 |* wer=(pole ,[cord fist])
474 ?. ?=([%o [@ *] ~ ~] jon) ~
477 ?: =(-.-.wer p.n.p.jon)
478 ((pe -.-.wer +.-.wer) q.n.p.jon)
485 ~zod/try=> ((of sem/sa som/ni ~):jo %o [%sem s/'hi'] ~ ~)
487 ~zod/try=> ((of sem/sa som/ni ~):jo %o [%som n/'20'] ~ ~)
489 ~zod/try=> ((of sem/sa som/ni ~):jo %o [%som s/'he'] ~ ~)
491 ~zod/try=> ((of sem/sa som/ni ~):jo %o [%som s/'5'] ~ ~)
493 ~zod/try=> ((of sem/sa som/ni ~):jo %o [%sem s/'5'] ~ ~)
495 ~zod/try=> ((of sem/sa som/ni ~):jo %o [%sem n/'2'] ~ ~)
497 ~zod/try=> ((of sem/sa som/ni ~):jo %o [%sem b/&] ~ ~)
499 ~zod/try=> ((of sem/sa som/ni ~):jo %a ~[s/'som' n/'4'])
501 ~zod/try=> ((of sem/sa som/ni ~):jo %o [%sem s/'hey'] ~ [%sam s/'other value'] ~ ~)
506Reparse object as tuple
508Reparser generator. For every key in `wer` that matches a key in the
509[`++edge`], the fist in `wer` is applied to the corresponding value in
510the [`++edge`](), the results of which are produced in a tuple.
516`wer` is a [`++pole`]() of [`++cord`]() to [`++fist`]() key-value pairs.
521A [`++unit`]() of a tuple XX?
526 ++ ot :: object as tuple
527 |* wer=(pole ,[cord fist])
530 =+ raw=((ot-raw wer) p.jon)
531 ?.((za raw) ~ (some (zp raw)))
537 ~zod/try=> (jobe [%sem s/'ha'] [%som n/'20'] ~)
538 [%o p={[p='sem' q=[%s p=~.ha]] [p='som' q=[%n p=~.20]]}]
539 ~zod/try=> ((ot sem/sa som/ni sem/sa ~):jo (jobe [%sem s/'ha'] [%som n/'20'] ~))
540 [~ u=["ha" q=20 "ha"]]
544Reparser generator. Reparses a map `jom` using `wer`; for every key in
545`wer` that matches a key in `map`, the corresponding `++fist` is applied
546to the corresponding value in `jom`, the results of which are produced
553`wer` is a [`++pole`]() of [`++cord`]() to [`++fist`]() key-value pairs.
563 ++ ot-raw :: object as tuple
564 |* wer=(pole ,[cord fist])
565 |= jom=(map ,@t json)
567 =+ ten=(~(get by jom) -.-.wer)
568 [?~(ten ~ (+.-.wer u.ten)) ((ot-raw +.wer) jom)]
574 ~zod/try=> ((ot-raw sem/sa som/ni sem/sa ~):jo (mo [%sem s/'ha'] [%som n/'20'] ~))
575 [[~ u="ha"] [~ q=20] [~ u="ha"] ~]
576 ~zod/try=> ((ot-raw sem/sa som/ni sem/sa ~):jo (mo [%sem s/'ha'] [%som b/|] ~))
577 [[~ u="ha"] ~ [~ u="ha"] ~]
583Reparser modifier. Reparses a [`++json`]() object to a homogenous map
589`wit` is a [`++fist`]().
599 ++ om :: object as map
603 (zm ~(run by p.jon) wit)
609 ~zod/try=> ((om ni):jo (jobe [%sap n/'20'] [%sup n/'5'] [%sop n/'177'] ~))
610 [~ {[p='sup' q=q=5] [p='sop' q=q=177] [p='sap' q=q=20]}]
611 ~zod/try=> ((om ni):jo (jobe [%sap n/'20'] [%sup n/'0x5'] [%sop n/'177'] ~))
618Reparser modifier. Adds a static prefix `pre` to the parse result of
619`wit`. See also: [`++stag`]().
624`pre` is a prefix [`noun`]().
629The [`++unit`]() of a cell of [noun]() and the result of parsing `wit`.
636 (cu |*(a=* [pre a]) wit)
642 ~zod/try=> (ni:jo n/'2')
644 ~zod/try=> (ni:jo b/|)
646 ~zod/try=> ((pe %hi ni):jo n/'2')
648 ~zod/try=> ((pe %hi ni):jo b/|)
653Reparse string to tape
655Reparser modifier. Reparses a [`++json`]() string to a [`++tape`]().
660`jon` is a [`++json`]().
665The [`++unit`]() of a [`++tape`]().
670 ++ sa :: string as tape
672 ?.(?=([%s *] jon) ~ (some (trip p.jon)))
678 ~zod/try=> (sa:jo s/'value')
680 ~zod/try=> (sa:jo n/'46')
682 ~zod/try=> (sa:jo a/~[s/'val 2'])
687Reparse string to cord
689Reparser modifier. Reparses a string to a [`++cord`]().
694`jon` is a [`++json`]().
699The [`++unit`]() of a [`++cord`]().
704 ++ so :: string as cord
706 ?.(?=([%s *] jon) ~ (some p.jon))
712 ~zod/try=> (so:jo s/'value')
714 ~zod/try=> (so:jo n/'46')
716 ~zod/try=> (so:jo a/~[s/'val 2'])
723Reparser generator. Produces a reparser that applies `sab` to a string.
728`sab` is a [`++rule`].
738 ++ su :: parse string
748 ~zod/try=> ((su:jo fed:ag) s/'zod')
750 ~zod/try=> ((su:jo fed:ag) s/'doznec')
752 ~zod/try=> ((su:jo fed:ag) s/'notship')
754 ~zod/try=> ((su:jo fed:ag) n/'20')
761Reparser modifier. Reparses a null value.
766`jon` is a [`++json`]().
771The [`++unit`]() of null.
776 ++ ul |=(jon=json ?~(jon (some ~) ~)) :: null
781 ~zod/try=> (ul:jo `json`~)
783 ~zod/try=> (ul:jo s/'null')
785 ~zod/try=> (ul:jo b/|)
787 ~zod/try=> (ul:jo b/&)
792Pole of nonempty units
794Determines if `pod` contains all non-empty units, producing a boolean. Used
800`pod` is a [`++pole`]() of [`++unit`]().
810 ++ za :: full unit pole
820 ~zod/try=> (za:jo ~[`1 `2 `3])
822 ~zod/try=> (za:jo ~[`1 ~ `3])
829Produces a unit of the values of `lut` if every unit in `lut` is
830nonempty. Otherwise, produces `~`.
835`lut` is a [`++list`]() of [`++unit`]()s.
845 ++ zl :: collapse unit list
848 ?~(lut & ?~(i.lut | $(lut t.lut)))
853 [i=u:+.i.lut t=$(lut t.lut)]
859 ~zod/try=> (zl:jo `(list (unit))`~[`1 `2 `3])
861 ~zod/try=> (zl:jo `(list (unit))`~[`1 `17 `3])
863 ~zod/try=> (zl:jo `(list (unit))`~[`1 ~ `3])
870Collapses a `++pole` of `++unit`s `but`, producing a tuple.
875`but` is a [`++pole`]() of [`++unit`]().
890 [u:->.but (zp +.but)]
896 ~zod/try=> (zp:jo `(pole (unit))`~[`1 `2 `3])
898 ~zod/try=> (zp:jo `(pole (unit))`~[`1 `17 `3])
900 ~zod/try=> (zp:jo `(pole (unit))`~[`1 ~ `3])
907Produces a [`++unit`]() of the [`++map`]() `lum` of term to `++unit` key value
908pairs, with all of the nonempty values stripped of their `++unit`
909wrappers. If any of the `++units` in `lum` are empty, `~` is produced.
910See also: [`++zp`](), [`++zl`]().
915`lum` is a map of [`++term`]() to [`++unit`]()s.
920The `++unit` of a tuple of what were the key-value pairs of `lum`.
925 ++ zm :: collapse unit map
926 |* lum=(map term (unit))
927 ?: (~(rep by lum) | |=([[@ a=(unit)] b=?] |(b ?=(~ a))))
929 (some (~(run by lum) need))
935 ~zod/try=> (zm:jo `(map term (unit ,@u))`(mo a/`4 b/`1 c/`2 ~))
936 [~ {[p=%a q=4] [p=%c q=2] [p=%b q=1]}]
937 ~zod/try=> (zm:jo `(map term (unit ,@u))`(mo a/`4 b/~ c/`2 ~))
939 ~zod/try=> (~(run by `(map ,@t ,@u)`(mo a/1 b/2 c/3 ~)) (flit |=(a=@ (lth a 5))))
940 {[p='a' q=[~ u=1]] [p='c' q=[~ u=3]] [p='b' q=[~ u=2]]}
941 ~zod/try=> (zm:jo (~(run by `(map ,@t ,@u)`(mo a/1 b/2 c/3 ~)) (flit |=(a=@ (lth a 5)))))
942 [~ {[p='a' q=1] [p='c' q=3] [p='b' q=2]}]
943 ~zod/try=> (zm:jo (~(run by `(map ,@t ,@u)`(mo a/1 b/7 c/3 ~)) (flit |=(a=@ (lth a 5)))))
945 ~zod/try=> (~(run by `(map ,@t ,@u)`(mo a/1 b/7 c/3 ~)) (flit |=(a=@ (lth a 5))))
946 {[p='a' q=[~ u=1]] [p='c' q=[~ u=3]] [p='b' q=~]}
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list