Bonsoir Jean-Louis,
having read and experimented a little bit a few remarks and questions:
* "Trampoline": that's really cool as recursive functions become computable
that otherwise would
not be able to run due to not enough control stack space as your factorial
example nicely
demonstrates. I ran a classic recursive factorial and the trampoline
version up to 1300!
increasing numeric digits to yield an exact result (going higher factorials
will blow up the
control-stack in the classic version, where the trampoline version happily
hums away).
* "Partial arguments": this looks very interesting. However, I have been a
little bit surprised
that the creation of the final argument array does not append the new
arguments to the partial
ones and also leaves out array entries that are empty. Why is this? It may
be the case that for
some analysis it becomes important to be able to learn whether an argument
was omitted or not.
* "Higher-order functions": are the following basic definitions correct?
o "reduce": iterates over the items of a collection and supplies them one
by one as an
argument to the block processing/accumulating them in one way or the
other.
o "each": iterates over the items of a collection and returns an array in
which each visited
item was processed according to the RexxBlock,
o "map": iterates over the items of a collection and returns the
collection in which each
visitied item was processed according to the RexxBlock,
o "reduceW" is "reduceWords", "reduceC" is "reduceChar", "mapW" is
"mapWords", "mapC" is
"mapChars", "eachW" is "eachWords", "eachC" is "eachChars": they are
available for .String
and .MutableBuffer and there as a convenience (assuming that one could
always create an
array of words or chars from a string and then use "reduce", "map" and
"each" on them)?
* "Higher-order functions":
o What are "mapR" and "eachI" for?
o What are "mapCR", "mapWR", "eachCI", "eachWI" for?
o functionDoer will get two named arguments "value" and "index" and in
the case of "reduce"
these two arguments will be preceded by an argument (frist argument)
representing the
current value. It would be probably helpful for the ooRexx programmer,
if "value" was named
"item" as this is the term used in the ooRexx documentation for
collections.
* ad "filter": what is a filter and where and how can one use it?
* ad "times", "times.yield", "resume": for which objects are these methods
defined and what do
they do?
* ad using block syntax without surrounded by round parentheses: it seems
that one can state
~map{expression or code with return-statement} instead of ~map({expression
or code with
return-statement}): is this intentional (it would break the simple rule
that if a method gets an
argument this argument needs to be enclosed in round parentheses) ? E.g.
from your readme.txt:
"abcdefghijk"~mapC{arg(2)":"arg(1)" "}
* expressions implicitly returning a value: if a RexxBlock only consists of
an expression, then
the result of the expression will be returned, e.g. "12"~times({arg(1)/2})
which is the same as
"12"~times({return arg(1)/2}). This is probably intentional, still thinking
whether I like it or
not (the return-keyword statement is one that every Rexx programmer is
accustomed to and that
explicitly documents what the code is supposed to do; not having a return
keyword statement
should cause a runtime error if a result is expected; the implicit return
is probably not really
"Rexxish", although neat in this particular context, which is probably
restricted to RexxBlocks?).
A last question related to Pipelines (have not yet come to this corner): is
this an adaptation of
the ooRexx "samples\pipe.rex" where you "just" employ closures and
coactivities? It looks like that
(seems to supply a ".do" stage allowing deifning RexxBlocks, which is very
powerful; also a stage
named .inject and .drop? Maybe .console etc.).
TIA,
---rony
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel