[erlang-questions] Re: string to tupple ?

Richard O'Keefe ok@REDACTED
Tue Jun 22 00:06:46 CEST 2010


On Jun 21, 2010, at 9:10 PM, Tim Fletcher wrote:

>> The obvious question is "WHY"?
>
> Presumably you meant "why isn't that data structured relationally"
> instead of "why extract data from a database" :) One possible answer
> is that it's someone else's database.

An answer from somebody other than the original poster isn't very
useful.  The question "why did whoever designed the data base fail
to store the data in a relationally idiomatic way" remains
unanswered.

>
>> For example, if you know the numbers are whole numbers,
>> the very simplest code would be
>>         [X || {integer,_,X} <- erl_scan:string(String)]
>> which would give you a list of integers.
>
> That'll throw a "bad generator" error. Did you mean this:
>
>  {ok,Tokens,_} = erl_scan:string("(1,2),(3,4)"),
>  [X || {integer,_,X} <- Tokens].

Yes.  A rather silly mistake for me to make, especially with
the sample output staring me in the face.



More information about the erlang-questions mailing list