Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> ... also allows you to define new operators ... I'm not sure about Rebol/Red - I had only passing contact with it long ago

You couldn't in Rebol 2. But you can in Rebol 3 (Ren/C branch) and Red.

For eg, lets take Rebol/Red `multiply` function and provide an infix operator for it (ie. replicating the `*` infix operator)...

Rebol 3 (Ren/C):

  >> multiply 2 4
  == 8
  
  >> x: enfix :multiply 
  
  >> 2 x 4
  == 8
Red:

  >> x: make op! :multiply
  == make op! [[
      "Returns the product of two values" 
      value1 [number! char! pair! tuple! ...
  
  >> 2 x 4
  == 8


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: