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

[REBOL] Re: if and parens

From: al:bri:xtra at: 6-Oct-2002 11:21

> While I understand that in some cases parens may be necessary to avoid
ambiguities, in the following example I fail to see why they are needed :
> this simply prints the list of files in the current folder and works quite
fine :
> >> foreach elt read %. [if (get in info? to-file elt 'type) = 'file [print
elt]]
> but when removing the parens we get : > > >> foreach elt read %. [if get in info? to-file elt 'type = 'file [print
elt]]
> ** Script Error: in expected word argument of type: word > ** Where: halt-view > ** Near: if get in info? to-file
That's because the '= is infix; it grabs the left and right arguments, as it were. Try this instead: foreach elt read %. [if 'file = get in info? to-file elt 'type [print elt]] Andrew Martin ICQ: 26227169 http://valley.150m.com/