2006-09-11
One of the more oft-requested lambdabot
features finally got implemented today: persistent value bindings. So
lambdabot behaves more like a communal Haskell session.
Let's define a useful combinator:
lambdabot> let eq f g = \x -> f x == g (x::[Int])
Defined.
Which we can refer to as a local binding:
lambdabot> > L.eq head last [1..10]
False
Or pass to QuickCheck:
lambdabot> check head `L.eq` last
Exception: Prelude.head: empty list
Telling us our property isn't quite right. Let's fix that:
lambdabot> let eqnotnull f g = \x -> (not (null x)) ==> f x == g (x::[Int])
Defined.
Which is much more useful:
lambdabot> check head `L.eqnotnull` last
Falsifiable, after 0 tests: [2,0]
Or even something True:
lambdabot> check minimum `L.eqnotnull` (head . sort)
OK, passed 500 tests.
I like having the machine figure stuff like this out for me.
/home ::
/haskell ::
permalink ::
rss
|