Revolucent icon

Recaman's Sequence in Hoon

Revolucent | PRO | 01/02/22 08:55:44 AM UTC | 0 ⭐ | 948 👁️ | Never ⏰ | []
text |

350 B

|

None

|

0 👍

/

0 👎

:: Recaman's Sequence in Hoon
 |=  limit=@
%-  flop
^-  (list @)
?:  =(0 limit)
  ~
=/  result=(list @)  ~[0]
|-
?:  =((lent result) limit)
  result
=/  n  (dif:si (new:si & -.result) (new:si & (lent result)))
=/  p  (abs:si n)
?:  ?&((syn:si n) =(~ (fand ~[p] result)))
  $(result [p result])
$(result [(add -.result (lent result)) result])

Comments