source-academy / js-slang

Implementations of sublanguages of JavaScript, TypeScript, Scheme and Python
https://source-academy.github.io/source/
Apache License 2.0
66 stars 104 forks source link

Stepper: Build-in function ignores extra arguments passed in #1626

Open hanscau opened 6 months ago

hanscau commented 6 months ago

When a built-function is called with more arguments than it requires, it ignores it.

pair(1, 2, 3, 4, 5) will result in [1, 2]
head(list(1), list(2), list(3)) will return 1
is_boolean(1, 3, "string", false) will return false

It should throw an "Expected x arguments, but got y." error instead

Expected behaviour: image