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
3
votes
1 answer

How do I use collect keep in parse, to get embedded blocks?

Looking at the html example here: http://www.red-lang.org/2013/11/041-introducing-parse.html I would like to parse the following: "val1-12*more text-something" Where: "-" marks values which should be in the same block, and "*" should start a new…
ingo
  • 521
  • 3
  • 7
3
votes
2 answers

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 [ allocate: "malloc" [ size…
3
votes
1 answer

Converting strings to other datatypes in Red

What is the recommended way to convert a string to an integer in Red? One way I found is: load "123" == 123 Is load the best way of getting an integer from a string in Red? Is there any danger in using load in this way specifically if the string is…
johnk
  • 1,102
  • 7
  • 12
3
votes
2 answers

why 'ed' also named 'red' in linux

Recently I play with an awesome programming language red. After I downloaded it on my Linux Box, and typed red --version, I got something unexpected: $ red --version GNU ed version 0.2 then I look up ed's manual, it's said it also named red, but…
Sonny
  • 182
  • 1
  • 1
  • 9
3
votes
1 answer

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 in the Red programming language? I've searched my…
Respectech
  • 454
  • 4
  • 13
2
votes
1 answer

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 input, that is to say, just press a key on keyboard and…
lyl
  • 293
  • 1
  • 8
2
votes
1 answer

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] ;; variable a is destroyed Code2: >> g: func [x y][x: x + y] == func [x…
lyl
  • 293
  • 1
  • 8
2
votes
1 answer

How do I set an icon to a view in red program?

I want to set an icon for the program main window. I found this page https://www.red-lang.org/2016/03/060-red-gui-system.html which says: Icons and other "resources" are now supported for inclusion in Windows executables. They can be set from Red's…
jakubiszon
  • 3,229
  • 1
  • 27
  • 41
2
votes
2 answers

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 append new buttons.
2
votes
1 answer

How to append data to block from R/S?

I am trying to append data to block from Red/System. Red [] my-red-block: ["some text"] ; some already existen data in block foo: routine [ blk ] [ block/rs-append as red-block! blk as red-value! unicode/load-utf8 "new text" size? "new…
Dmitry Bubnenkov
  • 9,415
  • 19
  • 85
  • 145
2
votes
1 answer

How to pass value from Red/System to Red?

I need to pass the value that I generate in Red/System to Red. I discovered docs but did not find an example of how to use it. Here is my code: Red [] #system [ data!: alias struct! [ a [integer!] b [c-string!] ] …
Dmitry Bubnenkov
  • 9,415
  • 19
  • 85
  • 145
2
votes
1 answer

How can I compile a script that has some dynamic code?

I want to compile this script: Red [File: %b.red] context [ a: 123 hidden: 999 set 'global-exports context [ export-a: a ] ] probe global-exports But I get an error when trying to compile it with $ ./red-13oct19-a4ee537c -r…
Maciej Łoziński
  • 812
  • 1
  • 10
  • 16
2
votes
2 answers

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 other languages (C, Go, Tcl, Ruby, Dart) to walk…
aMike
  • 852
  • 5
  • 14
2
votes
0 answers

Segmentation fault with Gtk console on 64-bit system

I've compiled a Red console with Gtk3 support. When I run View tests, such as included in repo tests/react-test.red, i get an error: $ ./console tests/react-test.red *** Runtime Error 32: segmentation fault *** at: F6B4E33Eh ldd console does not…
Maciej Łoziński
  • 812
  • 1
  • 10
  • 16
2
votes
1 answer

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 variable auth-string. probe prints the…
Alex Baban
  • 11,312
  • 4
  • 30
  • 44