--- a/Block.st Fri May 07 14:37:03 2010 +0200
+++ b/Block.st Mon May 10 12:56:48 2010 +0200
@@ -645,12 +645,34 @@
beCurryingBlock
"make myself a currying block;
- thats a block which, if invoked with less-than-expected arguments,
+ that's a block which, if invoked with less-than-expected arguments,
returns another block which provides the provided argument(s) and expects the remaining args.
- Read any book on functional programming, if you dont understand this."
+ Read any book on functional programming, if you don't understand this."
self changeClassTo:CurryingBlock.
^ self
+
+ "
+ |b b1 b2 b3|
+
+ b := [:a :b :c | a + b + c] beCurryingBlock.
+ b numArgs.
+ b value:1 value:2 value:3.
+
+ b1 := b value:10.
+ b1 numArgs.
+ b1 value:2 value:3.
+
+ b2 := b value:10 value:20.
+ b2 numArgs.
+ b2 value:3.
+
+ b3 := b1 value:20.
+ b3 numArgs.
+ b3 value:3.
+ "
+
+ "Modified: / 10-05-2010 / 12:56:20 / cg"
!
beVarArg
@@ -2900,11 +2922,11 @@
!Block class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.176 2010-04-23 13:33:01 mb Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.177 2010-05-10 10:56:48 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.176 2010-04-23 13:33:01 mb Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.177 2010-05-10 10:56:48 cg Exp $'
! !
Block initialize!