Skip to content

Instantly share code, notes, and snippets.

@darighost
Last active October 23, 2023 03:11
Show Gist options
  • Save darighost/57ee9496be0b5400306b41b7fefc9288 to your computer and use it in GitHub Desktop.
Save darighost/57ee9496be0b5400306b41b7fefc9288 to your computer and use it in GitHub Desktop.
Bunch of hoon toy problems
|= n=tape
=/ index 0
=/ found ""
=/ vowels "aeiou"
|-
?: =(index (lent vowels))
found
=/ current (trip (snag index vowels))
=/ added ?: =(~ (find current n))
""
current
%= $
index +(index)
found (weld found added)
==
|= [l=(list)]
^- (list)
=/ i (dec (lent l))
|-
=/ next ?:(=(i 0) ~ $(i (dec i)))
[(snag i l) next]
|= n=@ud
^- @ud
=/ a 0
=/ b 1
|-
?: =(n 0)
a
%= $
a b
b (add a b)
n (dec n)
==
|= n=@ud
^- @ud
=/ b 1
|-
?: .= n 1
%- pow :- b 2
%= $
b (add 1 b)
n (dec n)
==
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment