Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] TECHNICAL ESSAY/CHALLENGE(s) - "Expression Based"? Re:(4)

From: joel:neely:fedex at: 3-Oct-2000 8:31

[Al--Bri--xtra--co--nz] wrote:
[...code snipped...]
> Note how small the actual tally object is: "[Total: 0]". Also note that the > binding is used like a dialect, but allows arbitrary Rebol script to be > used. >
Another interesting way to construct REBOL code! (Although I'd be tempted to do this...
>> using: func [obj [object!] blk [block!]] [
[ do bind blk in obj 'self [ ] ...then...
>> using Tally! [
[ use [diffs evens odds] [ [ diffs: make-Tally [ evens: make-Tally [ odds: make-Tally [ foreach num bunchanums [ [ either even? num [ [ Up/by diffs num [ Up/by evens num [ ][ [ Down/by diffs num [ Up/by Odds num [ ] [ ] [ print Now? diffs [ print Now? evens [ print Now? odds [ ] [ ] 26 226 200 ...if I were planning to use that technique at least once.) This technique allows me to select an object within which to work...
>> using Tally! [
[ use [tallies] [ [ tallies: copy [] [ loop 3 [append tallies make-Tally] [ foreach num bunchanums [ [ Up/by pick tallies (num // 3 + 1) num [ ] [ foreach tally tallies [print Now? tally] [ ] [ ] 132 212 82 ...but still seems to require that pesky duplication of refinement and argument in the diffs case... either even? num [Up/by diffs num][Down/by diffs num] which Challenge#2 called for eliminating. You've all been very kind to supply very interesting ideas in response to this little puzzle! To sum up thus far, it appears that handling these three cases 1) same object, same method, computed argument(s) 2) same object, computed method, same argument(s) 3) computed object, same method, same argument(s) involves the use of three (radically!) different techniques. I'm very grateful for the responses thus far. I would be even happier if we could come up with a single general approach that would handle all three of these cases. -jn-