1. real world value flaw

>>>>>
    - you wanted to 'get' two values seperated by a comma in sequence-for=
m:
      Insert this before your 'value (s)' statement.....
                                                            s =3D '{' & s=
 '}'

    - you wanted to 'get' the value 1.234 as one floating point value:
     (a comma is the european alternative to seperate the floating point
part from the integer value)
     Insert this before your 'value (s)' statement.......
<<<<<

Sorry, Ralf.  You are incorrect.  And I wasn't doing this just to bother
Robert or anyone else with a "fluke".

I have some stats file that I'm trying to parse into values.  Its current=
ly
in the 100s.  Now, when the stats go over 1,000, I wonder if the service
(which is not under my control) will use commas, which is the US way of
separating thousands.  If it did, I wondered if Euphoria would be able to=

handle it.  The answer is, unfortunately, no.

Alan
  =

new topic     » topic index » view message » categorize

2. Re: real world value flaw

>>>>>>
>    - you wanted to 'get' two values seperated by a comma in sequence-form:
>      Insert this before your 'value (s)' statement.....
>                                                            s = '{' & s '}'
>
>    - you wanted to 'get' the value 1.234 as one floating point value:
>     (a comma is the european alternative to seperate the floating point
>part from the integer value)
>     Insert this before your 'value (s)' statement.......
><<<<<
>
>Sorry, Ralf.  You are incorrect.  And I wasn't doing this just to bother
>Robert or anyone else with a "fluke".
>
>I have some stats file that I'm trying to parse into values.  Its currently
>in the 100s.  Now, when the stats go over 1,000, I wonder if the service
>(which is not under my control) will use commas, which is the US way of
>separating thousands.  If it did, I wondered if Euphoria would be able to
>handle it.  The answer is, unfortunately, no.

Only half true: Download COMMAS.ZIP off of the archives. (Shameless plug.)

It can handle commas in input like "1,000" and add commas to output like
"1000". It also correctly handles numbers like "1000.05".

</plug>

new topic     » goto parent     » topic index » view message » categorize

3. Re: real world value flaw

> Sorry, Ralf.  You are incorrect.  And I wasn't doing this just to bother
> Robert or anyone else with a "fluke".
>
> I have some stats file that I'm trying to parse into values.  Its currently
> in the 100s.  Now, when the stats go over 1,000, I wonder if the service
> (which is not under my control) will use commas, which is the US way of
> separating thousands.  If it did, I wondered if Euphoria would be able to
> handle it.  The answer is, unfortunately, no.

Hmm, doesn't sound that hard to accomplish though.
Here's a short function that will help you out with, for example, this
'problem':

global function remove_item (object x, sequence s)
sequence result
integer pos
object item

    pos = find (x, s)
    if pos then
        result = s[1..pos-1]
        for index = pos+1 to length(s) do
            item = s[index]
            if not equal (item, x) then
                s = append(s, item)
            end if
        end for
        return result
    else
        return s
    end if
end function

And it should be pretty fast. (or at least its one of the fastest algorithms I
could come up with)
Though, consider this algorithm, faster for fewer cases.. (I suspect)

global function remove_item (object x, sequence s)

    for index = length(s) to 1 by -1 do
        if equal (s[index], x) then
            s = s[1..index-1] & s[index+1..length(s)]
        end if
    end for

    return s
end function

Anyway, here's your new value () statement:
value (remove_item(',', s))

However, this will not work when sequence definitions are used!
It simply couldn't because then, the interpreter has no way of knowing if a
'comma' means either a thousand separator or a next
element.
Comma's separating thousands are not used by computers, or for computer, but for
human-readability, therefor a package (which is
available) that adds and removes comma's from the input are what you need. Its
an interface issue, nothing more.

Ralf

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu