I have two questions. One is
Is there any way to combine one string with one argument?
For example, I want to combine "test" and "count" which is an argument of a
do-loop. ("test"+"count"="test3", now count equals to 3) I use "cons" but it
gave me "test . 3". The other is
When I call a function inside a main function, I can just return the result
value. But I also need the other value of arguments inside the
called-function. How to get them?
"Wayne" <··@ecn.purdue.edu> writes:
> I have two questions. One is
>
> Is there any way to combine one string with one argument?
> For example, I want to combine "test" and "count" which is an argument of a
> do-loop. ("test"+"count"="test3", now count equals to 3) I use "cons" but it
> gave me "test . 3".
look at FORMAT. examples
(format nil "test~a" 3)
=> "test3"
(format nil "~a~a" "test" 3)
=> "test3"
> The other is
>
> When I call a function inside a main function, I can just return the result
> value. But I also need the other value of arguments inside the
> called-function. How to get them?
what do you mean "other value"? can you provide some sort of example?
MULTIPLE-VALUE-BIND or MULTIPLE-VALUE-SETQ may be what you want.
(multiple-value-bind (f r)
(floor 130 11)
(list f r))
=> (11 9)
hope this helps.
--
J o h a n K u l l s t a m
[········@ne.mediaone.net]
sysengr
Thanks a lot.
setf test-variable "
One is
> >
> > Is there any way to combine one string with one argument?
> > For example, I want to combine "test" and "count" which is an argument
of a
> > do-loop. ("test"+"count"="test3", now count equals to 3) I use "cons"
but it
> > gave me "test . 3".
>
> look at FORMAT. examples
>
> (format nil "test~a" 3)
> => "test3"
>
> (format nil "~a~a" "test" 3)
>
> => "test3"
From: Michael Parker
Subject: Re: _Problem of Combination & Return Value
Date:
Message-ID: <8rcnnq$msk$1@nnrp1.deja.com>
In article <············@mozo.cc.purdue.edu>,
"Wayne" <··@ecn.purdue.edu> wrote:
> I have two questions. One is
>
> Is there any way to combine one string with one argument?
> For example, I want to combine "test" and "count" which is an argument
of a
> do-loop. ("test"+"count"="test3", now count equals to 3) I use "cons"
but it
> gave me "test . 3".
see "format", for the cl equivalent of fprintf/sprintf
> The other is
>
> When I call a function inside a main function, I can just return the
result
> value. But I also need the other value of arguments inside the
> called-function. How to get them?
>
>
"values" will let you return multiple values from a function.
"multiple-value-bind" will let you catch multiple return values.
Sent via Deja.com http://www.deja.com/
Before you buy.