RE: command_line() - convert a sequence to an atom value?
- Posted by "C. K. Lester" <cklester at yahoo.com> Aug 14, 2001
- 416 views
> it would be a whole lot nicer if there happens to be a way of storing the > numerical value of the command_line() sequence {51,48} as 30 in my atom. > > Any ideas? > > Joel Garcia >From the EUPHORIA Reference Manual: value Syntax: include get.e s = value(st) Description: Read the string representation of a Euphoria object, and compute the value of that object. A 2-element sequence, {error_status, value} is actually returned, where error_status can be one of: GET_SUCCESS -- a valid object representation was found GET_EOF -- end of string reached too soon GET_FAIL -- syntax is wrong Comments: This works the same as get(), but it reads from a string that you supply, rather than from a file or device. After reading one valid representation of a Euphoria object, value() will stop reading and ignore any additional characters in the string. For example, "36" and "36P" will both give you {GET_SUCCESS, 36}. Example 1: s = value("12345"} -- s is {GET_SUCCESS, 12345} Example 2: s = value("{0, 1, -99.9}") -- s is {GET_SUCCESS, {0, 1, -99.9}} Example 3: s = value("+++") -- s is {GET_FAIL, 0}