addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupsimageimagesinstagramlinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1outlookpersonJoin Group on CardStartprice-ribbonImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruseryahoo

Geeknight Dallas Message Board › Haskell video excercises

Haskell video excercises

R. J.
RHJensen
Fort Worth, TX
Post #: 5
This is the 'homework' from video 4 (functions).

Define && using double dispatch. (This is on our hypothetical Bool class).

Exercises:

  • Consider a function safetail that behaves in the same way as tail, except that safetail maps the empty list to the empty list, whereas tail gives an error in this case. Define safetail using:

    • a conditional expression
    • guarded equations
    • pattern matching

  • Give three possible definitions for the logical or operator (||) using pattern matching.
  • Redefine the following version of (&&) using conditionals rather than patterns:
  • Do the same for the following version:



Powered by mvnForum

Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy