Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
15
Task/JSON/Hoon/json.hoon
Normal file
15
Task/JSON/Hoon/json.hoon
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
:- %say
|
||||
|= [^ [in=@tas ~] ~]
|
||||
:- %noun
|
||||
=+ obj=(need (poja in)) :: try parse to json
|
||||
=+ typ=$:(name=@tas age=@ud) :: datastructure
|
||||
=+ spec=(ot name/so age/ni ~):jo :: parsing spec
|
||||
?. ?=([%o *] obj) :: isnt an object?
|
||||
~
|
||||
=+ ^= o
|
||||
%. %. (spec obj) :: parse with spec
|
||||
need :: panic if failed
|
||||
,typ :: cast to type
|
||||
=. age.o +(age.o) :: increment its age...
|
||||
%: crip %: pojo :: pretty-print result
|
||||
(jobe [%name s/name.o] [%age n/(crip <age.o>)] ~) :: convert back to json
|
||||
Loading…
Add table
Add a link
Reference in a new issue