week2
This commit is contained in:
parent
00d09fcbe2
commit
43c7d1e262
3 changed files with 19 additions and 0 deletions
14
week2/week2.hoon
Normal file
14
week2/week2.hoon
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
:: Hoon School - Week 2
|
||||
:: ~bannum-magtus || s@p7.co.nz
|
||||
::
|
||||
|= a=* ::
|
||||
^- tape :: explicitly return a tape
|
||||
%- weld :: weld some strings to reduce repitition
|
||||
:- "input is " ::
|
||||
?: .?(a) :: first branch, test whether a is a cell
|
||||
"a cell" ::
|
||||
%- weld :- :: if not, take the atom branch
|
||||
?: =((mod (@ a) 2) 0) :: this cast is safe as we know a is an atom
|
||||
"an even" ::
|
||||
"an odd" ::
|
||||
" atom" ::
|
||||
Loading…
Add table
Add a link
Reference in a new issue