• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[Rebol School] REBOL School

Sunanda
11-Mar-2013
[1718]
Nick -- Have you looked at using a variable base algorithm? It may 
be fast, and it should be amenable to windowing:
   http://rosettacode.org/wiki/Permutations/Rank_of_a_permutation
Even if neither, it should be fun to write the script.
Ladislav
11-Mar-2013
[1719]
FOR ... is a complex mezzanine in R2
, with a lot of bugs, I have to add
BrianH
11-Mar-2013
[1720x2]
Agreed :(
Do you have a non-buggy version? I'd love to add it to rebol-patches, 
with your permission.
Ladislav
11-Mar-2013
[1722x3]
Hmm, I do (I once submitted it to Carl, but he never used it). Nevertheless, 
in my code I prefer a general loop called CFOR (the name is unfortunate, 
I must admit). That is what I propose instead since it is both faster 
and more flexible at the same time. Do you think it makes sense to 
propose it in the CC?
Any good idea of a Rebol-compatible name for it?
The trouble with FOR is not only that it has bugs. Another problem 
is that it is incompatible with REPEAT, while assumed to be a generalization 
of it...
BrianH
11-Mar-2013
[1725]
I remember CFOR, it was interesting. It's not FOR compatible though. 
What I was hoping to put in rebol-patches was a function with the 
same API as FOR, but without the bugs. Additional functions are great 
too, but out of scope for the rebol-patches project.
Ladislav
11-Mar-2013
[1726]
Hmm, I actually do not propose to use my patched FOR since it is 
extremely slow like the original, I think it would make more sense 
to use a more REPEAT-compatible version of it, which I do not have 
now.
BrianH
11-Mar-2013
[1727x2]
I don't recommend using FOR in R2, patched or not, but I would rather 
have a patched version than a non-patched version. That's the whole 
point to rebol-patches. I don't judge the functions in some philosophical 
or practical way, I just make sure they at least work.
Better functions are more the purview of other projects.
GrahamC
11-Mar-2013
[1729]
Is 'for used much at all?
Ladislav
11-Mar-2013
[1730x3]
or, to tell it differently: I prefer to have a version of FOR which 
would be more R3 FOR compatible...
(instead of patching the R2 FOR, which I do have patches for, but 
which is extremely slow)
FOR is not used in R2 (at least I never recommended its usage) because:

* it is buggy
* it is extremely slow
BrianH
11-Mar-2013
[1733x2]
Can that be done without breaking too much code? Because if so, that 
would definitely be in the project scope. A native FOR replacement 
would be ideal, but we can't change existing R2 versions to have 
always had such a function in the past. The rebol-patches project 
is for bringing up the compatibility and fixing known bugs when run 
on existing R2 versions. I hope to push its compatibility all the 
way back to 2.5.0. Replacing FOR with a non-buggy native version 
in some future R2 release would just mean that for that version going 
forward rebol-patches wouldn't need to patch that particular function.
So unless you have a way for rebol-patches to perform a retrofit 
of an existing R2 version with a new native function using cross-platform 
code, we're going to need not only the mezz patch for the past and 
the native for future R2 releases (if any).
Ladislav
11-Mar-2013
[1735x2]
I did not mean native. I just meant mezzanine FOR but implemented 
differently.
(to behave more like the native FOR in R3 or REPEAT in R2)
BrianH
11-Mar-2013
[1737x2]
OK, cool. Will it have the same external API, so that if it is used 
in the same way (without obscure hacks) it will do the same thing? 
I'm OK with changing its behavior when you change the variable in 
mid loop, as long as that isn't commonly done in R2. If it's too 
incompatible that would be more something to put in R2/Forward (I'm 
spliting the fixes from the major changes).
How would it be different? Do you have a link to one of those articles 
you write about this kind of thing? :)
Ladislav
11-Mar-2013
[1739]
OK, I will try to write it as I think it should be both faster and 
less buggy.
BrianH
11-Mar-2013
[1740]
Apache license OK, same as R3? I know it's for R2, but it makes the 
contributor rights more clear.
Ladislav
11-Mar-2013
[1741]
Sure
BrianH
11-Mar-2013
[1742]
Before you ask, the MAP-EACH fix is going in there too :)
GiuseppeC
13-Mar-2013
[1743x5]
I will help to make the new REBOL !
Until then I need your help:
I whish to re-learn REBOL from scratch starting from REBOL3
I have understood that until now I have looked to REBOL with the 
eye of the "old-style-programmer"
I apologize for avery stupid question I'll make in the following 
weeks/months.
Arnold
13-Mar-2013
[1748]
no stupid questions exist. Mostly more stupid not to ask them, as 
only then they can help you to understand.
Sunanda
13-Mar-2013
[1749]
SKIP's offset arg can take a pair!  -- Can someone show me an example 
of doing that?
GrahamC
13-Mar-2013
[1750]
that's for moving across a bitmap isn't it?
Sunanda
13-Mar-2013
[1751]
That's what I'd like to know :)
GrahamC
13-Mar-2013
[1752]
let me scan my source code
Sunanda
13-Mar-2013
[1753]
Also interested in usage example for TAKE/DEEP where the /deep can 
be a pair!
GrahamC
13-Mar-2013
[1754x2]
auto-crop-bitmap-text: func ["Returns a cropped image, or none if 
the input image was blank"
	image [image!] 
	/local region
][
	if region: find-bitmap-text-crop-region image [ 

  copy/part skip image region/1 region/2  ; return a cropped image
	]
]
not sure if that's what you're after
Sunanda
13-Mar-2013
[1756]
Thanks......I can see now how SKIP can work on an image bitmap
    img: to-image #{....plausible hex stream....}
    skip img 2x2


However, TAKE does not work on image bitmaps.....Are there other 
types of bitmap?
BrianH
13-Mar-2013
[1757]
The bitset type could be thought of as a one-dimensional bitmap of 
depth 1, but that's stretching the defitnition a little :)
Sunanda
14-Mar-2013
[1758]
:)
Is TAKE intended one day to work on image bitmaps?
Or is there another use for:
     TAKE/DEEP word 10x10
BrianH
14-Mar-2013
[1759]
No, because TAKE removes from the original, and that would change 
the dimensions of the original in the case on an image, assuming 
it's possible (you can't take a hole from the middle, for instance). 
So you mean COPY/part here.
Sunanda
14-Mar-2013
[1760]
My confusion is due to the help for TAKE saying the /DEEP arg can 
take a pair! -- So I was looking for a usage case.
BrianH
14-Mar-2013
[1761x2]
Well, maybe it was intended to work on image (if so, sorry). I'd 
have to review the R2/Forward code to be sure, since its version 
of TAKE would have replicated that. It's a really weird thing to 
do to an image though.
The R2/Forward TAKE makes reference to an image in its code, but 
not in its typespec. Weird. A bug?
Bo
14-Mar-2013
[1763]
BrianH: If I wanted to take a subsection of an image, why wouldn't 
it create a new image with just that subsection, and then replace 
the "taken" part in the old image with 0.0.0?  Or am I understanding 
the purpose of 'take incorrectly?
GiuseppeC
15-Mar-2013
[1764x2]
First question about REBOL(£):
Is there an article which explains how REBOL3 loads words in memory 
and how their are organized, stored, evaluated ?
Sunanda
16-Mar-2013
[1766]
Here's a starting point for such an article.....
   http://www.rebol.com/docs/expert-intro.html
BrianH
16-Mar-2013
[1767]
Bo, TAKE physically removes stuff, it doesn't leave a hole.