Stair-climbing puzzle: Difference between revisions
Content deleted Content added
m →{{header|J}}: simplify step |
→{{header|J}}: use and explain 0: |
||
Line 162:
'''Solution (Tacit):'''
<lang j>step =: 0.6 > ?@0:
attemptClimb =: [: <:`>:@.step
isNotUpOne =: -.@(+/@])
step_up=: (] , attemptClimb)^:isNotUpOne^:_
Note that
J's verbs (functions) always take an argument i.e. there is no such thing as a niladic verb. Verbs that ignore their arguments (e.g. <code>step</code> and <code>attemptClimb</code>) achieve the same effect.
'''Solution (Explicit):'''
|