At 15:03 15/10/03 +1300, Tom Pledger wrote:
If you're willing to introduce *one* more variable in a let or where,
try:

    joinVarBindings vb1 vb2
        | vbNull vb1 = vb2
        | vbNull vb2 = vb1
        | otherwise  = this
        where
            this = VarBinding
             { vbMap  = head . filter isJust . flist [ vbMap vb1, vbMap vb2 ]
             , vbEnum = map (\v -> (v,fromJust (vbMap this v))) $
                        boundVars vb1 `union` boundVars vb2
             , vbNull = False
             }

Ah, yes, that's neater.


Thanks.

#g


------------ Graham Klyne For email: http://www.ninebynine.org/#Contact

_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to