rebol

Why doesn't Rebol 3 honor quoted function parameters that are parenthesized?

最后都变了- 提交于 2019-12-17 18:46:37
问题 The DO dialect uses series of category PAREN! for precedence, and will usually boil away the underlying parentheses structure prior to invoking a function. However, it used to be possible in Rebol 2 to specify in a function's definition that you wanted it to suppress evaluation of parentheses at the callsite. You did this by using a "literal word" apostrophe mark on a parameter: evaluated: func [param] [probe param] non-evaluated: func ['param] [probe param] >> evaluated (1 + 2) 3 >> non

How are words bound within a Rebol module?

戏子无情 提交于 2019-12-17 18:17:41
问题 I understand that the module! type provides a better structure for protected namespaces than object! or the 'use function. How are words bound within the module—I notice some errors related to unbound words: REBOL [Type: 'module] set 'foo "Bar" Also, how does Rebol distinguish between a word local to the module ( 'foo ) and that of a system function ( 'set )? Minor update, shortly after: I see there's a switch that changes the method of binding: REBOL [Type: 'module Options: [isolate]] set

Parallel list assignment in Red language

大城市里の小女人 提交于 2019-12-14 03:51:00
问题 I have 2 lists: alist: [a b c d] blist: [1 2 3 4] (In reality they are long lists). How can I assign variables in alist to corresponding values in blist in one go? Hence a becomes 1, b becomes 2 and so on. I tried: foreach i alist j blist [i: j] But it give following error: *** Script Error: j has no value *** Where: foreach *** Stack: I also tried: i: 1 while [true] [ if i > (length? alist) [break] alist/i: blist/i i: i + 1 ] But it also does not work: *** Script Error: cannot set none in

Rebol PARSE rule to match to first occurrence of at least 2 #[none]s

我是研究僧i 提交于 2019-12-13 03:49:28
问题 See similar question for string case. In R3-Alpha, I tried to adapt the @sqlab response to block case: parse [x x x x #[none] a #[none] #[none] b] [to [none! none!] ??] I expect ??: [#[none] #[none] b] , but get ** Script error: PARSE - invalid rule or usage of rule: none! It's the result right and my expectation wrong? Or it's a bug? 回答1: I can just show a solution for Red and Rebol2. As the words in the rule are reduced automatic, you have to shield them. Red >> parse [x x x x _ a _ _ b]

Rebol SOAP Server

我们两清 提交于 2019-12-13 03:23:44
问题 Where can I find the source of the soap server in rebol mentioned here: http://www.rebolplanet.com/zine/rzine-1-02/#sect6. the link http://www.compkarori.co.nz/reb/discordian.txt doesn't work any more. 回答1: Whenever you have this sort of question, try pasting the URL into the search box of archive.org (The Internet Archive). In this case, a copy of the file was snapshotted in 2004: http://web.archive.org/web/20040205210622/http://www.compkarori.co.nz/reb/discordian.txt (You might let the

Can rebol parse function be able to create rules for parsing css2 / css3 fully?

若如初见. 提交于 2019-12-12 19:02:53
问题 Are there limitation to rebol parse function power ? Would it be capable of parsing the whole css2 / css 3 spec or will it encounter theorical impossibility to form some rules ? Update after HostileFork answer: I mean in regexp I think it would be rather impossible, is parse much more powerfull ? If yes does it mean it would be possible to build a browser in rebol vid compatible with html5 ? 回答1: Your question of "are there limits" is slippery. I'll try and give you " the answer" instead of

C-style for loops in REBOL

浪尽此生 提交于 2019-12-12 14:20:02
问题 I attempted to write a C-style for-loop in REBOL: for [i: 0] [i < 10] [i: i + 1] [ print i ] This syntax doesn't appear to be correct, though: *** ERROR ** Script error: for does not allow block! for its 'word argument ** Where: try do either either either -apply- ** Near: try load/all join %/users/try-REBOL/data/ system/script/args... Does REBOL have any built-in function that is similar to a C-style for loop, or will I need to implement this function myself? The equivalent construct in a C

Rebol Smallest Http Server in the World: why first wait listen-port?

拥有回忆 提交于 2019-12-12 10:15:30
问题 In this code web-dir: %./www/ ; the path to rebol www subdirectory listen-port: open/lines tcp://:80 ; port used for web connections buffer: make string! 1024 ; will auto-expand if needed forever [ http-port: first wait listen-port while [not empty? client-request: first http-port][ repend buffer [client-request newline] ] repend buffer ["Address: " http-port/host newline] parse buffer ["get" ["http" | "/ " | copy file to " "]] parse file [thru "." [ "html" (mime: "text/html") | "txt" (mime:

code with to-word and to-path in Red language

旧巷老猫 提交于 2019-12-12 05:33:32
问题 I am trying to create 2 panels through single function using compose: make-panel: func [sentchar][ probe compose/deep [ text "N1:" (to-set-word rejoin["fld1" sentchar ":"]) field ; TO BE NAMED fld1A and fld1B for 2 panels text "N2: " (to-set-word rejoin["fld1" sentchar ":"]) field ; TO BE NAMED fld2A and fld2B for 2 panels text "Product: " (to-set-word rejoin ["txt_out" sentchar ":"]) text ; TO BE NAMED txt_outA and txt_outB for 2 panels button "Get product" [ x: to-path to-word (rejoin [

Getting strings from a list into VID in Red language

。_饼干妹妹 提交于 2019-12-12 04:09:41
问题 I am trying to create a panel with dynamically created gui elements: sentlist: ["A" "B" "C"] main: function [slist] [ view collect [ keep [below] repeat i length? slist [ keep[ text slist/i ; THIS STEP IS NOT WORKING field "" ] ] ] ] (main sentlist) A series of strings is sent to the function for putting text labels from it. The GUI window/panel is opening all right but text elements do not have any label on it. Where is the problem and how can it be solved? Thanks for your help. 回答1: