From: "Mattias Waldau" <mattias.waldau@abc.se>
To: "'Markus Mottl'" <markus@oefai.at>,
"'Christophe TROESTLER'" <debian00@tiscalinet.be>
Cc: "'O'Caml Mailing List'" <caml-list@inria.fr>
Subject: RE: [Caml-list] The invert Benchmark
Date: Wed, 17 Apr 2002 23:19:19 +0200 [thread overview]
Message-ID: <001701c1e655$896e9960$0200a8c0@gateway> (raw)
In-Reply-To: <20020417203039.GA3339@fichte.ai.univie.ac.at>
I followed his Python-code, which was much better than
his Ocaml-code.
/mattias
module Ord_string =
struct
type t = string
let compare = compare
end ;;
module S = Splay.Make(Ord_string) ;;
let tab_pattern = (Str.regexp_string "\t") in
let b = S.create () in
try
while true do
let line = input_line stdin in
match Str.split tab_pattern line with
| v :: k :: _ ->
(try
S.set b k (v :: (S.find b k))
with Not_found ->
S.set b k [v])
| _ -> failwith "Not a pair"
done
with End_of_file -> ();
S.iter (fun k vs ->
let vs = List.sort compare vs in
Printf.printf "%s\t%s\n" k (String.concat "\t" vs))
b ;;
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next prev parent reply other threads:[~2002-04-17 21:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-17 18:26 Christophe TROESTLER
2002-04-17 20:04 ` Xavier Leroy
2002-04-17 20:28 ` Nadji.Gauthier
2002-04-18 19:07 ` [Caml-list] " Christophe TROESTLER
2002-04-18 19:21 ` Mattias Waldau
2002-04-17 20:13 ` [Caml-list] " Remi VANICAT
2002-04-17 20:30 ` Markus Mottl
2002-04-17 21:19 ` Mattias Waldau [this message]
2002-04-18 9:11 ` Jean-Christophe Filliatre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='001701c1e655$896e9960$0200a8c0@gateway' \
--to=mattias.waldau@abc.se \
--cc=caml-list@inria.fr \
--cc=debian00@tiscalinet.be \
--cc=markus@oefai.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox