Questions tagged [red]

The Red language is inspired by the interpreted language Rebol, but is compiled and hence has a wider range of application...from device drivers to high-level purposes. It is functional, imperative and symbolic, with prototype-based object support. Like LISP and Rebol, it is homoiconic and thus its own meta-language. It is both statically and JIT-compiled to native code, with strong support for concurrency and parallelism (actors, parallel collections).

Red is a paradigm-neutral homoiconic language.

Red has a low memory footprint, and has a low disk footprint (< 1MB). Red seeks to be a "full-stack" language whose methodology is independent of any other toolchain. It's goal is to compile that which can be known ahead of time, JIT-compile that which cannot, and embeds a small interpreter into its executables to handle constructions which are not amenable to any compilation.

As an intermediate language (IL) Red uses a C-like language called . Red/System's parser is reused from Red itself...and for which it has its own code generators. The Red executable is able to build Red/System files directly (*.reds) as well as Red files (*.red), and Red/System code may be embedded freely in Red code.

248 questions
4
votes
2 answers

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: "SDL_Init" [ flags [integer!] …
mydoghasworms
  • 18,233
  • 11
  • 61
  • 95
4
votes
1 answer

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 success while reject indicate failure. I know…
Wayne Cui
  • 835
  • 7
  • 15
4
votes
1 answer

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 see anything at top of console.red) I was trying…
3
votes
2 answers

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 end] skip (print text) ] ] Why do I…
user310291
  • 36,946
  • 82
  • 271
  • 487
3
votes
1 answer

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 here (http://www.red-by-example.org/index.html) to…
Alex Baban
  • 11,312
  • 4
  • 30
  • 44
3
votes
1 answer

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 CLI output with list of elements from…
Mateusz Palichleb
  • 765
  • 12
  • 20
3
votes
1 answer

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 ?
user310291
  • 36,946
  • 82
  • 271
  • 487
3
votes
2 answers

cd command behaves differently on same context in Red

See latest lines: from same context %/C/ directory, doing "cd rebol" works in one case and doesn't work in another case: >> what-dir == %/C/rebol/ >> cd .. == %/C/ >> what-dir == %/C/ >> cd rebol == %/C/rebol/ >>…
user310291
  • 36,946
  • 82
  • 271
  • 487
3
votes
1 answer

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 file with red from http, I tried code below but it…
user310291
  • 36,946
  • 82
  • 271
  • 487
3
votes
2 answers

Getting different paths in Red language

I am trying to get different paths in Red language. If I cd to /myfolder and run following command: /myfolder$ /path/to/red.exe /path/to/myscript.red How can I get these 3 paths from code in script? I tried: system/options/path ; Gives…
rnso
  • 23,686
  • 25
  • 112
  • 234
3
votes
1 answer

How can red be used to connect to REST apis?

I found that there is a red command to download contents of a web page: read https://trello.com/c/8p75OiSE/26-test-card.json However, I have two problems (at least on Linux Mint): Trello's response differs for this request than it does for simply…
NH.
  • 2,240
  • 2
  • 23
  • 37
3
votes
1 answer

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 and so on. I tried: foreach i alist j blist [i:…
rnso
  • 23,686
  • 25
  • 112
  • 234
3
votes
2 answers

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-numeric text. I am trying to catch error if…
rnso
  • 23,686
  • 25
  • 112
  • 234
3
votes
2 answers

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 the best way to do it- create an image file which…
rnso
  • 23,686
  • 25
  • 112
  • 234
3
votes
2 answers

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 particular problem, nor use FOREACH as the…
rgchris
  • 3,698
  • 19
  • 19
1 2
3
16 17