Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scheme - unpack list's elements into function [duplicate]

Tags:

scheme

I have a function which takes an unlimited number of args such as (define (func . args)).

Say I have a list '(1 2 3), how do I unpack the elements into the function like (func 1 2 3)? Does Scheme have a primitive for this?

like image 394
sikerbela Avatar asked Sep 20 '25 10:09

sikerbela


1 Answers

You can use apply:

(apply func '(1 2 3))
like image 159
Gerstmann Avatar answered Sep 23 '25 10:09

Gerstmann