Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :: Define a naked gate that takes a list of atoms.
- :: I used * because I couldn't figure out what was the 'type' of a list.
- ::
- |= n=*
- :: Initialize i with value 1.
- ::
- =/ i=@ud 1
- :: Set a recursion point to loop over the list elements.
- ::
- |-
- :: Check if i == 3; if so, return the head of our list.
- ::
- ?: =(i 3)
- -:n
- :: Otherwise, recur with the tail of our list after incrementing i.
- ::
- $(n +:n, i (add 1 i))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement