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

4890unbound value

Expand Messages
  • Java
    Nov 1 3:59 AM
    • 0 Attachment

      I'm writing a couple of modules implementing a binary tree. Im
      proceeding adding a functions one by one becouse of checking with ocaml
      interpreter. Here the code:

      [start code]

      module type BALBERO =
      type 'a tree

      exception EmptyEx

      val emptytree: 'a tree

      val insert: 'a * 'a tree -> 'a tree

      val search: 'a * 'a tree -> bool

      ---Semantic implementation---
      [...] (*insert function works fine*)

      let rec search (x, tree) =
      match tree with
      | Empty -> false
      | Node (y, left, rigth) ->
      if (x = y) then true else
      if (x > y) then search(x, right)
      else search(x, left)


      [end code]

      For the function "search" the interpreter returns me this error:
      Characters 475-480:
      Unbound value right

      Why?? The insert function is very similar to search and works fine.

      Thanks by now
    • Show all 15 messages in this topic