Questions tagged [rebol]

Rebol is a modern interpreted language where code is data. It isn't object oriented, but has objects. It isn't a functional language but has first class functions. There are virtually no syntax rules or immutable keywords, making it ideal for developing domain-specific "dialects".

Filter by
Sorted by
Tagged with
1 vote
2 answers
55 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/...
Slavko's user avatar
  • 17
0 votes
1 answer
72 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 ...
noein's user avatar
  • 411
2 votes
1 answer
57 views

How to make a sequence of functions in REBOL?

I'd like to collect various functions in a sequence and activate them by the sequence index, like in this simple example: mul2: func [n] [2 * n] mul3: func [n] [2 * n] ... (pick [mul2 mul3] 1) 2 ; ...
Attila Karoly's user avatar
0 votes
1 answer
74 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 ...
awyr_agored's user avatar
1 vote
2 answers
116 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: ...
lyl's user avatar
  • 293
0 votes
2 answers
129 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, ...
lyl's user avatar
  • 293
2 votes
1 answer
157 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 ...
lyl's user avatar
  • 293
0 votes
2 answers
77 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, ...
lyl's user avatar
  • 293
0 votes
3 answers
167 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 ...
lyl's user avatar
  • 293
2 votes
1 answer
149 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] ...
lyl's user avatar
  • 293
1 vote
1 answer
49 views

How to prevent "collect/keep" function from flatting its result

>> a: [[1 2] "a" a [3 3]] == [[1 2] "a" a [3 3]] >> collect [foreach x a [if block? x [keep x]]] == [1 2 3 3] But what I want is [[1 2] [3 3]]. It seems that collect/...
lyl's user avatar
  • 293
1 vote
2 answers
124 views

Tracer function written in Rebol

It is possible in Rebol (Red, R3 Ren-c) to write a function similar to TRACE that produces the following result: foo: func [val1 val2 /local temp] [ temp: val1 + 5 val2 + temp ] bar: ...
noein's user avatar
  • 411
1 vote
5 answers
118 views

how to check if char conforms to charset?

tl;dr can't get parse to work with single letter I'm currently learning Red, so I may be missing basic things, but in general I want to check if a password contains uppercase characters; this was my ...
Jakub Koralewski's user avatar
2 votes
2 answers
186 views

Remove button faces

Hi all. I want to know that how can I remove two button face with a button. I tried this: gui: [ en: button "English" remove [en es] es: button "Spanih" remove [en es] ] And than I have to ...
Civan Tunç's user avatar
1 vote
2 answers
146 views

Rebol2/View question: How does the layout function in Rebol2 work?

Some functions that are used in the 'layout function do apparently not exist, yet 'layout works fine. But when you try to replace the 'layout function by an adapted version containing some debugging ...
iArnold's user avatar
  • 333
0 votes
1 answer
278 views

A 'compiler' for list comprehension in Rebol

