caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "David McClain" <dmcclain@azstarnet.com>
To: <caml-list@pauillac.inria.fr>,
	"Jacques GARRIGUE" <garrigue@kurims.kyoto-u.ac.jp>
Subject: Re: Map is not tail recursive
Date: Wed, 13 Jan 1999 20:49:00 -0700	[thread overview]
Message-ID: <001001be3f70$ec08a870$210148bf@dylan> (raw)

>(particularly if you inline it).

Is there a way to explicitly inline functions, other than cut and paste?

- DM

-----Original Message-----
From: Jacques GARRIGUE <garrigue@kurims.kyoto-u.ac.jp>
To: caml-list@pauillac.inria.fr <caml-list@pauillac.inria.fr>
Date: Wednesday, January 13, 1999 04:27
Subject: Re: Map is not tail recursive


>From: "David McClain" <dmcclain@azstarnet.com>
>
>> 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
> <A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>
>




             reply	other threads:[~1999-01-14  8:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-14  3:49 David McClain [this message]
1999-01-14  9:49 ` The way Ocaml inlines Juan Jose Garcia Ripoll
  -- strict thread matches above, loose matches on Subject: below --
1999-01-13 17:40 Map is not tail recursive Marc Rouaix
1999-01-12 12:06 Marc Rouaix
1999-01-11 18:51 David McClain
1999-01-13  8:47 ` Jacques GARRIGUE
1999-01-10 10:49 Juan Jose Garcia Ripoll
1999-01-11 11:03 ` Xavier Leroy
1999-01-12 11:49   ` William Chesters

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='001001be3f70$ec08a870$210148bf@dylan' \
    --to=dmcclain@azstarnet.com \
    --cc=caml-list@pauillac.inria.fr \
    --cc=garrigue@kurims.kyoto-u.ac.jp \
    /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;
as well as URLs for NNTP newsgroup(s).