Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
element: +
name: add
arity: 2
description: adds the top two items on the stack
num-num: a + b
num-str: str(a) + b
str-num: a + str(b)
str-str: a + b
vectorise: yes
tests:
: [1, 1] -> 2
: [0, -5] -> -5
: ["abc", 5] -> "abc5"
: [5, "abc"] -> "5abc"
: ["Hello, ", "World!"] -> "Hello, World!"
: [[1,2,3], 4] -> [5, 6, 7]
: [[1,2,3], [4,5,6]] -> [5, 7, 9]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment