1. Screensaver Eup'98

ScreenSaver
**************

To all, I haven't tested it, but looking at the result I suppose it worx.
I just got the information in my head, because I read some VB document once.
Now I C that there is a demo, I suppose everybody's problem is solved.
Only be warned with future versions of Windows...

Also, I made a typo somewhere, I meant "some ASM hack", as in "some ASM
code, that hacks the system and turns the win95 keys off."

BTW If I have risked a flame war, I'm sorry, my only intentions were to
help...

Euphoria '98
**************

    (First of all, the name Euphoria '98 is a bad choice, what will a new
version be called in 2000 ?? Euphoria '00 ?? Windows '00 ??)

    Next, yes a quick port function would be handy, doing this with machine
code, is simply a bad and ugly way.
    It doesn't make Euphoria look nice at all...
    In practice it doesn't matter, but in theory, it's just wrong to use
machine code for a basic action like this..

    3D Graphics Card support, well if Robert wants to make a *lot* of money,
he should do this, it would make Euphoria the best choice for game
development. (even more if the dos32 version also is capable of this,
without the use of DirectX)
    But it would ruin the ideology of Euphoria, but you can make a wrapper
for DirectX (it are just DLL's...)
    Maybe some1 can do this... he any1 upto this (as to knowledge of
windows, DLL's & DirectX ??)

    He, and when will we be able to make a DLL out of an Euphoria library,
should be possible. (bindl my_lib.e -hide_strings)
    Not very handy, however for some they could create the dynamic part of
their program in Euphoria, and the stable, technical part in an low-level
language..
        Although I don't think there's much demand for this, however we
could shock the world creating very powerful DLL's that would be so complex
if some1 would try to write them in C++.

    Next, I am still up for a small ideology change in Euphoria:
        Atoms are the building blocks of data, sequences the way we
structure our data.
        But we are limited to a maximal size of a data-block. (atom)
        Can't they be of a unlimited bit-length ? Were a symbol defines the
way they should be interpreted ..
        You could either force an interpretation in the declaration, or let
Euphoria find the interpretation they want.
        The default interpretation would be the value as to a unsigned
numeric value...
        But at the declaration this could easily be changed to an signed.
(different way of interpretation of a value)
        But the interpretation could also be as a sequence, where all values
are of 1 or 0. (which would offer fast and clean bit-level operations)
        The way stuff is interpreted, is defined by the declaration, but can
be changed.

        integer a
        floating b
        object c
        atom d

        d = 1.5               -- saves the floating point value 1.5 to d ( 4
bytes are pointed to by d)
        d = d(integer)  -- would now be done by: bytes_to_int
(atom_to_float32(d))
        b = d
        print b                -- Would print 1.5 because b is declared
floating point value

Integer, Atom, Floating Point, etc. are all types standard in Euphoria
(then), but you could also create your own types in Euphoria.
This would be fast, because there are only a few places, were we really are
converting types, that is when we change the type (d=d(integer))
or when we output something (file I/O like puts, gets, etc.)

    And last, but not least, the set_btu function should be built-in. It
will set how many bits are used by puts (default is 8 like now). I am now
trying to offer this trough a library (eupbit.e) of which the next version
will contain this function. But off course  it is a bit slower, and it is
ugly I have to write a library for this.
    The only real problem that *can* occur, is that DOS is completely 8-bits
based, that is, we can't have a file of 17 bits can we ? But that is just
something we have to live with.
    BTW the use is that we could do stuff like  this:

    set_btu(fhandle,1)
    puts(fhandle, {1,0,1,1,0,0,1})
    close(fhandle)

    -- will write the sequence out, like it is binary...
    -- Also note that the last bit (the 8th) isn't written out, but Euphoria
will write a zero-bit out, at the end, when we close the file. (because it
can only write out bytes, because DOS is weird)

    I know people are asking much of you, but please consider it. BTW Why
isn't there a hash-table in Euphoria, I haven't quite been thinking about
it, (if it would be cleaner to have such a table or not), but why did you
decide not to... (I'm not in favor of this, not am against it, I'll give it
a bit more thought..)

Ralf
Please look for the "Plug and Pray" symbol on your new hardware..

new topic     » topic index » view message » categorize

2. Re: Screensaver Eup'98

Ralf writes:
> Why isn't there a hash-table in Euphoria, I haven't quite been
> thinking about it, (if it would be cleaner to have such a table or not),
> but why did you decide not to... (I'm not in favor of this, not am
> against it, I'll give it a bit more thought..)

Perl and a few other languages have internal hash table
mechanisms for supporting "associative arrays".
With an associative array you can say:

               x["Ralf"] = 99
               x["Euphoria"] = 25
               y = x["Ralf"] + 100    -- y is 199
etc.

i.e. there's a list of value-pairs that are associated with eachother.
To make lookups efficient for large arrays, you need to
implement it with hashing.

Yeah, I thought about it a long time ago, but I felt it
would be better for the Euphoria programmer to
define his own hash table if his application really needed it.
That way he could choose a hash function that works well
for his application, rather than relying on a general-purpose
hash function. In practice I haven't seen many Euphoria
programs where hashing would be useful. Usually the linear
search of find() does the job nicely.

Junko has been working on a hash table demo that she'll
put on the Euphoria Web page soon.

What is a hash table? Here's a quick introduction.

Suppose you have a sequence s of names and you want
to know if "Ralf" is one of the names. In Euphoria you can
use find("Ralf", s) which will start with s[1] and compare strings
until "Ralf" is found, or the end of the sequence is reached.

If your list consists of 20 or fewer strings this is probably the fastest
way to search. If your list has 1000 strings it may
take a long time. If you have hundreds or thousands of names
that you want to look up, you should consider hashing.

The idea behind "hashing" is to organize the list of 1000 as
many short lists, and then search one
of the short lists. Suppose that you took the first character
of the name (converted to upper case) and used that as
an index into a sequence of 26 sequences. All the
names beginning with 'A' would be on the first sequence, all the
names beginning with 'B' would be on the second sequence, etc.
With a nice distribution of names you might then have
26 sequences with about 1000/26 = 38 names per sequence.
After indexing to select the correct sequence, you only
have 38 names to search, not 1000.

In reality you would never get a perfect distribution.
You'd find that many more names begin with A than
with X, so the A sequence might have 60 names while the
X sequence has only 3. On top of that, many more of the
names you have to search for would begin with A, so you
would tend to search the longer sequences more often than
the shorter ones.

But at least you'd be searching far fewer than 1000 names,
and all you had to do was one quick subscript operation.

If you expected to have 10000 names on your list you would want
to have lots of "buckets" to map strings to. You
might want 2000 (say)  possible buckets. For this you
would need a "hash function" that would take any string
and compute a bucket number from 1 to 2000.

Junko has found a pretty good hash function for large numbers
of buckets. See her demo (coming soon).

Regards,
     Rob Craig
     Rapid Deployment Software

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

3. Re: Screensaver Eup'98

Robert C. writes:
>Ralf writes:
>> Why isn't there a hash-table in Euphoria, I haven't quite been
>> thinking about it, (if it would be cleaner to have such a table or not),
>> but why did you decide not to... (I'm not in favor of this, not am
>> against it, I'll give it a bit more thought..)
>
>Perl and a few other languages have internal hash table
>mechanisms for supporting "associative arrays".

[cut-away: hash-table explenation]

>Yeah, I thought about it a long time ago, but I felt it
>would be better for the Euphoria programmer to
>define his own hash table if his application really needed it.
>That way he could choose a hash function that works well
>for his application, rather than relying on a general-purpose
>hash function. In practice I haven't seen many Euphoria
>programs where hashing would be useful. Usually the linear
>search of find() does the job nicely.

Well, the reason I asked, because I kinda needed it developping my General
Purpose Preproccessor.
(Yes, I always work on 20 projects a time.. 8-))

But the way I implended my use of a hash-table is so specific, the mechanism
offered in Delphi wouldn't do the job.
Simply because I first make a hash table, and then I'll convert the
hash-table to a new hash-table variant. (don't ask, this is stuff I really
can't explain, either because the words to explain this don't exist, or
because my technical vocabulairy is too weak).

So in this case, a built-in hash mechanism wouldn't work, so it seems you
made the right discission.

>Junko has been working on a hash table demo that she'll
>put on the Euphoria Web page soon.

    I have only 1 request (well, i'll test mine specific and her's as speed
as memory efficiency, and make a choice), can the sequence holding the
hash-table be given ?
    As in this example:

    my_hash_table = set(my_hash_table, "Version", "2.0 Beta!")
    puts (1, get(my_hash_table, "Version"))

    Because I ussually need to use a hash-table in a way, it is meant for.
    For example: If you need to know how many words in your hash-table start
with an S.
    And you have split your hash table up into 26 lists.
    You can easily do this: length(my_hash_table['s'])

    See ? That's something you can't do with Perl.
    (Unless you make a Hash-table function in Perl, instead of using the
built-in)

    BTW: Is it me, or is perl a lot like Euphoria, as to language theory ?
    (I'm not talking about implentation details, like Delphi is windows only
and slower, or that Delphi does support .libs)

>Junko has found a pretty good hash function for large numbers
>of buckets. See her demo (coming soon).

    Can't wait, to see..
    (Can't wait to hack & play with it..)

    Ralf

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

Search



Quick Links

User menu

Not signed in.

Misc Menu