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

[REBOL] Re: can't quite get it right...

From: joel:neely:fedex at: 7-Sep-2001 16:00

Hi, Carl, Carl Read wrote:
> On 08-Sep-01, Carl Read wrote: > > >> Does it matter to experts very much if you use: > > >> either all [(ch >= #"A") (ch <= #"Z")] > >> [return true] > >> [return false] > > >> versus: > > >> return either all [(ch >= #"A") (ch <= #"Z")][true][false] > > >> verus: > > >> all [(ch >= #"A") (ch <= #"Z")] > > > I much prefer the latter... >
Door Number Three, with a couple of slight variations: all [#"A" <= ch ch <= #"Z"] seems (to my eye, at least) to emphasize ch between #"A" and #"Z" a bit more than the vanilla option three preceding. Unfortunately, there are situations in which a LOGIC! value is expected -- which ALL may not supply -- so one may have to resort to saying to-logic all [#"A" <= ch ch <= #"Z"] (e.g., when the expression is used as an argument to a function that expects a LOGIC! argument...) My experience is that long conditional expressions which end up explicitly returning TRUE or FALSE almost always can be improved (and almost always betray that the writer is not comfortable with the fact that LOGIC!-valued expressions should be just as legitimate as INTEGER!-valued ones -- regardless of language). -jn- -- ------------------------------------------------------------ Programming languages: compact, powerful, simple ... Pick any two! joel'dot'neely'at'fedex'dot'com