News for hackers. Stuff that matters.
Re:REBOL Oneliners by Izkata on Sunday March 08, 2020 @06:29PM (#22521074)
It is. For example, in the third example:

  foreach file load %./ [if not dir? file [write/binary join ftp://user:[email protected]/ file read/binary file]]
Those two sets of [ ] are the block! datatype, which is an array-like type. "foreach" is a function that takes an identifier and two block!s ("load" returns a block!), executing the second for each one in the first.

Quick example showing it:

  >> something: [print val]
  == [print val]
  >> foreach val [1 2 3] something
  1
  2
  3
  >> append something [+ 3]       
  == [print val + 3]
  >> foreach val [1 2 3] something
  4
  5
  6
The second example in the oneliners kinda shows this as well, but I suppose it's not obvious without knowing more of the language. The outer block! is actually a separate dialect being passed to the layout function as data, that the layout function parses and handles. What's normally thought of as rebol is called the "do dialect", because that's how you run a block! as code:

  >> X: [print 1 + 2]
  == [print 1 + 2]
  >> do X
  3
  >> X/3
  == +
  >> X/3: to-word {*}
  == *
  >> X  
  == [print 1 * 2]
  >> do X
  2
Re:REBOL Oneliners by noobdood on Monday March 09, 2020 @02:05PM (#22527862)
Thanks.