metaperl / redlang-study

Recording my notes as I study the Red Programming Language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

redlang-study

Recording my notes as I study the Red Programming Language

Carl Sassenwrath's "REBOL Quick Start"

After quite a bit of floundering around, I settled on this document as a way to get started in Red.

Red does not have reform

You will roll along smoothly, after converting program headers from having REBOL to Red until you hit this example in part 3:

REBOL []

birth: 10-Aug-1990

alert reform ["You are" now - birth "days old!"]

Gregg Irwin helped me out with a couple of solutions as did cosacam.

After this example, I was familiar with reduce as well as form. Form is a weird name. I think stringify or as-string would be better. And (given my Python background)I think repr would be a better for mold which I noticed at the bottom of the page while perusing the docs.

Red does not have backdrop or btn

This code failed also:

Red []

view layout [
    backcolor gold
    h2 "Web Bookmarks"
    style btn btn 130
    btn "REBOL.com" [browse http://www.rebol.com]
    btn "REBOL.net" [browse http://www.rebol.net]
    btn "REBOL.org" [browse http://www.rebol.org]
]

we need to use backdrop instead of backcolor according to cosacam1. And note that btn doesn't exist in Red.

Here is the working code:

Red []

view layout [
    backdrop gold
    h2 "Web Bookmarks"
    style btn: button 130
    btn "REBOL.com" [browse http://www.rebol.com]
    btn "REBOL.net" [browse http://www.rebol.net]
    btn "REBOL.org" [browse http://www.rebol.org]
]

order of operations

In Quickstart part 4 we see a failing of REBOL/Red: it does not respect order of operations

>> 3 + 6 * 3
== 27

Here is how to fix it.

>> 3 + (6 * 3)
== 21

since btn does not exist

In Part 4 this console code will not run:

view layout [
    btn "Press Me" red [alert "It worked!"]
]

instead we need this:

view layout [
    style btn: button 130
    btn "Press Me" red [alert "It worked!"]
]

About

Recording my notes as I study the Red Programming Language

License:Apache License 2.0