Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: functions with variable numbers of arguments #194

Open
skwerlman opened this issue Jan 4, 2024 · 0 comments
Open

Feature request: functions with variable numbers of arguments #194

skwerlman opened this issue Jan 4, 2024 · 0 comments

Comments

@skwerlman
Copy link

I'd like to be able to define a function which accepts a variable (within a known range) number of arguments, to be used like this:

foo(1, 2)
foo(1, 2, 3, 4)

I can think of 2 possible ways I might want to be able to define it, default argument values or multiple definitions. For my use case either one will work, though I think multiple definitions is the better one (and it can emulate default values pretty trivially)

; default values
#fn foo(a, b, c=3, d=4) => { ... }

; multiple definitions
#fn foo(a, b) => { ... }
#fn foo(a, b, c, d) => { ... }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants