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

[REBOL] Re: if and parens

From: joel:neely:fedex at: 5-Oct-2002 20:10

Hi, Laurent, Infix (operators) has higher precedence than prefix (function evaluation), so the expression if get in info? to-file elt 'type = 'file [print elt] is actually treated by REBOL in the same order as if parenthesized as if get (in (info? (to-file elt)) ('type = 'file)) [print elt] that is, the IN is applied to the INFO? object, but the second argument is the LOGICAL! value FALSE, which, as the error message stated, is not a WORD! value. Since you just want to exclude subdirectories from the list of contents of the current directory, you could write foreach elt read %. [if not dir? elt [print elt]] instead. -jn- Laurent Giroud wrote:
> Hi everyone again, > > I have a little "problem" that I encounter quite frequently with 'if
...
> 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]]
...
-- ; Joel Neely joeldotneelyatfedexdotcom REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] { | e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]