[clean-list] Languages Comparison
John van Groningen
johnvg@cs.kun.nl
Thu, 1 Jul 2004 13:55:45 +0200
Brent Fulgham wrote:
>
>>Hash Access (hash):
>>===================
>>
>This causes a compile error:
>cp /opt/shootout/shootout/bench/hash/hash.clean hash.icl
>/usr/bin/clm -b -nt -ou -l /usr/lib/clean/lib/ArgEnvUnix/ArgEnvC.o -I ../Include/clean -I ../../Include/clean hash -o hash.clean_run
>Type error [hash.icl,84,htNew]:"argument 2 of HashTable" cannot unify {![!Item v6!]} with v10 [v9]
>Compiling hash
>make[1]: *** [hash.clean_run] Error 1
>"(echo "BUILD COMMANDS FOR: hash.clean" ; echo ; date ; echo ; make --no-print-directory -f ../../Makefile.mb hash.clean_run) > clean_runlog.make.tmp 2>&1" Failed
>make: *** [plot] Error 1
>
>Can you look at the posted source (http://aliotto see what's wrong?
I forgot to change [] into [|] in htNew:
htNew n = { nBuckets = nprime
, table = {[|] \\ i <- [0..nprime-1]}
}
>>Spell Checker (spellcheck):
>>===========================
>>
>I've done something wrong here -- I get no output.
I hadn't noticed the second call to fend in this program. I changed
missingWords to:
missingWords f ht missing
# (line, f) = freadline f
| size line==0 = map withNewline missing
| (htHasKey line ht) = missingWords f ht missing
= missingWords f ht [line:missing]
where
withNewline s
= if (s.[size s - 1] == '\n') s (s+++"\n")
And the indentation of readWords should have been:
readWords f ht
# (line, f) = freadline f
| size line==0
= ht
= readWords f (htAdd line 1 ht)
>>Statistical Moments (moments):
>>==============================
>>
>There's a slight error here:
>
># Benchmarking: moments.clean
># Running: moments.clean_run -h 10000000 1
>L1: median: 250.000000
>
>L2: median: 250.500000
I had assumed that e in quicksort was the last index+1, but it is
the last index, so +1 has to be added in the test in quick_sort0:
quick_sort0 b e k a
| k>=b && k<=e+1
Because reading reals in Clean was still a lot slower than in c, I have
updated the runtime system patch at:
http://www.cs.kun.nl/~clean/download/Clean21/linux/patch_io_redirection.tgz
It now uses atof instead of sscanf to convert the string to a real. The
performance of the other programs in the shootout does not change compared
to the previous patch.
And a runtime system with faster stdio redirection is now also available for
windows:
http://www.cs.kun.nl/~clean/download/Clean21/windows/patch_io_redirection.7z
>>Word Frequency (wordfreq)
>>=========================
>>
>For some reason, this compiles fine, but I get this runtime error:
>
>Run time error, rule 'ht_buckets_to_list;23' in module 'wordfreq' does not match
The indentation of the last alternative of ht_buckets_to_list was
changed by accident when I replaced tabs by spaces, it should be:
ht_buckets_to_list :: *[!Item a!] [Item a] -> [Item a]
ht_buckets_to_list [|i:is] l
= ht_buckets_to_list is [i:l]
ht_buckets_to_list [|] l
= l
Regards,
John van Groningen