rebol2

Why do function “have memory” in REBOL?

喜欢而已 提交于 2020-01-12 23:19:10
问题 In rebol I have written this very simple function: make-password: func[Length] [ chars: "QWERTYUIOPASDFGHJKLZXCVBNM1234567890" password: "" loop Length [append password (pick chars random Length)] password ] When I run this multiple times in a row things get really confusing: loop 5 [print make-password 5] Gives (for example) this output: TWTQW TWTQWWEWRT TWTQWWEWRTQWWTW TWTQWWEWRTQWWTWQTTQQ TWTQWWEWRTQWWTWQTTQQTRRTT It looks like the function memorised the past executions and stored the

Dynamically adding words to a context in REBOL

只愿长相守 提交于 2020-01-02 03:17:08
问题 Imagine the following REBOL code: foo: context [bar: 3] I now have a context foo in which 'bar is defined. How can I dynamically inject a new word into this context? Is it possible? I've tried: set/any in foo 'baz 3 But that doesn't work because the expression in foo 'baz fails because there is no word 'baz defined in the foo context. I should add that I realize one way to do this is as follows: foo-prototype: [bar: 3] foo: context foo-prototype foo: context head append foo-prototype [baz: 3]

REBOL layout: How to create layout words automatically - word has no context?

时光毁灭记忆、已成空白 提交于 2019-12-23 08:37:14
问题 Using the REBOL/View 2.7.8 Core, I would like to prepare a view layout beforehand by automatically assigning words to various layout items, as in the following example. Instead of prepared-view: [across cb1: check label "Checkbox 1" cb2: check label "Checkbox 2" cb3: check label "Checkbox 3" cb4: check label "Checkbox 4" ] view layout prepared-view I would thus like the words cb1 thru cb5 to be created automatically, e.g.: prepared-view2: [ across ] for i 1 4 1 [ cbi: join "cb" i cbi: join

REBOL layout: How to create layout words automatically - word has no context?

自古美人都是妖i 提交于 2019-12-23 08:37:06
问题 Using the REBOL/View 2.7.8 Core, I would like to prepare a view layout beforehand by automatically assigning words to various layout items, as in the following example. Instead of prepared-view: [across cb1: check label "Checkbox 1" cb2: check label "Checkbox 2" cb3: check label "Checkbox 3" cb4: check label "Checkbox 4" ] view layout prepared-view I would thus like the words cb1 thru cb5 to be created automatically, e.g.: prepared-view2: [ across ] for i 1 4 1 [ cbi: join "cb" i cbi: join

When I use error? and try, err need a value

白昼怎懂夜的黑 提交于 2019-12-21 19:17:34
问题 Here my function that execute cmd as a Rebol instructions : exec-cmd: func [ cmd [ block! ] "Rebol instructions" /local err ] [ if error? err: try [ do cmd ] [ print mold disarm err ] ] When I launch the function, I've encountered the following error message : ** Script Error: err needs a value ** Where: exec-cmd ** Near: if error? err: try [ do cmd ] How can I avoid this message and manage the error ? 回答1: When the Rebol default evaluator sees a sequence of a SET-WORD! followed by a

How to create Windows executable (.exe) from red lang?

≡放荡痞女 提交于 2019-12-11 04:04:46
问题 I'm building a red lang application. How to create Windows executable (.exe) from red lang??? 回答1: If you have already the red executable, you call from the command line red -c -t Windows yourprogram.red and you will get yourprogram.exe as a Windows program README.md Of course I assume, you have also downloaded all the possibly additionally needed source files from either red-lang/download or github/red/red If you have a recent rebol interpreter, you can compile with do/args %red.r "-t

How to send an HTTP post with a custom header using REBOL

情到浓时终转凉″ 提交于 2019-12-11 02:44:36
问题 I've been trying to access a site with REBOL using the site's API, but I'm having problems. The API call expects a custom header and a request in XML format. I've been trying with read/custom, but I'm unsure how to include the header, or what format it should take. The default header in system/options/cgi is an object, so I assume it should be an object, but where would you put it? (Adding to system/options/cgi hasn't worked.) I'm guessing the code below is something like what I need... http

Rebol Quickstart [closed]

我怕爱的太早我们不能终老 提交于 2019-12-07 15:28:43
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . I've been meaning to try out rebol (or red). I think it might be the perfect fit for my next project. I've downloaded and tested out red 0.5.4, and REBOL/View 2.7(http://www.rebol.com/download-view.html) However, there are a couple of roadblocks for a complete beginner to rebol:

Rebol Quickstart [closed]

怎甘沉沦 提交于 2019-12-05 20:35:18
Closed . This question needs to be more focused . It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post . Closed 3 years ago . I've been meaning to try out rebol (or red). I think it might be the perfect fit for my next project. I've downloaded and tested out red 0.5.4, and REBOL/View 2.7( http://www.rebol.com/download-view.html ) However, there are a couple of roadblocks for a complete beginner to rebol: Red seems to be still in alpha so it is out of the question There seems to be 3+(?) branches: REBOL3

Dynamically adding words to a context in REBOL

一世执手 提交于 2019-12-05 04:16:55
Imagine the following REBOL code: foo: context [bar: 3] I now have a context foo in which 'bar is defined. How can I dynamically inject a new word into this context? Is it possible? I've tried: set/any in foo 'baz 3 But that doesn't work because the expression in foo 'baz fails because there is no word 'baz defined in the foo context. I should add that I realize one way to do this is as follows: foo-prototype: [bar: 3] foo: context foo-prototype foo: context head append foo-prototype [baz: 3] But what if you don't have access to foo 's prototype block? You can achieve the same by using the