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

[REBOL] Passing refinements to sub functions. Re:(2)

From: bhandley:zip:au at: 12-Aug-2000 19:20

Thanks for your response Michael. Now that's an interesting idea. I think your approach is good at getting the refinements of the higher-function processed as a set, but it obscures what happens after that. My latest approach has been to use an additional refinement on the sub-function called /refinements. This has an argument of type block that contains pairs of refinement-name and refinement-value. Inspired by your work I produced this. main-func: function [/va /vb /vc][this-code refine-values r][ sub-func/refinements refinements-to-block :main-func va ] sub-func: function [/refinements refine-list][va vb vc][ do bind refine-list 'va print ["va:" va] print ["vb:" vb] print ["vc:" vc] ] refinements-to-block: function [ hi-func 'sample-refinement ][refinement-block][ refinement-block: copy [] foreach r first :hi-func [ if (refinement? r) and (r <> /local) [ append refinement-block to-set-word r append/only refinement-block to-paren bind reduce [to-word r] :sample-refinement ] ] compose refinement-block ] It results in this:
>> main-func/vb/vc
va: none vb: true vc: true Of course it doesn't handle any refinement arguments. Brett.