[clean-list] questions

Attila Ondi aondi@fit.edu
Wed, 19 Nov 2003 19:45:19 -0500


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello everyone,

I'm somewhat new to Clean and especially to this list, so please take
easy on me :)

I have some questions regarding the language:


~ 1) Is there any library for abstract data types? I'm looking for
something that provides Hashtables, Perfectly ballanced binary trees and
such. I could implement those using the basic types in StdEnv (lists,
arrays ans so), but I doubt it will be as efficient as possible and also
might not be too reliable. Can I find such a library somewhere?


~ 2) How can I handle Strings easily? There are not too much functions
that operate on Strings in StdEnv. What I was trying to acieve is to
parse a String according to some format. More specifically I had datatypes
::Icon = I Int Int
::Region = R Int Int Int Int
::Click = M Int Int

The input string to process had a "I x y" "R x1 y1 x2 y2" or "M x y" in
each line, where the 'x's and 'y's are actual integer numbers. At the
end of the parsing I wanted to have three lists with types [Icon],
[Region], and [Click] respectively.

I could manage to use list comprehension to convert the String to [Char]
then use basic toolbox functions to cut the list to "words" along white
spaces, then based on the first Char of each input line, parse to the
corresponding result list based on toInt.

I very much doubt that this is the mmost efficient way to parse a string
and convert it to my data types. Unfortunately I cannot change the input
to something more conveniant... (The described problem is based on an
ACM programming contest problem I'm trying to solve with Clean now.)

I was hoping to be able to use a method somewhat similar to Haskell's reads.


~ 3) Why doesn't Clean have an interactive command-line interpreter, just
like GHC does for Haskell? Sometimes it would be easier to play with the
language via an interactive way.

I like Clean better than Haskell (especially because of the Uniqueness
types as opposed to Haskell's IO monad), but it seems that it's either
less conveniant to use Clean based on the above issues, or (and I hope
this is the truth) I was much too incompetent in using the language.

Thanks for every help,
Attila Ondi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBP7wOnh5adN4t/v+OAQKIBgP/fifUr08WzUE/XmFW4ecB5K95iNALDwmp
ucvs0NMuhLU5swTy8rRAbjV6pr0cbg66kq2UccakOglNHp1LURpzU1JE07CuRqfp
1zI4+Glg85v4VVmvVnhmH+VP31kkADS/A5Fn6Qef4wuCYrfohAwtZ8BjEsg6iN1B
xbmdAbUG/xs=
=JKxe
-----END PGP SIGNATURE-----