r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3-OLD1]

Henrik
13-Feb-2009
[11204]
Then I think the name is misleading. Or will there be a FIND/ALL?
BrianH
13-Feb-2009
[11205x2]
There may be, and it could be useful with /skip.
FORFIND perhaps?
Henrik
13-Feb-2009
[11207x3]
That could be, or as a step argument to FOR.
(who says step must be a constant?)
then again, how would one pass it. it seems that FOR already uses 
series! as step input.
Steeve
13-Feb-2009
[11210]
eh guys, if you continue like that, i guess you will rediscover parse
BrianH
13-Feb-2009
[11211]
This kind of function is usually easier to implement as a mezzanine.
Henrik
13-Feb-2009
[11212]
Steeve, I know. You can do everything with PARSE in only 10 times 
as much code as with a single mezz. :-)
Pekr
13-Feb-2009
[11213]
Parse - we first need all those handy enchancements being implemented 
:-)
BrianH
13-Feb-2009
[11214]
R2 backports of the R3 reflection functions are now done.
Pekr
13-Feb-2009
[11215]
So - are we heading towards new R2 release?
BrianH
13-Feb-2009
[11216x3]
That's REFLECT and its associated *-OF functions. Yes, gradually, 
as R3 gets fuurther along. The backports can be used with existing 
releases though - I'm bundling them all into %r2-forward.r.
I also backported CAUSE-ERROR, which triggers errors safely.
Also the proposed QUOTE and ACCUMULATE.
Steeve
13-Feb-2009
[11219x2]
quote ?
accumulate -> cumul (shorter name)
BrianH
13-Feb-2009
[11221x4]
QUOTE is a Peta special, a simple function to perform a nasty trick 
in as little code as possible. It blocks evalation :)

; R3 version
quote: func [
	"Returns the value passed to it without evaluation."
	:value [any-type!]
] [
	:value
]

; R2 version
quote: func [
	"Returns the value passed to it without evaluation."
	:value [any-type!]
] [
	get/any 'value
]
It's like the Scheme function of the same name.
evalation -> evaluation
CUMUL is not an English word (but let me check). I picked ACCUMULATE 
because it is the industry standard (for procedural langs).
Steeve
13-Feb-2009
[11225]
oh sorry it's french (i tried)
BrianH
13-Feb-2009
[11226x2]
We are not going the Perl 6 route :)
I'm checking a thesaurus.
Steeve
13-Feb-2009
[11228]
and ACCU ?
BrianH
13-Feb-2009
[11229]
GATHER perhaps?
Steeve
13-Feb-2009
[11230]
http://en.wikipedia.org/wiki/ACCU
Henrik
13-Feb-2009
[11231]
BrianH, check #1804, for a GATHER function that does something else.
BrianH
13-Feb-2009
[11232x4]
That sounds like a better function to call GATHER. ACCUMULATE will 
get called less than that.
It could use the /into option though.
With all of these collection synonym functions it will be interesting 
to keep them straight.
Use FORALL for the R3 version of GATHER - FORALL is faster than FOREACH 
in R3.
Henrik
13-Feb-2009
[11236]
ASSEMBLE might be a nice word to reserve.
Steeve
13-Feb-2009
[11237]
Could be disturbing for beginners, a same thing can be writed  using 
so many various ways with the tons of mezz we have now.
BrianH
13-Feb-2009
[11238]
Yeah. For an assembler :) We want reserve COMPILE too :D
Henrik
13-Feb-2009
[11239]
Steeve, you have a point. For a couple of years, I would write mezzanines 
for things that already existed in R2, but hadn't noticed.
Steeve
13-Feb-2009
[11240]
ahah, shame on you ;-)
BrianH
13-Feb-2009
[11241]
I'm converting GATHER to mezzanine/library code standards now. We'll 
probably put all of these is an advanced series manipulation library 
module.
Steeve
13-Feb-2009
[11242]
types-of is ugly Brian :)
BrianH
13-Feb-2009
[11243x2]
You have no idea. TYPES-OF was the only reflector that had no corresponding 
hack in R2. I had to do it from scratch.
Mezzanine-quality version of Henrik's GATHER, R3 version:

gather: func [
	"Get the values of a given field from all objects in a block."
	block [block!]
	word [word!]

 /into "Insert into a buffer instead (returns position after insert)"
	output [series!] "The buffer series (modified)"
][
	unless output [output: make block length? block]
	forall block [
		all [
			object? block/1
			in block/1 word
			output: insert/only output select block/1 word
		]
	]
	either into [output] [head output]
]
PeterWood
13-Feb-2009
[11245x3]
Has the spec for make function! been changed on purpose in R3? Is 
for what reason?
Is => if
>> a: make function! [spec] [body]

** Script error: cannot MAKE/TO function! from: function!

** Where: make

** Near: make function! [spec] [body]

>> my-func: make function! [[b] [print b]
]
== make function! [[b][print b]]
BrianH
13-Feb-2009
[11248x2]
Yes. Reason: To simplify and speed up MAKE, and REBOL, and to make 
code generation easier.
Use the wrappers if you want to be R2 compatible.
Steeve
13-Feb-2009
[11250]
Brian, are you sure that (output: insert/only output ..) is faster 
than (append/only output) in R3 ?
BrianH
13-Feb-2009
[11251]
No, it's not, but not by much and it's necessary for the /into option.
Steeve
13-Feb-2009
[11252]
ah yes, i forget
BrianH
13-Feb-2009
[11253]
Strangely enough the REBOL overhead of the /into option (one UNLESS, 
one EITHER, and n assignments) is dwarfed by the overhead saved if 
the /into option is implemented pervasively.