Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (*---------------------------------------------------------------------------------///*)
  2.         | ListP ps => case ex of
  3.             List xs => case (xs, ps) of
  4.                 (h::nil, g::nil) => match(h, g)
  5.                 | (h::t, g::r) => case match(h,g) of
  6.                     SOME v => SOME (v @ (case match(List t, ListP r) of
  7.                         SOME a => a
  8.                         ))
  9.                     | NONE => NONE            
  10.    
  11. (*--------------------------------------PAIR-------------------------------------------///
  12.         | PairP([a1, a2]) => case ex of
  13.             Pair([b1,b2]) => if(match(b2, a2) = NONE orelse match(b1, a1) = NONE) then NONE else SOME (Option.valOf(match(b1, a1)) @ Option.valOf(match(b2, a2))) *)
  14.  
  15. (*ERROR*)
  16. D:\FRI\FP\Seminar\seminar.sml:72.35-81.162 Error: types of rules don't agree [tycon mismatch]
  17.   earlier rule(s): ''Z list option -> ''Z list option
  18.   this rule: pattern -> ''Z list option
  19.   in rule:
  20.     PairP (a1 :: a2 :: nil) =>
  21.       (case ex
  22.         of Pair (b1 :: b2 :: nil) =>
  23.              if (match (b2,a2) = NONE) orelse (match (b1,a1) = NONE)
  24.              then NONE
  25.              else SOME
  26.                     (Option.valOf (match (b1,a1)) @
  27.                        Option.valOf (match (b2,a2))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement