4 ms·
IIRC I read somewhere that Rebol is homoiconic but not sure.
by noobdood 7y ago
IIRC I read somewhere that Rebol is homoiconic but not sure.
- Izkata 7y agoIt is. For example, in the third example: foreach file load %./ [if not dir? file [write/binary join ftp://user:pass@example.com/ 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
- noobdood 7y agoThanks.
- 9214 7y agoCurious ones can find a brief explanation of this core idea in a Github wiki (shameless plug!). https://github.com/red/red/wiki/%5BDOC%5D-How-Red-works:-a-brief-explanation https://github.com/red/red/wiki/%5BDOC%5D-How-Red-works:-a-b...
- noobdood 7y agoThanks.