247
questions
30
votes
2
answers
37k
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 ...
17
votes
3
answers
2k
views
Is there a overall explanation about definitional scoping in Rebol and Red
From the REBOL/Core Users Guide, and What is Red, I have learned that both Rebol and Red use definitional scoping.
From the guide, I know it is a form of static scoping, "the scope of a variable is ...
10
votes
3
answers
634
views
String searching in Rebol or Red
I'm interested in searching on a lot of long strings, to try and hack out a sed-like utility in rebol as a learning exercise. As a baby step I decided to search for a character:
>> STR: "...
10
votes
1
answer
444
views
Is it possible to write a Windows DLL in Red?
I'd like to write a plugin for some Windows application, and it must be a DLL. I'd really love to try doing it in a mix of Red & Red/System. But asking on Rebol&Red chatroom here on SO, I got ...
8
votes
1
answer
2k
views
REBOL3 - what is the difference between the different branches?
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?
8
votes
2
answers
909
views
|Red Programming Language| How to get Cookies from a Webpage?
I searched a lot on Google as well as Stackoverflow. I could not find How to get Cookies (or in general, The HTTP Headers)from a Webpage and then edit it and send it back?
[I know how to make POST/...
7
votes
1
answer
156
views
type of literal words
I was reading Bindology and tried this:
>> type? first ['x]
== lit-word!
>> type? 'x
== word!
I expected type? 'x to return lit-word! too. Appreciate any insights.
7
votes
2
answers
1k
views
How to parse and translate DSL using Red or Rebol
I'm trying to see if I can use Red (or Rebol) to implement a simple DSL. I want to compile my DSL to source code for another language, perhaps Red or C# or both - rather than directly interpreting and ...
7
votes
1
answer
207
views
"How to apply Red to compile-time optimization of this Lisp code?"
This is a pattern of optimization in Lisp code that I want to achieve in Red:
(defmacro compute-at-compile (x)
`(+ ,(* pi 2) ,x))
(macroexpand '(compute-at-compile 1))
; => (+ 6.283185307179586 ...
6
votes
3
answers
262
views
Remove special characters from string in Red language
I want to remove all characters in a string except:
- or _ or .
A thru Z
a thru z
0 to 9
space
On linux command line, using sed I would do this:
$ echo "testing-#$% yes.no" | sed 's/[^-_.a-zA-Z0-9 ]...
6
votes
1
answer
641
views
How do I use the Red cURL binding?
I am just getting started with Red and I need help to get the cURL binding working.
The cURL link from the main red-lang site takes you here
http://red.esperconsultancy.nl/Red-cURL/dir?ci=tip
But ...
6
votes
1
answer
258
views
Pointers to an 'array' in Red/System
How do I make a pointer to the first element in an array in Red/System?
Assigning an address to a pointer is no problem:
my-integer: 1
ptr: declare pointer! [integer!]
ptr: :my-integer
The array is ...
5
votes
3
answers
11k
views
Red language console error: libreadline.so.6: cannot open shared object file
I'm new to the Red programming language.
I tried to test it by downloading the Linux binary. But when I execute it on the console, I get an error that says:
root@xxx-linux:/home/xxx/Downloads# ./...
5
votes
4
answers
1k
views
How do I run an Android app I've written in Red?
When I enter this in the Windows CMD...
red -c -t Android hello.red
...Red outputs a file called hello with no filename extension. If I transfer this file to my Android device, it doesn't know what ...
5
votes
1
answer
72
views
Simpler way to do repeated `back back series`
Sometimes, I tend to do next next a (repeatedly) to get at a particular element.
This works well when you need 2 or less traversals.
However, it gets cumbersome pretty soon. A loop is too much ...
5
votes
2
answers
378
views
How to Convert a Red/Rebol String into a Series
I would like to know if there is a way to convert a string into a series. I'm trying to extract data using parse, and I want to break some of that captured data down into smaller fragments so that I ...
5
votes
1
answer
127
views
Read non success http data in rebol
Is there a way to read non success http data, for example for a 404, in Rebol? When open gets a non success http response code for an URL it fails with an error, but I would like to read the response ...
5
votes
1
answer
195
views
Rebol/RED parsing. Save ASCII codes from parsed string to variable?
I stumbled into RED language the other day and spend (more or less literally) the last 24h "learning" it. I exhausted my googling skills trying to find solution for a simple problem that just evades ...
4
votes
3
answers
235
views
Parse string to find first duplicate character - functional vs. prodecural coding style
I want to parse a string to find the first N duplicate characters found in a (character, n) set.
For example, for "ozzllluu" and sets ("u" => 2), ("d" => 2), ("l" => 3), and ("r" => 3)... I would ...
4
votes
2
answers
294
views
What's the difference between `a: [b 1]` and `a: [b: 1]`, in red?
What is the difference between
a: [b 1]
; and
a: [b: 1]
both give the same results for
> a/b
1
they differ for a/1 though.
When do you use what? And the 2nd is a set, what is the 1st?
4
votes
2
answers
419
views
Red: *** Error: word has no value! when calling external library function
I am following the example from the Red documentation here: http://static.red-lang.org/red-system-specs.html#section-14
This is my code:
Red []
#import [
"SDL2.dll" cdecl [
sdl_init: "...
4
votes
3
answers
244
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 ...
4
votes
2
answers
504
views
What is the difference between `context` and `object`?
In Rebol 3, there are the functions object and context.
What's the purpose of the difference?
Note : for reference, in red, both are the same, and object doesn't exist
in rebol 2
Context: no pun ...
4
votes
1
answer
188
views
Pass by reference in Red routines
So I'm currently in the process of migrating a descent sized program from Rebol 3 to Red. Said program relies on a large binding to a C library (clang). I have rewritten the binding portion in Red/...
4
votes
1
answer
130
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.
...
4
votes
2
answers
251
views
red/rebol: Subtracting dates returns days, how can I change that?
Playing with the date type, I was wondering, why a subtraction always returns days, how can I make it return minutes (or seconds, etc.), which could be possible in the second example
>> 24-dec-...
4
votes
2
answers
87
views
Convert a block of strings to a block in Red
How to convert a block of strings into a block?
To change this:
keep rejoin['circle " " coord " " 5 " "]]]
["circle 10x10 5 " "circle 20x20 5 " "circle 30x30 5 "]
to this:
[circle 10x10 5 circle ...
4
votes
1
answer
157
views
is there a way to list words in the current Red console
Is there an object like rebol/words available in the REPL build with console.red ?
I am using the red-master currently on github ( it says alpha and Latin-1 only but no other version id and I didn't ...
4
votes
1
answer
134
views
When do Red looping structures require interpretation
Under what circumstances does a looping construct require evaluation by the interpreter in Red? Which looping constructs do not?
Update (4/20/2015):
Below is an small program I wrote to demo the ...
4
votes
2
answers
130
views
Accessing runtime functions from Red/System
So the issue came up while experimenting with marshaling values back and forth between Red and Red/System. I would like to access the guts of an object passed to a routine.
I had noticed that there ...
4
votes
1
answer
149
views
Difference between BREAK and REJECT in PARSE
Both in Rebol and Red, there are two PARSE key words: break and reject which have similar behavior: break out of a match loop (such as any, some, while), the difference is that break always indicating ...
4
votes
1
answer
81
views
Sandbox Red function
I'm planning to write an application for managing a game-server in Red. It should be extendable by using interpreted Red scripts. Now, I want to set restrictions for this scripts (I want to "sandbox" ...
4
votes
2
answers
236
views
How do I access serial port in RED?
I need to access some weighing machines via serial port. How could I red/write data from/to it using the RED Programming language ?
3
votes
1
answer
219
views
How can I store list of directory files using pure Red language?
I am trying to store list of files from directory in variable (using only CLI, Red version: 0.6.3).
I tested couple of functions from "Red by example" documentation, but all of them give me only an ...
3
votes
2
answers
183
views
How to create a Red/System binding to a function that takes a pointer to a pointer?
I was looking at how Red/System hooks up with C library functions from Windows DLLs, Linux/Android .so shared libraries, and OS/X .dylib, with the #import syntax:
#import [
"libc.so.6" cdecl [
...
3
votes
2
answers
101
views
How can I reverse-sort a list in Red?
I've been playing with Red, and I figured out how to sort a list:
--== Red 0.5.1 ==--
Type HELP for starting information.
red>> list: [1 9 6 8]
== [1 9 6 8]
red>> sort list
== [1 6 8 9]...
3
votes
2
answers
359
views
Try/catch exceptions in Red language
I have a small GUI application with a text-field and a button. The button triggers a function which tries to read a number from text-field. An exception is raised if the text-field is blank or has non-...
3
votes
2
answers
101
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 ...
3
votes
1
answer
402
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 ...
3
votes
3
answers
97
views
Understanding the relationship between print and symbols held in blocks
Scenario 1:
red>> sizes: [small medium large]
== [small medium large]
red>> print sizes
*** Script error: small has no value
*** Where: print
Scenario 2:
red>> print first sizes
...
3
votes
1
answer
59
views
Date substraction why don't I get hh:mm:ss in Rebol / Red?
1°) I get only the number of days, how to also get the hh:mm:ss ?
diff: (now - (10-Nov-2017/15:00:00))
6
2°) What's the most elegant way to get the number of minutes ?
3
votes
1
answer
109
views
Parallel list assignment in Red language
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 ...
3
votes
2
answers
266
views
Creating pdf file in Rebol/Red
I need to create a pdf file of A4 sized page which will have a black and white image and some text. Can I create a pdf file in Rebol or Red programming language?
If not possible directly, what is ...
3
votes
2
answers
153
views
Breaking out of a recursive function
I'm walking through a set of nested blocks and want to stop the walk when I've found the value I'm looking for.
For reasons that are beyond the scope of this question, I can't use PARSE for this ...
3
votes
1
answer
264
views
REBOL methods in Red
Disclaimer: What I'm trying to achieve is something like what was discussed here - Evaluating a "variable variable".
I want to create variables in red dynamically with identifiers based on ...
3
votes
1
answer
183
views
load a map of hash - object key pair
Please consider this example where I save a map! to a file and want to load it back and access its keys and values. Its keys are hashes (INTEGER!, calculated by checksum) and its values are blocks:
...
3
votes
1
answer
81
views
Access word value inside object
In the interpreter:
>> qurl: "1234"
== "1234"
>> R: make object! [probe qurl qq: qurl probe qq]
"1234"
"1234"
== make object! [
qq: "1234"
]
This behaves like I'd expect. All "...
3
votes
2
answers
380
views
How to properly use the Red/System dialect from the pure Red code?
I am writing a simple tutorial application using curses binding to Red/System. Doing it like it is shown in "curses-example.reds" works great. But how can I use this binding from a pure Red code? Did ...
3
votes
1
answer
1k
views
In the Red programming language, how does one compile a script?
I've compiled scripts in Red before, but once I've been away from it for a while, I forget. I thought I'd ask the question here because I'm sure I'm not the only one.
How does one compile a script ...
3
votes
1
answer
206
views
call curl from rebol or red doesn't work
On dos cmd this works:
curl.exe -L https://dl.uxnr.de/build/curl/curl_winssl_msys2_mingw64_stc/curl-7.53.1/curl-7.53.1.zip > curl.zip
On red or rebol, following suggestion Cannot read a binary ...