rebol

How to use IN with a block instead of an object?

落爺英雄遲暮 提交于 2019-12-01 08:26:37
The IN function in Rebol finds out if a field is in an object: USAGE: IN object word DESCRIPTION: Returns the word or block in the object's context. IN is a native value. ARGUMENTS: object (any-object! block!) word -- (modified if series) (any-word! block! paren!) The claim is it works with objects or blocks. It works okay if I try it with an object: >> in object [foo: 10 bar: 20] 'foo == foo But if I just try it with a raw block, it gives back NONE: >> in [foo: 10 bar: 20] 'foo == none Guess I'd understand if it didn't support blocks (Rebol2 didn't). But what's the case in which it wouldn't

Using PARSE on a PORT! value

↘锁芯ラ 提交于 2019-12-01 06:30:48
问题 I tried using PARSE on a PORT! and it does not work: >> parse open %test-data.r [to end] ** Script error: parse does not allow port! for its input argument Of course, it works if you read the data in: >> parse read open %test-data.r [to end] == true ...but it seems it would be useful to be able to use PARSE on large files without first loading them into memory. Is there a reason why PARSE couldn't work on a PORT! ... or is it merely not implemented yet? 回答1: the easy answer is no we can't...

What's a good, non-recursive algorithm to calculate a Cartesian product?

天涯浪子 提交于 2019-11-30 16:07:26
Note This is not a REBOL-specific question. You can answer it in any language. Background The REBOL language supports the creation of domain-specific languages known as "dialects" in REBOL parlance . I've created such a dialect for list comprehensions, which aren't natively supported in REBOL. A good cartesian product algorithm is needed for list comprehensions. The Problem I've used meta-programming to solve this, by dynamically creating and then executing a sequence of nested foreach statements. It works beautifully. However, because it's dynamic, the code is not very readable. REBOL doesn't

REBOL3 - what is the difference between the different branches?

你说的曾经没有我的故事 提交于 2019-11-30 12:19:34
问题 What are the differences between the different Rebol 3 branches, especially with the new REN branch? Is it the platforms they'll run on, the feature set, code organization, the C standard compliance? 回答1: This is an answer destined to become outdated, hence set to Community Wiki. This information is as of Sep-2015 . So if updating this answer after some time has passed, please modify the date as well. Binary download of Rebol3 from rebol.com Last build was 5-Mar-2011 and pre-dates the open

Why does return/redo evaluate result functions in the calling context, but block results are not evaluated?

五迷三道 提交于 2019-11-30 09:26:46
Last night I learned about the /redo option for when you return from a function. It lets you return another function, which is then invoked at the calling site and reinvokes the evaluator from the same position >> foo: func [a] [(print a) (return/redo (func [b] [print b + 10]))] >> foo "Hello" 10 Hello 20 Even though foo is a function that only takes one argument, it now acts like a function that took two arguments . Something like that would otherwise require the caller to know you were returning a function, and that caller would have to manually use the do evaluator on it. Thus without

What is the summary of the differences in binding behaviour between Rebol 2 and 3?

爷,独闯天下 提交于 2019-11-30 07:01:56
The current in-depth documentation on variable binding targets Rebol 2. Could someone provide a summary of differences between Rebol 2 and 3? BrianH There isn't really a summary somewhere, so let's go over the basics, perhaps a little more informally than Bindology . Let Ladislav write a new version of his treatise for R3 and Red. We'll just go over the basic differences, in order of importance. Object and Function Contexts Here's the big difference. In R2, there were basically two kinds of contexts: Regular object contexts and system/words . Both had static bindings, meaning that once the

REBOL3 - what is the difference between the different branches?

对着背影说爱祢 提交于 2019-11-30 02:28:34
What are the differences between the different Rebol 3 branches, especially with the new REN branch? Is it the platforms they'll run on, the feature set, code organization, the C standard compliance? HostileFork This is an answer destined to become outdated, hence set to Community Wiki . This information is as of Sep-2015 . So if updating this answer after some time has passed, please modify the date as well. Binary download of Rebol3 from rebol.com Last build was 5-Mar-2011 and pre-dates the open source release. No GUI support, no HTTPS support, no serial port support, no UDP support, no

What's a good, non-recursive algorithm to calculate a Cartesian product?

假如想象 提交于 2019-11-29 23:45:50
问题 Note This is not a REBOL-specific question. You can answer it in any language. Background The REBOL language supports the creation of domain-specific languages known as "dialects" in REBOL parlance . I've created such a dialect for list comprehensions, which aren't natively supported in REBOL. A good cartesian product algorithm is needed for list comprehensions. The Problem I've used meta-programming to solve this, by dynamically creating and then executing a sequence of nested foreach

Why does return/redo evaluate result functions in the calling context, but block results are not evaluated?

安稳与你 提交于 2019-11-29 14:29:23
问题 Last night I learned about the /redo option for when you return from a function. It lets you return another function, which is then invoked at the calling site and reinvokes the evaluator from the same position >> foo: func [a] [(print a) (return/redo (func [b] [print b + 10]))] >> foo "Hello" 10 Hello 20 Even though foo is a function that only takes one argument, it now acts like a function that took two arguments . Something like that would otherwise require the caller to know you were

What is the summary of the differences in binding behaviour between Rebol 2 and 3?

烂漫一生 提交于 2019-11-29 08:35:25
问题 The current in-depth documentation on variable binding targets Rebol 2. Could someone provide a summary of differences between Rebol 2 and 3? 回答1: There isn't really a summary somewhere, so let's go over the basics, perhaps a little more informally than Bindology. Let Ladislav write a new version of his treatise for R3 and Red. We'll just go over the basic differences, in order of importance. Object and Function Contexts Here's the big difference. In R2, there were basically two kinds of