I want to compile this list comprehension: >> lc [reduce [x y] | x in [1 2 3] y in [4 5 6]] == [[1 4] [1 5] [1 6] [2 4] [2 5] [2 6] [3 4] [3 5] [3 6]] in: collect [ foreach x [1 2 3] [ ...
noein's user avatar
  • 411
1 vote
1 answer
61 views

Handling 'none' when trying to find the index? of a value that doesn't exist in Rebol?

I have a block! x: ["one" "two" "three"] index? find x "two" returns... 2 index? find x "four" returns... ** Script Error: index? expected series argument of type: series port ** Near: index? ...
Atomica's user avatar
  • 23
0 votes
2 answers
153 views

What is the best way to save a hash! block in Rebol?

I am using Rebol2 and would like to persist a HASH! block. Currently I am converting it to-string then using save. Is there a better way? For example: r: make hash! ["one" "two"] I want to save ...
Atomica's user avatar
  • 23
2 votes
2 answers
356 views

How to do an incremental read of binary files

TL;DR: can I do an incremental read of binary files with Red or Rebol? I would like to use Red to process some large (13MB to 2GB) structured binary files (Kurzweil synthesizer files). I've used ...
aMike's user avatar
  • 887
1 vote
1 answer
315 views

How to run Rebol script on Linux 64-bit

I can not run this sample Rebol script REBOL [] alert "Hello World" on Debian 10 Linux 64-bit OS. The script is from the official Rebol tutorial. I'm trying to run it using this command from ...
shitpoet's user avatar
  • 427
29 votes
2 answers
32k views

What are terminal and nonterminal symbols?

I am reading Rebol Wikipedia page. "Parse expressions are written in the parse dialect, which, like the do dialect, is an expression-oriented sublanguage of the data exchange dialect. Unlike the ...
Dmitry Bubnenkov's user avatar
2 votes
3 answers
231 views

Rebol: how to split a string into characters

Using Rebol how do I split this string into characters (without using a c-like approach with loops)? I'm using version 2.7.8.2.5 which does not have the split method. str: "Today is Monday" I want ...
awyr_agored's user avatar
1 vote
3 answers
316 views

How to get a formatted date and time string from `now`?

I'm using "Red Programming Language" version "0.6.4" on Windows and making a command line application. I don't know much Red language and I don't understand many things. I did go over "work in ...
Alex Baban's user avatar
  • 11.4k
4 votes
3 answers
223 views

Differences between Red's 5 function types, and why does it distinguish them?

In Red, there are functions of datatypes function!, op!, native!, routine! and action!. What are the differences between them? As far as I know function! is used for user-defined functions and op! for ...
nickkoro's user avatar
  • 374
0 votes
1 answer
100 views

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

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]...
giuliolunati's user avatar
1 vote
1 answer
97 views

Rebol PARSE rule to match thru first occurrence of at least 2 spaces

rule: [while [not ["--"] skip] some "-"] parse "a-bc----d" [rule ??] prints ??: "d" But I need a more efficient rule (e.g. using to #"-")... EDIT: t: copy "" append/dup t "." 10000 append t "-..--...
giuliolunati's user avatar
3 votes
2 answers
97 views

rebol / red parse with [to end] rule

I'm trying to understand parse from the ground up so don't tell me to use split in this case. sentence: "This is a sentence" parse sentence [ any [ [any space] copy text [to space | to ...
user310291's user avatar
  • 37.3k
1 vote
6 answers
193 views

Red: any alternative to using do for adding dynamic keys to a block

Is there an alternative syntax for : a: [ b: [ 1 2 ] ] append (do "a/b") 3 == [ b: [ 1 2 ] ] I don't feel this as very elegant using do (it ressembles too much eval in ...
user310291's user avatar
  • 37.3k
1 vote
1 answer
103 views

How to append a new data block with new-line in red?

I tried: data: [a b c] new-line tail data true append data [d e f] I get [a b c d e f] not what I expect: [a b c d e f]
user310291's user avatar
  • 37.3k
2 votes
2 answers
134 views

In Rebol PARSE, how to check for begin of input?

I need a rule, let call it AT-BEGIN, that matches the begin of input. Maybe it exists, or how to implement it? EXAMPLES I WANT TO WORK: parse "x" [AT-BEGIN "x"] => match parse "{some-other-chars}x" ...
giuliolunati's user avatar
3 votes
1 answer
358 views

How do I get input from the console in Red language

I'm writing a console program (target MSDOS) in Red language and I need to ask the user to enter a character or a string, then to press Enter. I can't seem to find how to do it, I've read the docs ...
Alex Baban's user avatar
  • 11.4k
1 vote
2 answers
270 views

How can I read values from a configuration file (text)?

I need to read values (text) from a configuration file named .env and assign them to variables so I can use them later in my program. The .env file contains name/value pairs and looks something like ...
Alex Baban's user avatar
  • 11.4k
2 votes
1 answer
128 views

How to use a variable in headers when making a POST request in Red

I'm trying to make a POST request using Red language. I have to pass a header with authorization, and I'm computing the value for the authorization string before making the request and saving it in a ...
Alex Baban's user avatar
  • 11.4k
1 vote
1 answer
103 views

How to assign function to Rebol struct member

I first define a function ADD: add: func [ a [integer!] b [integer!] ] [a + b] Then a struct: s: make struct! [ sadd [ function! ] ] add But Rebol struct does not support the FUNCTION! ...
Raton Kumar's user avatar
2 votes
1 answer
164 views

What's the equivalent of Rebol apply in Red if any?

Rebol has apply Creating map function in Red language what's the equivalent of Rebol apply in Red if any ?
user310291's user avatar
  • 37.3k
0 votes
1 answer
64 views

Equivalent of Rebol effect [gradient] in Red?

I searched on Google but can't find any example in Red equivalent to this in Rebol: http://www.rebol.com/view/demos/gradient.r view layout [ style box box 64x64 across backdrop 0.50.0 vh1 ...
user310291's user avatar
  • 37.3k
0 votes
1 answer
69 views

Red-lang Event: symetric of over (not-over)?

https://doc.red-lang.org/en/view.html over mouse Mouse cursor passing over a face. This event is produced once when the mouse enters the face and once when it exits. If flags facet contains all‑over ...
user310291's user avatar
  • 37.3k
2 votes
2 answers
297 views

is there an optional end-instruction in rebol/red like ";" in javascript

red accepts instruction written on multiple lines which is good. But is there a way to use separator between instructions ? I tried to use ";" but it doesn't work, is there any other symbol available ...
user310291's user avatar
  • 37.3k
2 votes
1 answer
91 views

new-line exists in rebol / red for block what about tabs?

I can't find new-tab whereas there is new-line so how do you preserver tabs in blocks ? help new-line USAGE: NEW-LINE position value DESCRIPTION: Sets or clears the ...
user310291's user avatar
  • 37.3k
0 votes
1 answer
75 views

Why color-code does work in rebol but not in red

I have replace parse/all by parse in http://www.rebol.org/view-script.r?script=color-code.r as for the rest I can see why it doesn't work * Syntax Error: invalid char! at {#"^^(1)" - #" "] ...
user310291's user avatar
  • 37.3k
1 vote
1 answer
108 views

How to color button in red?

I tried this code snippet like in rebol: View [button "colored" 100.0.0] but the button is still in grey.
user310291's user avatar
  • 37.3k
1 vote
3 answers
114 views

Red or Rebol: how to convert "test/a" to [test/a]

I tried to do this: b: [] append b to-word "test/a" but it generates error * Syntax Error: invalid character in: "test/a" * Where: to *** Stack: run to-word
user310291's user avatar
  • 37.3k
0 votes
1 answer
285 views

Rebol / Red calling Headless Chrome on Windows

In Dos command to take screenshot, you can use (see https://developers.google.com/web/updates/2017/04/headless-chrome): chrome --screenshot="C:\test\test.png" "http://google.com" --headless --disable-...
user310291's user avatar
  • 37.3k
1 vote
2 answers
112 views

Red parse with break

my parse code with break doesn't work, I shouldn't get last div block in text: src: { <div class="main"> <div> test </div> <div> test2 </...
user310291's user avatar
  • 37.3k
0 votes
1 answer
81 views

Rebo/Red parse: Is it possible to copy between two marks embedding nested div

Subsequent to Rebol/Red parse: how to copy between 2 marks let's now suppose I achieve to mark a string with some marks with a complex parse rule having nested div (whatever that rule), is there a ...
user310291's user avatar
  • 37.3k
1 vote
2 answers
101 views

Rebol/Red parse: how to copy between 2 marks

I want to be able to parse between 2 marks in parse rule. For a contrieved example: src: {a b c d e f} rule: [ to "b" mark1: thru "e" mark2: to mark1 copy text to mark2 ] This doesn't work,...
user310291's user avatar
  • 37.3k
0 votes
1 answer
100 views

Rebol / Red VID: why is close event immediately sent ?

I inspired from http://www.codeconscious.com/rebol/view-notes.html I don't understand: why is close sent immediately: that's not what I want and I would expect it to be sent when I click on Window ...
user310291's user avatar
  • 37.3k
4 votes
1 answer
124 views

What's the inverse of block: load text in rebol / red

Let's say I have some rebol / red code. If I load the source text, I get a block, but how can get back the source text from block ? I tried form block but it doesn't give back the source text. ...
user310291's user avatar
  • 37.3k
0 votes
2 answers
112 views

Conditional "marking" in Rebol / Red parse

Subsequent to Rebol / Red Parse html rules returns true but nothing is inserted How to mark the end of the fist main div only (when div-count is 0 first time), not the second one, or is there a way ...
user310291's user avatar
  • 37.3k
2 votes
1 answer
147 views

Is Rebol-based Cheyenne server able to process HTTP REST requests?

Is Rebol-based Cheyenne server able to process HTTP REST requests like « /product/1234» / « /product/{productId}» (with data in the URL, not as GET parameters) ? It could be possible if Cheyenne ...
dreamyToto's user avatar

1
2 3 4 5
14