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

7024Type mismatch but why?

Expand Messages
  • Christian Lerrahn
    Jan 4, 2007
      Hi,
      I have this snippet of code that drives me crazy. I just don't see why
      my types are mismatching. It's rather ugly code anyway but I couldn't
      think of a nice way of putting it so far. The error I get is

      # Characters 107-578:
      ....match (ghostptcls) with
      [] -> newghostparts
      | (gp :: gplist) -> let newgp = { r = gp; v = opart.v; ... } in
      let newlist = newgp :: newghostparts in newgparticles opart
      gplist newlist..
      This expression has type Particle.properties list but is here
      used with type Particle.properties list -> Particle.properties list

      The code is

      (* creates new ghostparticles *)
      let rec newgparticles opart ghostptcls ?(newghostparts = [opart]) =
      match (ghostptcls) with
      [] -> newghostparts
      | (gp :: gplist) -> let newgp = { r = gp; v = opart.v; ... } in let
      newlist = newgp :: newghostparts in newgparticles opart gplist newlist

      (* wrapper for ghostparticles routine in Vectorop *)
      let get_ghostparticles ~particle:particle =
      let list_of_ghostparticles = Vectorop.ghostparticle_loc particle.r
      in newgparticles particle list_of_ghostparticles []

      opart should be a single particle of type Particle.properties.

      Any hints what I am doing wrong?

      TIA,
      Christian
    • Show all 5 messages in this topic