Red has an exceptional built-in help. There is a large amount of information you can get about the language and about your own code just typing a few commands on the console.
function! ? (or help) Red-by-example
Gives information about all of Red's reserved words and also about your own code. You may also type help, but ? is, of course, shorter. ? by itself prints information about how to use help.
>> ? now
Returns date and time.
NOW is a native! value.
/year => Returns year only.
/month => Returns month only.
/day => Returns day of the month only.
/time => Returns time only.
/zone => Returns time zone offset from UCT (GMT) only.
/date => Returns date only.
/weekday => Returns day of the week as integer (Monday is day 1).
/yearday => Returns day of the year (Julian).
/precise => High precision time.
/utc => Universal time (no zone).
[date! time! integer!]
>> a: [1 2 3]
== [1 2 3]
>> help a
A is a block! value: [1 2 3]
>> help block!
a length: 3 [1 2 3]
cancel-captions length: 3 ["cancel" "delete" "remove"]
>> a: function [a b] [a + b]
== func [a b][a + b]
>> ? a
A a b
A is a function! value.
You can get information about complex objects:
If you don't know exactly what you are looking for, "?" will perform a search for you:
>> ? -to
hex-to-rgb function! Converts a color in hex format to a tuple value; returns NONE if it f...
link-sub-to-parent function! [face [object!] type [word!] old new /local parent]
link-tabs-to-parent function! [face [object!] /init /local faces visible?]
You can find all defined words of a given datatype!
>> ? tuple!
; ... the list is too long!
function! what Red-by-example
Prints a list of globally-defined functions. Try it!
function! source Red-by-example
Shows the source code for a mezzanine function or a user created function.
Try source replace .
Red interpreter has:
- the native functions which are "embedded" in the interpreter and are executed at a very low level;
- and mezzanine functions which, even though they are part of Red interpreter (come in the Red executable) are created using Red, that is, they have a source code you can read using source.
function! about Red-by-example
Display version number and build date.