From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA06622 for caml-redistribution; Thu, 14 Jan 1999 09:46:42 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id EAA16564 for ; Thu, 14 Jan 1999 04:48:27 +0100 (MET) Received: from cepheus.azstarnet.com (cepheus.azstarnet.com [169.197.56.195]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id EAA20793 for ; Thu, 14 Jan 1999 04:48:25 +0100 (MET) Received: from dylan (dialup22ip007.tus.azstarnet.com [169.197.40.135]) by cepheus.azstarnet.com (8.9.1a/8.9.1a) with SMTP id UAA14992; Wed, 13 Jan 1999 20:46:27 -0700 (MST) X-Sent-via: StarNet http://www.azstarnet.com/ Message-ID: <001001be3f70$ec08a870$210148bf@dylan> From: "David McClain" To: , "Jacques GARRIGUE" Subject: Re: Map is not tail recursive Date: Wed, 13 Jan 1999 20:49:00 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Sender: weis >(particularly if you inline it). Is there a way to explicitly inline functions, other than cut and paste? - DM -----Original Message----- From: Jacques GARRIGUE To: caml-list@pauillac.inria.fr Date: Wednesday, January 13, 1999 04:27 Subject: Re: Map is not tail recursive >From: "David McClain" > >> Juan got me thinking about this problem... So here is a solution: >> >> external rplacd : 'a list -> 'a list -> unit = "rplacd" >> >> -- and the external C code is >> >> value rplacd(value cell, value item) >> { >> Store_field(cell,1,item); >> return Val_unit; >> } > >While this is undocumented, there is a slightly simpler way to define >rplacd, wihout using C. This should be faster in most cases >(particularly if you inline it). > >let rplacd (cell : 'a list) (item : 'a) = > Obj.set_field (Obj.repr cell) 1 (Obj.repr item) > >As for using the null pointer to have more efficient representations >in data-structures, this is theoretically possible (and I believe that >Xavier Leroy had an implementation with it), but this is not in the >current version of ocaml. > > Jacques > >--------------------------------------------------------------------------- >Jacques Garrigue Kyoto University garrigue at kurims.kyoto-u.ac.jp > JG >