forked from exercism/rexx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(accumulate,list-ops,strain): revise to support test functions (
- Loading branch information
Showing
9 changed files
with
23 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,3 @@ | ||
Accumulate : procedure | ||
nop | ||
return '' | ||
|
||
/* Need to implement test helpers here, not in test runner file */ | ||
Dummy : ; return '' | ||
Square : ; return ARG(1) * ARG(1) | ||
ToUpperCase : ; return UPPER(ARG(1)) | ||
ReverseToken : ; return REVERSE(ARG(1)) | ||
GenSeq : if ARG(1) > 0 then ; return STRIP(GenSeq(ARG(1) - 1) ARG(1)) ; return '' |
12 changes: 8 additions & 4 deletions
12
exercises/practice/accumulate/testlib/accumulate-funcs.rexx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
/* accumulate - Additional Test Functions */ | ||
|
||
/* | ||
Include any test-callable, non-user-visible functions in this file. | ||
These are meant to mimic lambda functions that are passed as arguments | ||
to a higher order function. In the present case, the 'Accumulate' solution | ||
procedure performs this role. | ||
*/ | ||
|
||
Dummy : ; return '' | ||
Square : ; return ARG(1) * ARG(1) | ||
ToUpperCase : ; return UPPER(ARG(1)) | ||
ReverseToken : ; return REVERSE(ARG(1)) | ||
GenSeq : if ARG(1) > 0 then ; return STRIP(GenSeq(ARG(1) - 1) ARG(1)) ; return '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
/* list-ops - Additional Test Functions */ | ||
|
||
/* | ||
Include any test-callable, non-user-visible functions in this file. | ||
These are meant to mimic lambda functions that are passed as arguments | ||
to a higher order function. | ||
*/ | ||
IsEven : ; return ARG(1) // 2 == 0 /* Predicate (Filter) */ | ||
Add1 : ; return ARG(1) + 1 /* Transformer (Map) */ | ||
|
||
/* Reducers (FoldL and FoldR) */ | ||
Multiply : ; return ARG(1) * ARG(2) /* Direction independant */ | ||
IntegerDivide : ; return ARG(2) % ARG(1) /* Direction dependant */ | ||
Concatenate : ; return ARG(2) ARG(1) /* Ditto */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
/* strain - Additional Test Functions */ | ||
|
||
/* | ||
Include any test-callable, non-user-visible functions in this file. | ||
These are meant to mimic lambda functions that are passed as arguments | ||
to a higher order function. In the present case, the 'Keep' and 'Discard' | ||
solution procedures perform this role. | ||
*/ | ||
|
||
LessThan10 : ; return ARG(1) < 10 | ||
IsOdd : ; return ARG(1) // 2 > 0 | ||
IsEven : ; return ARG(1) // 2 == 0 | ||
StartsWithZ : ; return SUBSTR(ARG(1), 1, 1) == 'z' |