View the step-by-step solution to:

-- Problem 10. -- The next question concerns writing a function that collects all of the propositional -- variables in a Prop.

-- 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

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question