1. Euphoria Standard Library


new topic     » topic index » view message » categorize

2. Re: Euphoria Standard Library

I'm glad you're still working on this, I asked if you were on it a few
weeks ago and nobody answered to it.
I'll try to look if I have some usefull routines inside all the
programs i've made so far (of course the ones that you haven't covered
yet).

Best Regards,
   Guillermo Bonvehi
   AKA: Caballero Rojo - Knixeur

Jeffrey Fielding wrote:

There are currently three developers working on ESL, and we've made
some
progress, though ESL is far from finished. In case you haven't heard of
ESL before, it's a library that was originally designed to help solve
Euphoria's current namespace problems and encourage code reuse through
a
standard, uniform, easy to use, and comprehensive set of frequently
used
routines. Although namespace problems are not so much of a concern now,
I
think ESL will, when completed, help by increasing code reuse (and thus
decreasing development time, at least somewhat). Furthermore, I think
ESL
would help newcomers to Euphoria by providing routines which they might
expect to find built-in (abs(x), for example). Anyway, you can see what
we've done so farĀ at the ESL project site on
sourceforge: http://sourceforge.net/projects/standardeu/ All our work
is currently in CVS - we haven't made any releases since
it's
not anywhere near complete, and the code is probably going to change a
lot
before it is - so if you want to look at the source, you can browse the
CVS. I wouldn't suggest using it yet, though, since the final version
will
probably be incompatible with the current version, and the current
version
hasn't been thoroughly tested. So if you have any suggestions as to
what to add, or even better, if
you
have an include file or two (or just a few routines) that you'd like to
contribute, please send them to me or, if you want to join the project,
send me your sourceforge username and I'll add you to the list of
developers so you contribute directly through CVS etc. Jeff

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

3. Re: Euphoria Standard Library

I have one function for you:
For searching word (Eu object) in sorted sequence. It's faster that find (),
esspecially with big sequences.
You can put it in cathegory searching, or algorithm.


include sort.e
include misc.e

-- Finds 'find_me' in sorted sequence 's'.
-- Fast searching.
-- Returns index or 0 if not found.
-- Benchmark results:
-- This function is especially fast when there are a lot of words
-- in array 's'. If there are less than about 50 words in 's', then builtin
find() is faster.
-- Length of 's' shouldn't be 0.
global function find_in_sorted (object find_me, sequence s)
 integer cur -- current compared, index
 integer res -- result
 integer upp -- upper bound, index
 integer low -- lower bound, index
 integer dif -- difference

 if compare (find_me, s [1]) = -1 or compare (find_me, s [length (s)]) = 1
then
  return 0
 end if

 low = 0
 upp = length (s) + 1

 while 1 do
  dif = upp - low
  if dif = 1 then -- manually check it
   if compare (find_me, s [low + 1]) = 0 then
    return low + 1
   else
    return 0
   end if
  end if
  cur = low + floor (dif / 2)
  res = compare (find_me, s [cur])
  if res = -1 then -- find_me is less
   upp = cur
  elsif res = 1 then -- find_me is greater
   low = cur
  else -- res = 0
   return cur -- found!
  end if
 end while
 return 0 -- not found
end function








Benchmarks:



Finding words which exist:
find_in_sorted() took 0.110000 seconds.
find() took 1.320000 seconds.
my_find() took 2.750000 seconds.
find_in_sorted() was 12.000000x faster than find().

Finding words which most possibly don't exist
        (generating random words time added):
find_in_sorted() took 0.440000 seconds.
find() took 2.960000 seconds.
my_find() took 5.770000 seconds.
find_in_sorted() was 6.727273x faster than find().
Testing find functions.
Number of words in array: 10000
Word lengths: 10
Iterations: 20

Finding words which exist:
find_in_sorted() took 0.880000 seconds.
find() took 344.710000 seconds.
my_find() took 486.200000 seconds.
find_in_sorted() was 391,715909x faster than find().

Finding words which most possibly don't exist
        (generating random words time added):
