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

[REBOL] Re: Newbie expression question

From: joel:neely:fedex at: 11-Oct-2003 22:30

Ooops! I hit the send button before finishing... [SunandaDH--aol--com] wrote:
>>if length? tlist/data > 1000 > > Try these: > > if (length? tlist/data) > 1000 > or > if 1000 <= length? tlist/data > > (I always go for the (...) solution as I can't be bothered with reversing > boolean operations. >
I've been experimenting lately with restricting myself to using only < and <= to express ordered comparisons. There were a couple of initial reasons for the experiment: - as the number line (conventionally pictured, anyway!) contains smaller values on the left and larger values on the right, I wanted to test the mnemonic value of writing expressions with smaller/left and larger/right ordering; - it gives compound and range conditions a natural form: ... all [lowerlimit <= testvalue testvalue <= upperlimit] ... which resembles the normal mathematical notation: lowerlimit <= testvalue <= upperlimit (the only languages I can recall at the moment that understand that notation would be Python and Icon). - it's an interesting psychological experiment; mathematically the two expressions (e.g.) a < b and b > a are equivalent, so why is it that so many of us have learned to feel more comfortable with foo > 100 than 100 < foo in our programs? Is it because our "natural language" habits make us subconsciously think of the expresson(s) above as being more about FOO as the subject of the sentence, rather than about the relationship between two equally-important values? At any rate, it also has the interesting side effects that many REBOL expressions no longer need parentheses. It's also interesting to see the effect on one's thinking from deliberately breaking almost sub- conscious habits. -jn-