ArticleslgStudy

computer science

Red (programming language)

Red (programming language) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Red (programming language) rather than just read about it. In short: Red is a programming language designed to overcome the limits of the programming language Rebol. Red was introduced in 2011 by Nenad Rakočević, and is both an imperative and functional programming language.

Red (programming language) — main illustration
Red (programming language) — illustration

Key takeaways

  • Red (programming language) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Red (programming language) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Red (programming language) from memory before moving on to harder problems.

Reference excerpt

Red is a programming language designed to overcome the limits of the programming language Rebol. Red was introduced in 2011 by Nenad Rakočević, and is both an imperative and functional programming language. Its syntax and general usage overlaps that of the interpreted Rebol language. The implementation choices of Red intend to create a full stack programming language: Red can be used for extremely high-level programming (domain-specific languages (DSLs) and graphical user interfaces (GUIs) and low-level programming (operating systems and device drivers). Key to the approach is that the language has two parts: Red/System and Red.

Red/System is similar to C, but packaged into a Rebol lexical structure – for example, one would write if x > y [print "Hello"] instead of if (x > y) {printf("Hello\n");}. Red is a homoiconic language, which is capable of metaprogramming with Rebol-like semantics. Red's runtime library is written in Red/System, and uses a hybrid approach: it compiles what it can deduce statically and uses an embedded interpreter otherwise. The project roadmap includes a just-in-time compiler for cases in between, but this has not yet been implemented. Red seeks to remain independent of any other toolchain; it does its own code generation. It is therefore possible to cross-compile Red programs from any platform it supports to any other, via a command-line switch. Both Red and Red/System are distributed as open-source software under the BSD 3-clause (modified) license. The runtime library is distributed under the more permissive Boost Software License. As of version 0.6.4 Red includes a garbage collector "the Simple GC".

Introduction Red was introduced in the Netherlands in February 2011 at the Rebol & Boron conference by its author Nenad Rakočević. In September 2011, the Red programming language was presented to a larger audience during the Software Freedom Day 2011. Rakočević is a long-time Rebol developer known as the creator of the Cheyenne HTTP server.

Features Red's syntax and semantics are very close to those of Rebol. Like Rebol, it strongly supports metaprogramming and domain-specific languages (DSLs) and is therefore an efficient tool for dialecting (creating embedded DSLs). Red includes a dialect named Red/System, a C-level language which provides systems programming facilities. Red is easy to integrate with other tools and languages as a dynamic-link library (DLL) (libRed) and very lightweight (around 1 MB). It is also able to cross-compile to various platforms (see #Cross compiling section below) and create packages for platforms that require them (e.g., .APK on Android). Red also includes a fully reactive cross-platform GUI system based on an underlying reactive dataflow engine, a 2D drawing dialect comparable to SVG, compile-time and runtime macro support, and more than 40 standard datatypes.

Goals The following is the list of Red's Goals as presented on the Software Freedom Day 2011:

Simplicity ("An IDE should not be necessary to write code.") Compactness ("Being highly expressive maximizes productivity.") Speed ("If too slow, it cannot be general-purpose enough.") Be "Green", Have a Small Footprint ("Because resources are not limitless.") Ubiquity ("Spread everywhere.") Portability, Write once run everywhere ("That's the least expected from a programming language.") Flexibility ("Not best but good fit for any task!")

Commercial applications The following commercial applications are currently developed on Red:

DiaGrammar – Live coded diagramming SmartXML – XML parsing tool

Development Red's development is planned to be in two phases:

Initial phase: Red and Red/System compilers written in Rebol 2 Bootstrap phase: Red and Red/System compilers complemented by a Red just-in-time compilation (JIT) compiler, all written in Red.

Cross compiling As of 2018, supported cross-compiling targets include:

DOS: Windows, x86, console (and GUI) applications Windows: Windows, x86, GUI applications Linux: Linux, x86 Linux-ARM: Linux, ARMv5, armel (soft-float) Raspberry Pi: Linux, ARMv5, armhf (hard-float) FreeBSD: x86 Darwin: macOS Intel, console (and GUI) applications Android: Android, ARMv5 Android-x86: Android, x86 (As of 2018, Red applications are 32-bit. Plans are to move to 64-bit in future.)

See also

Comparison of programming languages History of programming languages List of programming languages List of programming languages by type

References

Further reading Balbaert, Ivo (May 2018). Learn Red - Fundamentals of Red. Packt Publishing. ISBN 978-1789130706.

External links

Official website Latest builds from official website Red on GitHub Redprogramming.com Helpin' Red Archived 2021-09-28 at the Wayback Machine

Illustrations

Red (programming language) illustration
Red (programming language): Red Language architecture schema
Red Language architecture schema

Worked examples

Example 1 — a first encounter with Red (programming language)

Start with the simplest possible case. Write down what Red (programming language) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Red (programming language) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Red (programming language) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Red (programming language)

In research
Red (programming language) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Red (programming language) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Red (programming language) is common in secondary-school and first-year university syllabi. It links to neighbouring topics 2011 software, Cross-platform free software, Cross-platform software, so understanding it makes those chapters shorter.
In everyday life
Look for Red (programming language) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Red (programming language) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Red (programming language) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Red (programming language) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Red (programming language) in simple terms?

Red is a programming language designed to overcome the limits of the programming language Rebol. Red was introduced in 2011 by Nenad Rakočević, and is both an imperative and functional programming language.

Why does Red (programming language) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Red (programming language)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Red (programming language).

Tags

  • 2011 software
  • Cross-platform free software
  • Cross-platform software
  • Domain-specific programming languages
  • Extensible syntax programming languages
  • Free and open source compilers
  • Free and open source interpreters
  • Functional languages
  • High-level programming languages
  • Homoiconic programming languages
  • Procedural programming languages
  • Programming languages

Keep exploring