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

what if a function requires multiple argument-based refinements?

 [1/4] from: princepawn:lycos at: 28-Aug-2000 7:43


This is a bit of an abstract question by a person who is 1/3rd of the way through the McGraw text, but I just keep popping with questions. What if I had the following:
>> f: func [ a /ref1 arg1 /ref2 arg2] [ either ref2 [ print "ref2" ] [ print "no ref2" ] ] >> f/ref1 3 /ref2 4 1
no ref2 == 1
>>
how could I call the function "f" to make use of both refinements?

 [2/4] from: jelinem1::nationwide::com at: 28-Aug-2000 10:02


The template for the function call would be: f/ref1/ref2 <a> <arg1> <arg2> So, try:
>> f: func [ a /ref1 arg1 /ref2 arg2] [ either ref2 [ print "ref2" ] [
print "no ref2" ] ]
>> f/ref1/ref2 3 4 1
ref2 - Michael Jelinek [princepawn--lycos--com] on 08/28/2000 09:43:06 AM From: [princepawn--lycos--com] on 08/28/2000 09:43 AM Please respond to [list--rebol--com] To: [list--rebol--com] cc: Subject: [REBOL] what if a function requires multiple argument-based refinements? This is a bit of an abstract question by a person who is 1/3rd of the way through the McGraw text, but I just keep popping with questions. What if I had the following:
>> f: func [ a /ref1 arg1 /ref2 arg2] [ either ref2 [ print "ref2" ] [
print "no ref2" ] ]
>> f/ref1 3 /ref2 4 1
no ref2 == 1
>>
how could I call the function "f" to make use of both refinements?

 [3/4] from: allen:rebolforces at: 29-Aug-2000 1:16


----- Original Message ----- From: <[princepawn--lycos--com]> To: <[list--rebol--com]> Sent: Tuesday, August 29, 2000 12:43 AM Subject: [REBOL] what if a function requires multiple argument-based refinements?
> This is a bit of an abstract question by a person who is 1/3rd of the way
through the McGraw text, but I just keep popping with questions.
> What if I had the following: > > >> f: func [ a /ref1 arg1 /ref2 arg2] [ either ref2 [ print "ref2" ]
print "no ref2" ] ]
> >> f/ref1 3 /ref2 4 1 > no ref2 > == 1 > >> > > how could I call the function "f" to make use of both refinements?
Not sure if this is what you mean or not f/ref1/ref2 'a 'arg1 'arg2 or f/ref2/ref/1 'a 'arg2 'arg1 Just make sure the arguments are in the order of the refinements. Cheers, Allen K http://www.rebolforces.com

 [4/4] from: anton:globalcenter:au at: 29-Aug-2000 2:44


Hi, Like this: f/ref1/ref2 3 4 1 Hope that's what you want... Anton. [princepawn--lycos--com] wrote: