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

728"ocaml_beginners"::[] Re: Generating codes/values

Expand Messages
  • spooky_jesse <spooky_jesse@yahoo.com>
    Jan 15, 2003
      --- In ocaml_beginners@yahoogroups.com, Remi VANICAT
      <vanicat+egroups@l...> wrote:
      > "spooky_jesse <spooky_jesse@y...>" <spooky_jesse@y...> writes:
      > because, generally speaking, it's better to use already define
      > data-structure when you can : it's more readable and there are some
      > function in the stdlib for them.

      Yes, but it's surely better to define a tree as
      type 'a tree =
      Node of 'a tree * 'a * 'a tree
      | Empty

      Rather than mess with lists and 2n/2n+1 formula... what would be the
      disadvantage? Other than writing manipulation functions, which are

      let rec dfs t e =
      match t with
      Node (l, n, r) -> n = e || if dfs l e then true else dfs r e
      | Empty -> false
    • Show all 11 messages in this topic