Stair-climbing puzzle: Difference between revisions
Content added Content deleted
m (→{{header|J}}) |
m (→{{header|J}}) |
||
Line 502: | Line 502: | ||
step_up=: (] , attemptClimb)^:isNotUpOne^:_</lang> |
step_up=: (] , attemptClimb)^:isNotUpOne^:_</lang> |
||
Note that <code>0:</code> is not a number but a verb (function) that returns the number zero irrespective of its argument(s). And, arguably, infinity is not any specific number. Therefore the above solution for <code>step_up</code> |
Note that <code>0:</code> is not a number but a verb (function) that returns the number zero irrespective of its argument(s). And, arguably, infinity is not any specific number. And, finally, <code>step</code> is presumed to pre-exist in the task description. Therefore the above solution for <code>step_up</code> could validly be said to meet the restrictions of no variables or numbers. |
||
J's verbs (functions) always take an argument. J programmers use verbs which ignore their arguments (e.g. <code>step</code> and <code>attemptClimb</code>) to replace verbs which do not take an argument. |
J's verbs (functions) always take an argument. J programmers use verbs which ignore their arguments (e.g. <code>step</code> and <code>attemptClimb</code>) to replace verbs which do not take an argument. |