find_in_sorted() took 2.360000 seconds.
find() took 706.340000 seconds.
my_find() took *a lot* seconds.
find_in_sorted() was 299,296610x faster than find().
Testing find functions.
Number of words in array: 5000
Word lengths: 10
Iterations: 5

Finding words which exist:
find_in_sorted() took 0.060000 seconds.
find() took 19.380000 seconds.
my_find() took 27.740000 seconds.
find_in_sorted() was 323.000000x faster than find().

Finding words which most possibly don't exist
        (generating random words time added):
find_in_sorted() took 0.220000 seconds.
find() took 43.670000 seconds.
my_find() took 61.900000 seconds.
find_in_sorted() was 198.500000x faster than find().
Testing find functions.
Number of words in array: 20
Word lengths: 10
Iterations: 10000

Finding words which exist:
find_in_sorted() took 0.330000 seconds.
find() took 0.110000 seconds.
my_find() took 0.330000 seconds.
find_in_sorted() was 0.333333x faster than find().

Finding words which most possibly don't exist
        (generating random words time added):
find_in_sorted() took 1.320000 seconds.
find() took 1.260000 seconds.
my_find() took 1.490000 seconds.
find_in_sorted() was 0.954545x faster than find().
Testing find functions.
Number of words in array: 30
Word lengths: 10
Iterations: 10000

Finding words which exist:
find_in_sorted() took 0.550000 seconds.
find() took 0.280000 seconds.
my_find() took 0.600000 seconds.
find_in_sorted() was 0.509091x faster than find().

Finding words which most possibly don't exist
        (generating random words time added):
find_in_sorted() took 2.090000 seconds.
find() took 1.980000 seconds.
my_find() took 2.470000 seconds.
find_in_sorted() was 0.947368x faster than find().

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

4. Re: Euphoria Standard Library

-------Phoenix-Boundary-07081998-

    I have begun to post my thoughts on ESL to SourceForge. This seems to me
to be an important project, and if it is to be a Standard Library (and not 
just
a 'snippet library'), then much more discussion is needed.
    Just what is ESL anyway=3F

Karl Bochert

off topic: I got my tax refund check today from Fresno CA.  On the first 
'typed' line is
"Austin, Texas". I wonder how that got there=3F

-------Phoenix-Boundary-07081998---

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

5. Re: Euphoria Standard Library

I find these two very useful:

--find any element of "fnd" in "in"
function find_any(sequence fnd,sequence in)
        for i = 1 to length(in) do
                if find(in[i],fnd) then
                        return i
                end if
        end for
        return 0
end function

--find "fnd" as the "sub_element" element of an element of "in"
--EXAMPLE:
--constant
IN={{"ONE","TWO"},{"THREE","FOUR"},{"FIVE","SIX"},{"SEVEN","EIGHT"},{"NINE","TEN"}}
--? sub_find("FOUR",IN,2) --returns 2
--? sub_find("FOUR",IN,1) --returns 0
function sub_find(object fnd, sequence in, integer sub_element)
    for i = 1 to length(in) do
        if length(in[i]) => sub_element and equal(fnd,in[i][sub_element]) then
            return i
        end if
    end for
    return 0
end function

Thomas Parslow (PatRat) ICQ #:26359483
Rat Software
http://www.rat-software.com/
Please leave quoted text in place when replying

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

6. Re: Euphoria Standard Library

