From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id FAA18184; Wed, 5 Nov 2003 05:47:28 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id FAA17831 for ; Wed, 5 Nov 2003 05:47:27 +0100 (MET) Received: from bob.west.spy.net (mail.west.spy.net [66.149.231.226]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hA54lP129286 for ; Wed, 5 Nov 2003 05:47:26 +0100 (MET) Received: from [192.168.1.196] (dhcp-196.west.spy.net [192.168.1.196]) by bob.west.spy.net (Postfix) with ESMTP id 91AE258F5; Tue, 4 Nov 2003 20:47:08 -0800 (PST) In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v606) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <1BFA94CC-0F4B-11D8-85C9-000393CFE6B8@spy.net> Content-Transfer-Encoding: 7bit Cc: Caml Mailing List From: Dustin Sallings Subject: Re: [Caml-list] cadr? Date: Tue, 4 Nov 2003 20:47:07 -0800 To: Dustin Sallings X-Mailer: Apple Mail (2.606) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 cadr:01 stupid:01 hashtbl:01 figuring:01 val:01 endline:01 props:99 ocaml:01 int:01 nov:01 string:03 wrote:03 argument:03 seems:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Nov 4, 2003, at 20:30, Dustin Sallings wrote: > > This seems like a stupid question, but in my endless search for > performance, I tried converting a hashtbl to an assoc list (since it's > only got four predefined elements). I'm having trouble figuring out > what to do with this thing (other than assoc): > > ocaml > val tmp : (int * string) list = > [(1, "hi1"); (2, "hi2"); (3, "hi3"); (4, "hi4"); (5, "hi5")] > > I want to do something like this: > > List.map (function x -> print_endline(List.nth x 1)) tmp;; > > What am I missing? Props to the cardboard programmer. It's amazing how you can stare at something and not get it until you ask for help. I need (k, v) as the argument to my function. -- Dustin Sallings ------------------- 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