greggirwin on master
docs-cs: recent changes (image.… Merge branch 'master' of https:… docs-cs: cs\datatypes\map.adoc… and 1 more (compare)
greggirwin on master
Added iteration section for map… Changed wording in Iteration se… Merge pull request #193 from gl… (compare)
char!? I know it's easy, but what is the use case?
And you can see the details by using
Red  #macro pow2: func [n][to integer! n ** 2] print pow2 10 print pow2 3 + pow2 4 = pow2 5 probe expand-directives [pow2 3 + pow2 4 = pow2 5]
100 true [9 + 16 = 25]
Yes, that is a limitation, but may be change in the future.
2 other points:
You can also see the expanded version of your script by using
--show-expanded argument during the compilation, for easier debugging:
Red  #macro pow2: func [n][to integer! n ** 2] print pow2 10
Compiling D:\Projects\Red\red\build\bin\test.red ... ...using libRedRT built on 30-Jul-2019/13:43:21 [ print 100 ] ...compilation time : 29 ms
And you may examine
system/lexer/pre-load, default value is
none but if you put a function there it will be called during the scanning (on REPL only, no effect on compiled exe)
>> system/lexer/pre-load: func [s] [replace s "*" "+"] == func [ ] >> 3 * 5 == 8
It can be used to extend to replace macros on REPL. There are better examples for use of
pre-loader from @toomasv and others.
@endo64 I would argue against suggesting
pre-load to newcomers (and pretty much everyone else), not until we get a decent reader macros support.
And you don't need compilation with
expand from console is enough for quick experiments.
makeaction and native values. This is basically because the toolchain itself uses
maketo pre-define all actions and natives, and it was not deemed necessary or useful to forbid this feature after the initialization phase. However, (1) only existing actions and natives can be (re)made, and (2) the function spec has to be suppplied and if you get that wrong, a crash may occur. In "my" spec document, I have added wording to the effect that this is not recommened. Apparently, R3 alllowed it, but R2 did not.
Something to note somewhere: a comma
, is allowed as replacement for the decimal point. Now because floating point numbers starting with a decimal point are allowed, and on the other hand a decimal point is also allowed in a
word! value, one has the following possibilities:
>> b: load "a,1" print [mold b type? b] [a 0.1] block >> b: load "a.1" print [mold b type? b] a.1 word
It appears that a number starting with a comma does not need to be separated from a preceding word by whitespace.
if <refinement>but when the refinement carries further arguments, one sometimes sees a check on those directly:
if <optional-argument>. I could cite various lines in the Red toolchain code. This works most of the time, since optional arguments which are not present in the call are initialized to
none. However, when the type of the optional argument is
logic!and it IS present in the call as
@meijeru my point was - why separation between refinements and their arguments exist in the first place, if, as far as I know, most refinements use only one argument? You can, in theory, just use refinement value itself as an argument.
func [/refinement argument][if refinement [use argument]] ; refinement is just a flag, argument bears the actual value
func [/refinement][if refinement [use refinement]] ; refinement carries the value AND serves as a flag of its presence
Your example is a "desync" of
refinement and its
argument. In what I described above there's nothing to synchronize in the first place, but... cases where
none! are still tricky.
logic!, then check and use its argument(s), which, by design, may or may not be an actual
VID.red. It is the only example in the whole codebase with a refinement (
/parent) that has 2 arguments... How I know? I did an exhaustive search by program, which is just a variation on the different programs like the concordance that I have previously written..
line widthhere be hyphenated instead?
Is it worth linking to the url wiki definition (or its translations) in the url documentations?
I mean this line:
url!value represents a reference to a network resource and allows for directly expressing Uniform Resource Locators.
deep-reactor!tracks changes not only in series but also in composite scalars (pairs, tuples, date, time). In contrast to
reactor!that does not.