Question: Haskell Programming -- Problem 10. -- The next question concerns writing a function that collects all of the propositional -- variables in a Prop. You
Haskell Programming
-- Problem 10. -- The next question concerns writing a function that collects all of the propositional -- variables in a Prop. You will write a function, vars, that takes a Prop as input and -- produces a list of String as output. The type template for this function is below. -- Review "HaskellForGrownups" slides and, in particular, "How to Write a Haskell Function" -- slides. The smart way to do this problem is in a stepwise fashion. That is, (1) replace -- a single undefined with what you think the correct definition is and, then, (2) load that -- into ghci to see if it typechecks. Your answer may produce repeated entries. For example, -- evaluating (vars prob6) with ghci may return ["a","b","c","a","b","c"]. vars :: Prop -> [String] vars (Atom p) = undefined vars (Not p) = undefined vars (Imply p1 p2) = undefined vars (And p1 p2) = undefined
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
