Loading ...
Sorry, an error occurred while loading the content.

Re: "ocaml_beginners"::[] linked list again

Expand Messages
  • james woodyatt
    ... That library was renamed when I moved it to SourceForge. People kept chiding me about the name I chose, and they kept asking for something more
    Message 1 of 15 , Jul 31, 2005
    • 0 Attachment
      On 31 Jul 2005, at 19:35, Jon Harrop wrote:
      >
      > If you don't mind an imperative data structure then use the built-
      > in Queue
      > module. If you're after a functional data structure then browse the
      > web.
      > James Woodyatt has an implementation in his Pagoda Core Foundation
      > (CF)
      > library, for example.

      That library was renamed when I moved it to SourceForge. People kept
      chiding me about the name I chose, and they kept asking for something
      more descriptive. It's now called the OCaml Network Application
      Environment (OCaml NAE). More descriptive of my intentions. Not as
      cute.

      Here is the project page on SourceForge:

      <http://sf.net/projects/ocnae/>

      The code is available under a two-clause BSD license. Somebody
      apparently made a Debian package for it, but I don't know which older
      version is in what distribution. I just released an update for it
      last week, but the deque module hasn't changed in forever.

      ----
      p.s. the Cf_queue module has a functional interface, but its internal
      tree structure uses lazy evaluation-- so I can't claim it is a
      "purely" functional implementation. It does, however, offer
      persistence, and it's measurably faster than the best pure functional
      real-time deque algorithm I could find.


      --
      j h woodyatt <jhw@...>
      that's my village calling... no doubt, they want their idiot back.
    • Damien Guichard
      Hi Jerry, Seems to me node option is the type you want: type node = { mutable value:int; mutable pred: node option; mutable succ: node option; };; - damien
      Message 2 of 15 , Sep 12, 2005
      • 0 Attachment
        Hi Jerry,

        Seems to me "node option" is the type you want:

        type node = {
        mutable value:int;
        mutable pred: node option;
        mutable succ: node option;
        };;

        - damien

        --- In ocaml_beginners@yahoogroups.com, Jerry He <rebound1618@y...> wrote:
        > Hi,
        > I'm attempting to create a non-cyclical doubly
        > linked list without much success.
        >
        > Here's some code that I thought might work
        >
        > type snode = { mutable value:int; mutable prev: node;
        > mutable next: node };;
        > type node = NULL | Node of snode;;
        >
        > But, of course, I can't create one without the other.
        >
        > Any help or comment on this would be appreciated
        >
        > -Jerry
        >
        >
        >
        >
        > ____________________________________________________
        > Start your day with Yahoo! - make it your home page
        > http://www.yahoo.com/r/hs
      • Seth J. Fogarty
        That is the better option, but you can mutually define types # type a = bool and b = a;; ... -- Seth Fogarty
        Message 3 of 15 , Sep 12, 2005
        • 0 Attachment
          That is the better option, but you can mutually define types

          # type a = bool
          and b = a;;


          On 9/12/05, Damien Guichard <alphablock@...> wrote:
          >
          > Hi Jerry,
          >
          > Seems to me "node option" is the type you want:
          >
          > type node = {
          > mutable value:int;
          > mutable pred: node option;
          > mutable succ: node option;
          > };;
          >
          > - damien
          >
          > --- In ocaml_beginners@yahoogroups.com, Jerry He <rebound1618@y...> wrote:
          > > Hi,
          > > I'm attempting to create a non-cyclical doubly
          > > linked list without much success.
          > >
          > > Here's some code that I thought might work
          > >
          > > type snode = { mutable value:int; mutable prev: node;
          > > mutable next: node };;
          > > type node = NULL | Node of snode;;
          > >
          > > But, of course, I can't create one without the other.
          > >
          > > Any help or comment on this would be appreciated
          > >
          > > -Jerry
          > >
          > >
          > >
          > >
          > > ____________________________________________________
          > > Start your day with Yahoo! - make it your home page
          > > http://www.yahoo.com/r/hs
          >
          >
          >
          >
          > Archives up to August 22, 2005 are also downloadable at
          > http://www.connettivo.net/cntprojects/ocaml_beginners/
          > The archives of the very official ocaml list (the seniors' one) can be
          > found at http://caml.inria.fr
          > Attachments are banned and you're asked to be polite, avoid flames etc.
          >
          >
          >
          > ________________________________
          > YAHOO! GROUPS LINKS
          >
          >
          > Visit your group "ocaml_beginners" on the web.
          >
          > To unsubscribe from this group, send an email to:
          > ocaml_beginners-unsubscribe@yahoogroups.com
          >
          > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
          >
          > ________________________________
          >


          --
          Seth Fogarty sfogarty@[gmail.com|rice.edu|livejournal]
          Neep-neep at large AIM: Sorrath
          "I know there are people in this world who do not love their fellow
          human beings - and I hate people like that" --Tom Lehrer.
        Your message has been successfully submitted and would be delivered to recipients shortly.