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
> 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
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/
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
> 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
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