1. Re: we need official libs : Swap
Lionel Wong wrote:
>As mentioned in the reference manual, subscripting expressions is not
>supported because that would wastefully discard some already calculated
>values. There is a purpose for value() to return more than the result
>called
>for: error-handling. The correct use of value() would be--
>
>include get.e
>sequence getval
>atom num
>getval = value("7")
>if getval[1] = GET_SUCCESS
> then num = getval[2]
> else .... -- handle the invalid crap that obviously wasn't "7"
>end if
>
>Lionel Wong
Yes, and that is how I do it unless I'm wanting a
quick sthortcut to get a number. Notice that the
"correct" example you gave requires 2 variables and
2 instances of subscripting where as my suggested
example would only requre one variable and only need
to be subscripted once because it could be done at
the function call. I suppose I can always make my
own shortcut-value-function this way:
function val (sequence s)
sequence getval
getval = value (s)
return getval [2]
end function
or even one that does the error handling for me:
function val (sequence s)
sequence getval
getval = value (s)
if getval [1] = GET_SUCCESS then
return getval [2]
else
puts (1, "\nError using value()")
abort (1)
end if
end function
Then all I have to do is something like:
num = val("7")
later
Lewis Townsend
_______________________________________________________________
Get Free Email and Do More On The Web. Visit http://www.msn.com