[Oberon] How to mimic an associative array
Duke Normandin
dukeofperl at ml1.net
Thu Dec 2 19:59:08 CET 2010
On Thu, 2 Dec 2010, Aubrey.McIntosh at Alumni.UTexas.Net wrote:
Hello Aubrey...
> Duke,
>
> A strong part of the Oberon culture is that things like this are kept
> in libraries and out of the language, to avoid a bloated language and
> slow development environment. That is, almost everything is "not
> built in" to Oberon. This even applies to basic input/output.
I agree! I pointed Jan to Perl's CPAN with that very thing in
mind. Millions of Perl modules to do various things. Code re-use!
Exactly like what is advocated by the Oberon culture. I'm simply
surprised that there is no Oberon analog for Perl's CPAN, where I
could have gone and found a "hash" module, all shined up, ready to
go. :)
> You have taken a strong first step to identify a data structure. In
> addition to your data structure, you will need to have some methods,
> or procedures that work on the data structure.
>
> These are some that come to mind in a minute of thinking.
>
> TYPE
> myHashPtr = POINTER TO myHash;
>
> PROCEDURE Init* (VAR t : myHash); This probably just sets t := NIL,
> or does a NEW(t), or such.
> PROCEDURE Enter* (VAR t: myHash, key: keyType, value: valueType);
> PROCEDURE This* (t : myHash, key: keyType, VAR valueType);
> PROCEDURE Remove* (VAR t: myHash, key : keyType);
> PROCEDURE Enumerate* (t : myHash, handler : someProcType);
Thanks for pointing me on the right track! Between you, Sven and Doug,
and others, I should be able to cobble a decent CGI module - the goal
of this exercise for me.
> You can write a different implementation module of these methods every
> Saturday morning for a while to practice your Oberon skills. Perhaps
> a brute force memory list, perhaps a disk based B tree, perhaps
> something that spends all night trying to calculate perfect hashes for
> the table as it is at that moment.
I get it! Instead of practicing my survival skills on Saturday
morning, by visiting the "Honey Do! jar, you want me to practice my
Oberon pointers, records, and array skills :? One Saturday of _that_,
and I'll be hash! ;)
Much obliged!
--
Duke
More information about the Oberon
mailing list