Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: Order of operations problem?
Pages: [1] Print
Author Topic: Order of operations problem?  (Read 222 times)
mhillmer
Newbie
*
Offline Offline

Posts: 2


View Profile
Order of operations problem?
« on: January 24, 2005, 10:28:38 PM »

Trying to understand blocks and data formats, I try this in the console:

btime: [12:00]

if first btime > now/time [ print "before noon" ]

results in:
** Script Error: Expected one of: block! - not: time!
** Where: halt-view
** Near: if first btime > now/time

However, this:
if now/time < first btime [ print "before noon" ]

Works just fine.

However, this also works:
if btime/1 > now/time [ print "nefore noon" ]
 
(this also works with the btime/1 and now/time reversed)

Seems to me that all of these statements should work, since:
type? first btime
time!
type? now/time
time!
type btime/1
time!

are all true statements... unless I'm missing something about the way Rebol is handling the order of operations?

Matt
 
Logged
Gabriele
Full Member
***
Offline Offline

Posts: 182


View Profile WWW
Order of operations problem?
« Reply #1 on: January 25, 2005, 05:41:16 AM »

Infix operators cannot be smart enough to figure out by themselves what you want them to do. You need to use:

Code:
if (first btime) > now/time [print "before noon"]

because, otherwise, REBOL sees it as:

Code:
if first (btime > now/time) [print "before noon"]
Logged
Pages: [1] Print 
Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: Order of operations problem?
Jump to:  

  
Quick Search...

Advanced search
  
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 20, 2008, 09:58:42 PM
Username: Password: Session Length:
  

News: 01-09-08

Alpha version of REBOL 3 has been released!


  
2287 Posts in 593 Topics by 3727 Members
Latest Member: Maximinioles

  Rebol Talk Forum | Powered by SMF 1.0.9.
© 2001-2005, Lewis Media. All Rights Reserved.

RT design by Defiant Pc