247 questions
2 votes
2 answers
222 views
In Red (R2) how to call a function whose name passed by argument?
I have an arbitrary function with multiple arguments, and I want to call it from command-line like this: program myfun 7 24 15 I tried to do it this way: myfun Func: [A B C][...] ARGS: Probe System/...
0 votes
1 answer
113 views
A particular diff
I have 2 files: list-folder1.txt and list-folder2.txt. These files are derived from the ls -1R command run on linux in their respective folders (similar folders consisting of thousands of files and ...
1 vote
1 answer
170 views
How to integrate Red into Rust?
Does anyone know how to use view from Rust? Do I need to link libRed.dll on Windows? What functions to extern? Must I try to disassemble it? I’m using compiled Red, not interpreted, so libRedRT.lib ...
0 votes
1 answer
151 views
Rebol - How can I append text from a text field to a text list?
I've been exploring the amazing Rebol programming tool. I've run into a problem of trying to append text from a text field into the data of a text-list. My code below adds text to the text-list but ...
0 votes
1 answer
2k views
How to decompress/deflate zlib data [rfc1951]?
I am looking for decompressing data according to the deflate compression mechanism [rfc1951]. The linux command for this mechanism is: zlib-flate -uncompress I try the Red command decompress with ...
0 votes
1 answer
130 views
behavior of call in Red language
On Red console, I tried the following commands: >> (print 0 call/shell/wait "sleep 5" print 5) I think 0 would be printed first. After 5 seconds delay, 5 would then be printed. In ...
1 vote
2 answers
166 views
How to evaluate refinement of a function when calling this function in Red/Rebol
>> f: func [x /a][either a [x + 2] [x + 1]] == func [x /a][either a [x + 2] [x + 1]] >> b: /a == /a >> f/b 1 *** Script Error: f has no refinement called b *** Where: f *** Stack: ...
1 vote
1 answer
118 views
How to link other scripts when compiling main program in Red language
I put some functions' defination in a file named "funcs.red", functions in which would be invoked by main program. Here is the example of "funcs.red": Red [] myadd: func [x y] [x + ...
0 votes
2 answers
170 views
How to construct a function with a default argument
To make a function with default argument, I tried this: f: function [a b] [either unset? :b [a + 1] [a + b]] f 5 f 3 5 then I receive this message *** Script Error: f is missing its b argument. So, ...
2 votes
1 answer
231 views
How to read key from keyboad in red/rebol
We can get input from console by input or ask, which means to press some keys on keyboard and terminate the input by pressing the key "Enter". I'd like to know if there is a way to get a key ...
0 votes
2 answers
108 views
Value of local variables in a function seems not be released post function calling in Red/Rebol language
I construct a function named find-all to find all indexes of a given item in a series by "recursive". The first calling of find-all gives the right output. However from the second calling, ...
1 vote
1 answer
74 views
Use 'parse' in Red language with number block
I imitate the follow code that comes from Helpin'Red a: "big black cat" parse a [ to "black" insert "FAT "] print a big FAT black cat with mine: b: [1 2 3] parse b [to 2 ...
1 vote
1 answer
168 views
In Red language, how to split a string using split, but also keep the delimiters as nessecary
I want to split a string with the split, meanwhile the string contains the string used as delimiter which should not be treated as delimiter. I tried in this way as shown in the following code: >&...
0 votes
3 answers
214 views
How to modify each element of a block by "foreach" in red/rebol
I want to modify each element of a block by foreach. I tried like this but failed: >> a: [3 4 5 6] == [3 4 5 6] >> foreach i a [i + 1] == 7 >> a == [3 4 5 6] ;; block a is not ...
2 votes
1 answer
209 views
How does functions of Red/Rebol pass parameters, by value or by reference?
I'm puzzled by the result of the following two codes: Code1: >> f: func [x][head insert x 1] == func [x][head insert x 1] >> a: [2 3] == [2 3] >> f a == [1 2 3] >> a == [1 2 3] ...