Aug
No, you need multiple-value-bind (or a similar function like multiple-
value-let that is capable of accepting multiple values).
Michael Wein German Research Center phone:
++49(0)681/3025303
Research assistant for Artificial Intelligence fax:
++49(0)681/3025341
http://www.dfki.uni-sb.de
| read-from-string returns 2 values, how do you access the second one?
| We tried passing the read-from-string with parameters to another
| function in order to access the 2 values, but that didn't seem to work.
see `nth-value' if you only want the second value.
--
sometimes a .sig is just a .sig
This is possible, however nth-value is intended as a universal accessor function for
sequences and not for retrieving multiple values.
| see `nth-value' if you only want the second value.
[Michael Wein]
| This is possible, however nth-value is intended as a universal accessor
| function for sequences and not for retrieving multiple values.
reading the fine manual is highly recommended.
http://www.harlequin.com/books/HyperSpec/Body/mac_nth-value.html
you're confusing `nth' and `nth-value'.
CLtL2: p 181ff
The functions you may want to look at include
nth-value [already mentioned and only pertaining to multiple-vals]
multiple-value-bind [no such thing as multiple-value-let]
multiple-value-call
multiple-value-setq
If you really only want the second value [final stream position], use
(nth-value 1 (read-from-string ...))
Note, use 1 because it's a zero based index.
If you want to pass both values to a function (which I think you were
merely trying as a means of accessing the second val, but what the heck):
(multiple-value-call #'receiving-function (read-from-string ...))
If you want to create local vars (ala let) to hold the vals:
(multiple-value-bind (read-result stream-posit)
(read-from-string ...)
..forms..)
If you want to capture both values into existing vars:
(multiple-value-setq (read-result stream-posit)
(read-from-string ...))
..forms..
--
Donald H. Mitchell d...@pgh.net
Proactive Solutions, Inc. 412.835.2410
5858 Horseshoe Dr. 412.835.2411 (fax)
Bethel Park, PA 15102
> you're confusing `nth' and `nth-value'.
You are right, I am sorry for the mistake.
And last but not least:
multiple-value-list
This function collects all multiple-values in a list. Than you only have
one value and can work with it as used to. (i.e. with nth :-) )
? (multiple-value-list (floor 5 2))
(2 1)
- stefan
_____________________________________________________________________
*** Support bacteria -- it's the only culture some people have! ****
_____________________________________________________________________
Stefan K. Bamberger email: ba...@informatik.uni-wuerzburg.de
Lehrstuhl f"ur Informatik VI voice : ++49 931 7056118
Universit"at W"urzburg / Germany Fax : ++49 931 7056120
_____________________________________________________________________