[racket] Style or and/define

From: Sean Kanaley (skanaley at gmail.com)
Date: Tue Jun 11 13:21:28 EDT 2013

This code appears to be equivalent to using Maybe in Haskell, with the 
same kind of indentation issues:

case char-width of
   Nothing -> Nothing
   Just n -> do stuff, get new Maybe, case new-maybe of
      Nothing -> Nothing
      Just x -> do stuff ... etc...

In Haskell, one composes these with bind, which combines the "do stuff" 
portion with the unwrapped Just value, otherwise continues returning 
false forever (which due to laziness is the same as the first cond 
returning #f).

In Racket, one could implement either monads altogether or specifically 
one to handle chaining functions that might return #f.

e.g., instead of cond:

(maybe
    (do something)
    (bind new possibly false value)
    (do something with that value)
    etc.)

Posted on the users mailing list.