I originally proposed it as a solution to the namespace problems. For that
to work, though, it would need to be standard (or it would just conflict
with other people's routines, and thus not help at all). Now namespaces are
somewhat less of an issue, though I think it would be nice to use the
namespace qualifiers as little as possible. Besides solving namespace
problems, though, I hope it will eventually become standard in that new
users and Euphoria gurus alike won't have to search through the archive to
find a code snippet. Instead they'll be able to download ESL, and they'll
have a library with nearly all the basic routines they're likely to need.
Ultimately, I think it could be better than the current standard set of
includes since the current set lacks many frequently used functions, and
could be a lot better organized (i.e. math functions really don't belong in
misc.e).

Jeff

----- Original Message -----
From: <kbochert at ix.netcom.com>
To: "EUforum" <EUforum at topica.com>
Sent: Monday, July 23, 2001 7:46 PM
Subject: Re: Euphoria Standard Library




    I have begun to post my thoughts on ESL to SourceForge. This seems to me
to be an important project, and if it is to be a Standard Library (and not
just
a 'snippet library'), then much more discussion is needed.
    Just what is ESL anyway?

Karl Bochert

off topic: I got my tax refund check today from Fresno CA.  On the first
'typed' line is
"Austin, Texas". I wonder how that got there?

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

7. Re: Euphoria Standard Library


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

8. Re: Euphoria Standard Library

aku at inbox.as wrote:

> -- eqv_bits only for 0-255 number
> global function eqv_bits(atom a, atom b)
>     sequence abit, bbit, tp
>     
>     abit=int_to_bits(a, 8)
>     bbit=int_to_bits(b, 8)
>     tp=repeat(0,8)
>     
>     for i=1 to length(abit) do
>         if abit[i]=bbit[i] then
>             tp[i]=1
>         else
>             tp[i]=0
>         end if
>     end for        
>     
>     return bits_to_int(tp)
> end function

Pardon me 'function'ing again... :)

global function eqv_8bits(integer a, integer b)
    return 255-and_bits(xor_bits(a,b),255)
end function

Carl

-- 
Carl R White - aka - Cyrek
eMail: carlw at legend.co.uk
       cyrek at bigfoot.com
URL:   www.carlw.legend.yorks.com - nothing there yet though

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

9. Re: Euphoria Standard Library

-- finds x in s, which is assumed to be sorted
-- if x is not found returns the negative of the position where it would be
inserted (like EDS)

global function find_sorted(object x,sequence s)
    integer min,max,mid,test
    min=1
    max=length(s)
    while min<=max do
         mid=floor((min+max)/2)
         test=compare(x,s[mid])
         if test=0 then return mid end if
         if test>0 then
             min=mid+1
         else
             max=mid-1
         end if
   end while
   return -min
end function


-- Mike Nelson

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

10. Re: Euphoria Standard Library

ok, that function is (a little) better than mine. i didn't know it was
already written
in EDS, i wouldnt go on writing one bymyself if i knew that.
it's also about 1.3x faster. Jeff, you better update it

how about "hash tables" which Spellchk.ex uses? if someone would wrap that
up to be used as library, that would really be useful. it's maybe 100 times
faster than these functions. if i understand it, minimal and maximal values
have to be known. (A-Z)


----- Original Message -----
From: Mike Nelson <MichaelANelson at WORLDNET.ATT.NET>
To: EUforum <EUforum at topica.com>
Sent: Tuesday, July 24, 2001 5:17 PM
Subject: Re: Euphoria Standard Library


>
>
> -- finds x in s, which is assumed to be sorted
> -- if x is not found returns the negative of the position where it would
be
> inserted (like EDS)
>
> global function find_sorted(object x,sequence s)
>     integer min,max,mid,test
>     min=1
>     max=length(s)
>     while min<=max do
>          mid=floor((min+max)/2)
>          test=compare(x,s[mid])
>          if test=0 then return mid end if
>          if test>0 then
>              min=mid+1
>          else
>              max=mid-1
>          end if
>    end while
>    return -min
> end function
>
>
> -- Mike Nelson
>
>
>
>

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

11. Re: Euphoria Standard Library

Jeff:
I was unable to find a listing of implemented functions of ESL in the URL
you signaled. Would you be so kind to send me a listing or the functions
themselves, or otherwise specifically point to a URL where I can find them?
----- Original Message -----
From: "Jeffrey Fielding" <jjprog at earthlink.net>
To: "EUforum" <EUforum at topica.com>
Subject: Re: Euphoria Standard Library


>
>
> I originally proposed it as a solution to the namespace problems. For that
> to work, though, it would need to be standard (or it would just conflict
> with other people's routines, and thus not help at all). Now namespaces
are
> somewhat less of an issue, though I think it would be nice to use the
> namespace qualifiers as little as possible. Besides solving namespace
> problems, though, I hope it will eventually become standard in that new
> users and Euphoria gurus alike won't have to search through the archive to
> find a code snippet. Instead they'll be able to download ESL, and they'll
> have a library with nearly all the basic routines they're likely to need.
> Ultimately, I think it could be better than the current standard set of
> includes since the current set lacks many frequently used functions, and
> could be a lot better organized (i.e. math functions really don't belong
in
> misc.e).
>
> Jeff
>
> ----- Original Message -----
> From: <kbochert at ix.netcom.com>
> To: "EUforum" <EUforum at topica.com>
> Sent: Monday, July 23, 2001 7:46 PM
> Subject: Re: Euphoria Standard Library
>
>
>
>
>     I have begun to post my thoughts on ESL to SourceForge. This seems to
me
> to be an important project, and if it is to be a Standard Library (and not
> just
> a 'snippet library'), then much more discussion is needed.
>     Just what is ESL anyway?
>
> Karl Bochert
>
> off topic: I got my tax refund check today from Fresno CA.  On the first
> 'typed' line is
> "Austin, Texas". I wonder how that got there?
>
>
>
>
>
>
>

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

12. Re: Euphoria Standard Library

THEY ARE IN CVS poke around the site and look
for the three letters CVS.

I like the structure.e file, this could be handy somewhere.

Euman
euman at bellsouth.net


----- Original Message ----- 
From: <rforno at tutopia.com>
To: "EUforum" <EUforum at topica.com>
Sent: Tuesday, July 24, 2001 18:54
Subject: Re: Euphoria Standard Library


> 
> 
> Jeff:
> I was unable to find a listing of implemented functions of ESL in the URL
> you signaled. Would you be so kind to send me a listing or the functions
> themselves, or otherwise specifically point to a URL where I can find them?
> ----- Original Message -----
> From: "Jeffrey Fielding" <jjprog at earthlink.net>
> To: "EUforum" <EUforum at topica.com>
> Sent: Monday, July 23, 2001 11:08 PM
> Subject: Re: Euphoria Standard Library
> 
> 
> >
> >
> > I originally proposed it as a solution to the namespace problems. For that
> > to work, though, it would need to be standard (or it would just conflict
> > with other people's routines, and thus not help at all). Now namespaces
> are
> > somewhat less of an issue, though I think it would be nice to use the
> > namespace qualifiers as little as possible. Besides solving namespace
> > problems, though, I hope it will eventually become standard in that new
> > users and Euphoria gurus alike won't have to search through the archive to
> > find a code snippet. Instead they'll be able to download ESL, and they'll
> > have a library with nearly all the basic routines they're likely to need.
> > Ultimately, I think it could be better than the current standard set of
> > includes since the current set lacks many frequently used functions, and
> > could be a lot better organized (i.e. math functions really don't belong
> in
> > misc.e).
> >
> > Jeff
> >
> > ----- Original Message -----
> > From: <kbochert at ix.netcom.com>
> > To: "EUforum" <EUforum at topica.com>
> > Sent: Monday, July 23, 2001 7:46 PM
> > Subject: Re: Euphoria Standard Library
> >
> >
> >
> >
> >     I have begun to post my thoughts on ESL to SourceForge. This seems to
> me
> > to be an important project, and if it is to be a Standard Library (and not
> > just
> > a 'snippet library'), then much more discussion is needed.
> >     Just what is ESL anyway?
> >
> > Karl Bochert
> >
> > off topic: I got my tax refund check today from Fresno CA.  On the first
> > 'typed' line is
> > "Austin, Texas". I wonder how that got there?
> >
> >
> >
> >
> >
> >
> >
> 
> 
> 
>

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

13. Re: Euphoria Standard Library

Here I did this for you

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/standardeu


Euman
euman at bellsouth.net



----- Original Message -----
From: <euman at bellsouth.net>
To: "EUforum" <EUforum at topica.com>
Sent: Tuesday, July 24, 2001 20:25
Subject: Re: Euphoria Standard Library


>
>
> THEY ARE IN CVS poke around the site and look
> for the three letters CVS.
>
> I like the structure.e file, this could be handy somewhere.
>
> Euman
> euman at bellsouth.net
>
>
> ----- Original Message -----
> From: <rforno at tutopia.com>
> To: "EUforum" <EUforum at topica.com>
> Sent: Tuesday, July 24, 2001 18:54
> Subject: Re: Euphoria Standard Library
>
>
> >
> >
> > Jeff:
> > I was unable to find a listing of implemented functions of ESL in the URL
> > you signaled. Would you be so kind to send me a listing or the functions
> > themselves, or otherwise specifically point to a URL where I can find them?
> > ----- Original Message -----
> > From: "Jeffrey Fielding" <jjprog at earthlink.net>
> > To: "EUforum" <EUforum at topica.com>
> > Sent: Monday, July 23, 2001 11:08 PM
> > Subject: Re: Euphoria Standard Library
> >
> >
> > >
> > >
> > > I originally proposed it as a solution to the namespace problems. For that
> > > to work, though, it would need to be standard (or it would just conflict
> > > with other people's routines, and thus not help at all). Now namespaces
> > are
> > > somewhat less of an issue, though I think it would be nice to use the
> > > namespace qualifiers as little as possible. Besides solving namespace
> > > problems, though, I hope it will eventually become standard in that new
> > > users and Euphoria gurus alike won't have to search through the archive to
> > > find a code snippet. Instead they'll be able to download ESL, and they'll
> > > have a library with nearly all the basic routines they're likely to need.
> > > Ultimately, I think it could be better than the current standard set of
> > > includes since the current set lacks many frequently used functions, and
> > > could be a lot better organized (i.e. math functions really don't belong
> > in
> > > misc.e).
> > >
> > > Jeff
> > >
> > > ----- Original Message -----
> > > From: <kbochert at ix.netcom.com>
> > > To: "EUforum" <EUforum at topica.com>
> > > Sent: Monday, July 23, 2001 7:46 PM
> > > Subject: Re: Euphoria Standard Library
> > >
> > >
> > >
> > >
> > >     I have begun to post my thoughts on ESL to SourceForge. This seems to
> > me
> > > to be an important project, and if it is to be a Standard Library (and not
> > > just
> > > a 'snippet library'), then much more discussion is needed.
> > >     Just what is ESL anyway?
> > >
> > > Karl Bochert
> > >
> > > off topic: I got my tax refund check today from Fresno CA.  On the first
> > > 'typed' line is
> > > "Austin, Texas". I wonder how that got there?
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
>
>
>
>
>

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

14. Re: Euphoria Standard Library

Click on CVS, then on right there's Browse CVS Repository link:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/standardeu/

yes, it really is hidden

----- Original Message -----
From: <rforno at tutopia.com>
Subject: Re: Euphoria Standard Library



> Jeff:
> I was unable to find a listing of implemented functions of ESL in the URL
> you signaled. Would you be so kind to send me a listing or the functions
> themselves, or otherwise specifically point to a URL where I can find
them?

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

15. Re: Euphoria Standard Library

Why not simply:

return 255 - xor_bits(a, b)  ???

----- Original Message ----- 
From: <euphoria at carlw.legend.uk.com>
To: "EUforum" <EUforum at topica.com>
Subject: Re: Euphoria Standard Library


> 
> 
> aku at inbox.as wrote:
> 
> > -- eqv_bits only for 0-255 number
> > global function eqv_bits(atom a, atom b)
> >     sequence abit, bbit, tp
> >     
> >     abit=int_to_bits(a, 8)
> >     bbit=int_to_bits(b, 8)
> >     tp=repeat(0,8)
> >     
> >     for i=1 to length(abit) do
> >         if abit[i]=bbit[i] then
> >             tp[i]=1
> >         else
> >             tp[i]=0
> >         end if
> >     end for        
> >     
> >     return bits_to_int(tp)
> > end function
> 
> Pardon me 'function'ing again... :)
> 
> global function eqv_8bits(integer a, integer b)
>     return 255-and_bits(xor_bits(a,b),255)
> end function
> 
> Carl
> 
> -- 
> Carl R White - aka - Cyrek
> eMail: carlw at legend.co.uk
>        cyrek at bigfoot.com
> URL:   www.carlw.legend.yorks.com - nothing there yet though
> 
> 
> 
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu