Skip to content

Instantly share code, notes, and snippets.

@comboy
Created January 3, 2015 22:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save comboy/87e6d702c779a6abb53c to your computer and use it in GitHub Desktop.
Save comboy/87e6d702c779a6abb53c to your computer and use it in GitHub Desktop.
Simple tool for playing with multiline hoon. After putting it in /main/app/run/core.hook, create `/try/run/moo.hoon` execute `:run %moo` and stay in your editor while watching what happens when you try to compile random characters as hoon.
/- term-line
!:
|%
++ axle
$% [%0 prog=@tas]
==
++ clay-gift
$% [%ergo p=@p q=@tas r=@ud]
[%note p=@tD q=tank]
[%writ p=riot]
==
++ gall-gift
$% [%gone p=hapt]
[%init p=@p]
[%dumb ~]
[%mean p=ares]
[%nice ~]
[%rush p=gilt]
[%rust p=mark q=*]
[%sage p=path q=*]
[%verb ~]
[%veer p=@ta q=path r=@t]
[%vega p=path]
==
++ sign
$% [%c clay-gift]
[%g gall-gift]
==
++ hapt ,[p=ship q=path]
++ gilt
$% [%term-line p=term-line]
[%txt p=cord]
[%type p=?]
==
--
|_ [hid=hide vat=axle]
++ poke-run-args
|= [ost=bone hms=ship arg=term ~]
=. prog.vat arg
:_ +>
:- [ost %give %nice ~]
=+ ark=;;(arch .^(%cy rut))
?~ q.ark
:- [ost %pass / %g %cide %$]
:- [ost %pass / %d %flog %text "Give me some hoon into {(spud rut)} ! Exiting."]
~
:- [ost %pass / %c %warp [hms hms] %try ~ %| [%da lat.hid] [%da (add lat.hid ~d100)] desk-rut]:: ~ %& %y [%ud 2] /]
:- [ost %pass / %d %flog %text "Listening for changes in {(spud rut)}"]
:- [ost %pass /out %g %show [hms /shell] hms /out]
~
++ pour
|= [ost=bone path sih=sign]
:_ +>
?- sih
[%c *]
?. ?=([%c %writ *] sih) ~
=+ rot=(need p.sih)
=+ ver=p.q.p.rot
=+ code=;;(,@t .^(%cx rut))
?: =(code '')
:_ ~ [ost %pass / %d %flog %text "! File seems to be empty (clay bug?). Try again."]
:- [ost %pass / %g %mess [our.hid /shell] our.hid %txt !>(code)]
:- [ost %pass / %d %flog %text ": {(scow %tas prog.vat)} ver. {(scow %ud ver)}"]
~
[%g *]
?. ?=([%g %rush *] sih) ~
?~ p.p.sih ~
=+ out=(limo +>.p.p.sih)
%+ turn (~(tap by sup.hid))
|= [ost=bone *]
[ost %give %rush %tang out]
==
::
++ desk-rut
^- path
~['run' prog.vat 'hoon']
::
++ rut
^- path
%- welp :_ desk-rut
~[(scot %p our.hid) 'try' (scot %da lat.hid)]
::
++ peer |=(* `+>)
--
@mattearnshaw
Copy link

very handy, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment