better week2
This commit is contained in:
parent
43c7d1e262
commit
453fd47781
@ -1,14 +1,13 @@
|
|||||||
:: Hoon School - Week 2
|
:: Hoon School - Week 2
|
||||||
:: ~bannum-magtus || s@p7.co.nz
|
:: ~bannum-magtus || s@p7.co.nz
|
||||||
::
|
::
|
||||||
|= a=* ::
|
|= a=* :: take in any noun
|
||||||
^- tape :: explicitly return a tape
|
^- tape :: explicitly return a tape
|
||||||
%- weld :: weld some strings to reduce repitition
|
%+ weld :: weld some strings to reduce repitition
|
||||||
:- "input is " ::
|
"input is " ::
|
||||||
?: .?(a) :: first branch, test whether a is a cell
|
?^ a :: first branch, test whether a is a cell
|
||||||
"a cell" ::
|
"a cell" ::
|
||||||
%- weld :- :: if not, take the atom branch
|
=- (weld - " atom") :: attach a block to the head of the subject
|
||||||
?: =((mod (@ a) 2) 0) :: this cast is safe as we know a is an atom
|
?: =((mod a 2) 0) :: mod is safe because we know a isnt a cell
|
||||||
"an even" ::
|
"an even" ::
|
||||||
"an odd" ::
|
"an odd" ::
|
||||||
" atom" ::
|
|
||||||
|
Loading…
Reference in New Issue
Block a user