equal
deleted
inserted
replaced
567 b value:'arg1' value:'arg2' value:'arg3' value:'arg4' |
567 b value:'arg1' value:'arg2' value:'arg3' value:'arg4' |
568 " |
568 " |
569 |
569 |
570 "Created: 23.1.1997 / 13:35:28 / cg" |
570 "Created: 23.1.1997 / 13:35:28 / cg" |
571 "Modified: 23.1.1997 / 13:35:48 / cg" |
571 "Modified: 23.1.1997 / 13:35:48 / cg" |
|
572 ! |
|
573 |
|
574 beCurryingBlock |
|
575 "make myself a currying block; |
|
576 thats a block which, if invoked with less-than-expected arguments, |
|
577 returns another block which provides the provided argument(s) and expects the remaining args. |
|
578 Read any book on functional programming, if you dont understand this." |
|
579 |
|
580 self changeClassTo:CurryingBlock. |
|
581 ^ self |
572 ! |
582 ! |
573 |
583 |
574 beVarArg |
584 beVarArg |
575 "convert myself into a varArg block; |
585 "convert myself into a varArg block; |
576 this one has 1 formal argument, which gets the list |
586 this one has 1 formal argument, which gets the list |
1511 " |
1521 " |
1512 ! ! |
1522 ! ! |
1513 |
1523 |
1514 !Block methodsFor:'printing & storing'! |
1524 !Block methodsFor:'printing & storing'! |
1515 |
1525 |
|
1526 printBlockBracketsOn:aStream |
|
1527 aStream nextPutAll:'[]'. |
|
1528 ! |
|
1529 |
1516 printOn:aStream |
1530 printOn:aStream |
1517 "append a a printed representation of the block to aStream" |
1531 "append a a printed representation of the block to aStream" |
1518 |
1532 |
1519 |h sel methodClass| |
1533 |h sel methodClass| |
1520 |
1534 |
1529 aStream nextPutAll:' ??? (optimized)'. |
1543 aStream nextPutAll:' ??? (optimized)'. |
1530 ^ self |
1544 ^ self |
1531 ]. |
1545 ]. |
1532 |
1546 |
1533 "a full blown block (with home, but without method)" |
1547 "a full blown block (with home, but without method)" |
1534 |
1548 self printBlockBracketsOn:aStream. |
1535 aStream nextPutAll:'[] in '. |
1549 aStream nextPutAll:' in '. |
1536 h := self methodHome. |
1550 h := self methodHome. |
1537 sel := h selector. |
1551 sel := h selector. |
1538 "/ old: |
1552 "/ old: |
1539 "/ home receiver class name printOn:aStream. |
1553 "/ home receiver class name printOn:aStream. |
1540 "/ new: |
1554 "/ new: |
1945 ! ! |
1959 ! ! |
1946 |
1960 |
1947 !Block class methodsFor:'documentation'! |
1961 !Block class methodsFor:'documentation'! |
1948 |
1962 |
1949 version |
1963 version |
1950 ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.128 2003-03-31 17:52:01 cg Exp $' |
1964 ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.129 2003-03-31 18:11:06 cg Exp $' |
1951 ! ! |
1965 ! ! |
1952 |
1966 |
1953 Block initialize! |
1967 Block initialize! |