Re: variables in 'let rec'

From: Max Skaller (maxs@in.ot.com.au)
Date: Tue Mar 28 2000 - 03:03:36 MET DST

  • Next message: Julian Assange: "Re: to have labels or not"

    Damien Doligez wrote:
    >
    > >From: Max Skaller <maxs@in.ot.com.au>
    > >
    > >Alternatively, you can just use
    > >
    > > let rec x' () = ...
    > > and ...
    > > let x = x()
    > >
    > >in lieu of what you really wanted: (that is,
    > >there is a workaround).
    >
    > But that doesn't work for "let rec x = 1 :: x", which is the most
    > interesting feature of O'Caml's recursive value definitions.

            It doesn't?

            let rec x'() = 1 :: x()'
            let x = x'()

    Seems to work fine. Of course, this will loop forever in an eager
    language: the result is an infinite list of 1s.

    -- 
    John (Max) Skaller at OTT [Open Telecommications Ltd]
    mailto:maxs@in.ot.com.au      -- at work
    mailto:skaller@maxtal.com.au  -- at home
    



    This archive was generated by hypermail 2b29 : Tue Mar 28 2000 - 20:35:57 MET DST