Skip to content

Comment on TXR – A Programming Language for Convenient Data Mungingparent

Comments

> ... 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
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.