Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pxeger/87aaa359f6ba6991b4b3090b67a89f43 to your computer and use it in GitHub Desktop.
Save pxeger/87aaa359f6ba6991b4b3090b67a89f43 to your computer and use it in GitHub Desktop.
- 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: true
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]
- element: '-'
name: subtract
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment