SHARE
TWEET

Untitled

a guest Jun 19th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. | nub (map fst (parse s)) /= map fst (parse s)      = error "Output wire defined more than once"             -- Placeholder (stub) until you do your own
  2.    
  3.     | otherwise                                         = parse s
  4.  
  5.     --Takes in a list of strings which contains everything on the left side
  6.     --and a circuit, which has already been parsed
  7. classify :: [String] -> Circuit -> Circuit
  8. classify [] []
  9.     = []
  10. classify x (y1,(NOT (w z))):ys
  11. --z isnt on the left, therefore an input
  12.     | z `notElem` x = (y1,(NOT (IN z))):(classify x ys)
  13. --z is an output wire
  14.     | z `elem` x    = (y1,(NOT (OUT z))):(classify x ys)
RAW Paste Data
Top