
Becoming Patient in Writing Programs - reikonomusha
http://symbo1ics.com/blog/?p=2139
======
draegtun
Late reply here because I just tried submitting this link myself :)

What got me interested was how another language which used consistent data
structure for its syntax would look here in comparison.

So here is my stab at it using Rebol...

    
    
      ; Array Access
      pick x i
      x/:i       ; PATH! alternative
      
      ; Function call
      f x
      
      ; Arithmetic
      (a / 2) + (b * c) + square-root d
      
      ; Conditional Branching (part 1)
      either a = b [x] [y]
    

Rebol doesn't have _else if_ so this looks a little clumsy:

    
    
      ; Conditional Branching (part 2)
      either a == b [
          doThis a
          x
      ][
          either c == d [
              doThat b
              y
          ][z]
      ]
    

And it doesn't have a _cond_ either. However its easy to add one :)

    
    
      cond: func [cond-list] [
          foreach line cond-list [
              c: compose line
              if true? c/1 [break/return do c/2]
          ]
      ]
      
      cond [
          [(a = b) [doThis a x]]
          [(c = d) [doThat b y]]
          [true    [z]]
      ]

