From: maitre Aliboron
Subject: how to pass parameters to a function
Date: 
Message-ID: <486bd9fb$0$5049$426a74cc@news.free.fr>
Hi, all. I have a problem with a LISP-like language.

Given a function (call it "f") which accepts
arguments like all other functions, in this
way: (f arg1 arg2 arg3 ...)

My problem is that I have the arguments
in list form: (arg1 arg2 arg3 ...).

There is a way to pass them to the function?

I have to pass the parameters as a whole block,
solutions using mapcar or something like this
didn't work (at least, I wasn't able to do it).

Does exist an operator that "maps" the elements
of a list into the parameters of a function?

Arguments is a string type. I don't know if it helps...

Thanks.

maitre Aliboron
 

From: Grant Rettke
Subject: Re: how to pass parameters to a function
Date: 
Message-ID: <5163d129-819c-459b-adf4-d31501517d62@l42g2000hsc.googlegroups.com>
Use apply:

(apply #'+ '(1 2 3 4))
From: maitre Aliboron
Subject: Re: how to pass parameters to a function
Date: 
Message-ID: <486be04f$0$27902$426a74cc@news.free.fr>
> Use apply:
>
> (apply #'+ '(1 2 3 4))

Thank you both. Tomorrow I will try.
I hope only that the language is so LISP-like
to have such function...

For the moments all typical structures seem to
be there (defun, lambda, let, mapcar...)

maitre Aliboron 
From: Pascal Costanza
Subject: Re: how to pass parameters to a function
Date: 
Message-ID: <6d29glFftiuU1@mid.individual.net>
maitre Aliboron wrote:
>> Use apply:
>>
>> (apply #'+ '(1 2 3 4))
> 
> Thank you both. Tomorrow I will try.
> I hope only that the language is so LISP-like
> to have such function...
> 
> For the moments all typical structures seem to
> be there (defun, lambda, let, mapcar...)

What is the language called?


Pascal

-- 
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: John Thingstad
Subject: Re: how to pass parameters to a function
Date: 
Message-ID: <op.udoo9cyhut4oq5@pandora.alfanett.no>
P� Wed, 02 Jul 2008 23:16:05 +0200, skrev Pascal Costanza <··@p-cos.net>:

> maitre Aliboron wrote:
>>> Use apply:
>>>
>>> (apply #'+ '(1 2 3 4))
>>  Thank you both. Tomorrow I will try.
>> I hope only that the language is so LISP-like
>> to have such function...
>>  For the moments all typical structures seem to
>> be there (defun, lambda, let, mapcar...)
>
> What is the language called?
>
>
> Pascal
>

Cryptic Lisp of coerce. Given all those funny names ;)
mapc, mapcar, multiple-value-bind etc..
Nothing you know from C will help.. Try the format statement.
Might I add it is a refreshingly wonderful language.
Relish and enjoy, but be patient.

--------------
John Thingstad
From: maitre Aliboron
Subject: Re: how to pass parameters to a function
Date: 
Message-ID: <486bfcd1$0$26943$426a74cc@news.free.fr>
> What is the language called?

SKILL.
According to the doc is derived by Scheme.

I checked the manual and the function apply
is present, so I should have my problem solved.
I have only to try.

maitre Aliboron 
From: maitre Aliboron
Subject: Re: how to pass parameters to a function
Date: 
Message-ID: <486d176f$0$23638$426a74cc@news.free.fr>
> I have only to try.

BTW, it works fine. Thanks.

maitre Aliboron
From: John Thingstad
Subject: Re: how to pass parameters to a function
Date: 
Message-ID: <op.udokcuvdut4oq5@pandora.alfanett.no>
P� Wed, 02 Jul 2008 21:41:42 +0200, skrev maitre Aliboron  
<········@despammed.com>:

> Hi, all. I have a problem with a LISP-like language.
>
> Given a function (call it "f") which accepts
> arguments like all other functions, in this
> way: (f arg1 arg2 arg3 ...)
>
> My problem is that I have the arguments
> in list form: (arg1 arg2 arg3 ...).
>
> There is a way to pass them to the function?
>
> I have to pass the parameters as a whole block,
> solutions using mapcar or something like this
> didn't work (at least, I wasn't able to do it).
>
> Does exist an operator that "maps" the elements
> of a list into the parameters of a function?
>
> Arguments is a string type. I don't know if it helps...
>
> Thanks.
>
> maitre Aliboron
>
>

like this

(defun fun (&rest char-list)
    (format t "~{~A~^~%~}~%" char-list))

(defparameter *my-strings* '("one" "two" "three"))

(apply #'fun *my-strings*)

perhaps?

--------------
John Thingstad