This commit is contained in:
tA 2019-07-16 10:41:36 +12:00
parent 00d09fcbe2
commit 43c7d1e262
3 changed files with 19 additions and 0 deletions

14
week2/week2.hoon Normal file
View 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" ::