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

World: r3wp

[!REBOL3-OLD1]

BrianH
12-Mar-2009
[11960x2]
LIST-DIR is one of the console interactive functions, so it is acceptable 
for it to have an optional parameter without a refinement - otherwise 
you should avoid that method. The function you should use inside 
code, rather than interactively, is READ.
LIST-DIR currently needs work (mostly better formatting), but the 
behavior you describe is by design.
Steeve
12-Mar-2009
[11962x2]
In R3, have we a function to replace a list of values by anorther 
one currently ?
(don't remember)
in a string
Robert
12-Mar-2009
[11964]
Can someone enlighten me: Will we have the Wiki and Carl's R3 docs 
side-by-side? Isn't that a double effort? I don't get it.
Geomol
12-Mar-2009
[11965]
About LIST-DIR:

R3 have some UNIX kinda commands, like ls. I think, Carl was tired 
of typing:
list-dir %script
and just wanted to type:
ls script


But it doesn't work with /c, because it's seen as a refinement datatype, 
and ls doesn't allow that. It's a mistake, as I see it. You can do 
it by:

myls: func ['path] [ls (form path)]
myls /c
PatrickP61
12-Mar-2009
[11966]
Thanks for your comments Brian, Steeve and Geomol
BrianH
12-Mar-2009
[11967x4]
Geomol, refinement support sounds like a good idea, but it was left 
out on purpose because /c would work but /c/d would not. It is better 
to get people out of the habit now than it is to have to explain 
why /c/d doesn't work, over and over again.
Steeve, try REWORD - it is not a modifier though, it builds a new 
string.
There is a plan to add this as an option to REPLACE as well, and 
that is a modifier.
Robert, the R3 docs are a manual, while the wiki is community-generated 
articles and such. Not the same thing.
Steeve
12-Mar-2009
[11971x4]
hmmm... reword doesn't fit well in my case.

i want to replace sequences of replace/all on the same string. I 
saw this scheme in many scripts (not mines of course:)

replace/all data ... ...
replace/all data .. ...
replace/all data ... ...

Cirst attempt could be:

foreach [this by] values [
	replace/all data this by 
]

but it would be slow.
hmm... it works with reword with an empty escape option:

>> reword/escape "Hello you" [#"l" #"L" #"o" #"O"] ""
== "HeLLO yOu"
In fact, i don't see the need of  an escape caracter by default ("$"), 
it should be the reverse.
For the case of only replacing chars by another ones, reword build 
to much overhead
BrianH
12-Mar-2009
[11975]
Like I said, there are plans to make a modifier version of REWORD 
as an option of REPLACE. The escape character makes sense for template 
word substitution use, the main purpose of REWORD - it was Carl's 
idea.
Geomol
12-Mar-2009
[11976]
Brian, makes sense with the refinement and ls. :-)
BrianH
12-Mar-2009
[11977x2]
Steeve, one of the problems with multiple value replace is that there 
are basically two ways to do it:

- One value/replacement pair at a time (like your FOREACH loop above).

- In order using either an inner loop of FIND/match calls, or PARSE 
rules and alternation.

Neither of those are very efficient, but the PARSE rules tends to 
be more so, at the expense of building the rules. REWORD uses the 
compiled PARSE rules method. Most of its overhead is working around 
bugs in map! or going away with new REBOL features. If we do an inplace 
replacement, we'll have the same overhead. The only solution is to 
optimize the runtime, or hand-write the PARSE rules.
I've basically decided to bite the bullet and optimize the runtime. 
The feature requests and bug reports that came from implementing 
REWORD will be much more valuable than REWORD itself. That's why 
I wrote it :)
Steeve
12-Mar-2009
[11979]
i make a proposal:

Most of the times, we use the same rules several times on different 
data.
reword should be able to not reconstruct the rules if so.

I used the similiar tricks in some scripts, for example:

map-chars: func [
	{replace/all pair chars in a string}
	data [string!] values [block!]
	/local chars pos
][

 ;** if the first value in values is a bitset, do not reconstruct 
 the bitset
	unless bitset? chars: first values [
		chars: make bitset! 256
		forskip array 2 [append chars array/1]
		insert values chars
	]
	pos: data
	values: next values

 while [pos: find pos chars][pos: change/part pos select/skip values 
 first pos 2 1]
	data
]

data: "Hello You"
map-chars copy data values: [#"s" "SS" #"t" #"T"] 
;** the second call is faster
map-chars copy data values
[unknown: 5]
12-Mar-2009
[11980]
Cool Steeve.  You should be a way bigger part of the REBOL team.
BrianH
12-Mar-2009
[11981]
Replacing single characters is all you need? That isn't general enough 
to make it into REBOL, but it might be a good library function.
Steeve
12-Mar-2009
[11982]
bah, to be here and in Rebdev is good enough for me
BrianH
12-Mar-2009
[11983]
You do help already :)
Steeve
12-Mar-2009
[11984x2]
Brian, it was just an example to show reusable rules
In your case, it could be an object or a parsing rules instead of 
a bitset
BrianH
12-Mar-2009
[11986]
I like functions that generate functions, if that helps :)
Steeve
12-Mar-2009
[11987]
yes or a funtion :)
Geomol
12-Mar-2009
[11988]
Playing with icons: http://www.fys.ku.dk/~niclasen/rebol/R3/icons.png
Robert
13-Mar-2009
[11989]
Docs/Wiki: I know the difference. How much content is overlapping? 
I see a problem if we maintain two lanes of documentation regarding 
concepts etc.


It's again the fragmentation problem that makes it so hard to get 
R2 details collected and structured.


IMO the Wiki is one of the best things that happend to Rebol. Finally 
most information in one place.
[unknown: 5]
13-Mar-2009
[11990]
Cool John.  I favor a glosser look myself.
Henrik
13-Mar-2009
[11991]
http://hmkdesign.dk/r512.png

An old icon I did a few years ago.
Geomol
13-Mar-2009
[11992]
Henrik, that font is closer to the old icon. Did you create it or 
got it from somewhere?
[unknown: 5]
13-Mar-2009
[11993]
Looks good also Henrik.
Henrik
13-Mar-2009
[11994]
I made it in SVG. I can't remember how I did the R, but I think I 
took an Arial Bold and made some adjustments.
[unknown: 5]
13-Mar-2009
[11995x2]
I like John's R a bit better.
But I like the size of Henrik's.
Henrik
13-Mar-2009
[11997x2]
There is also an r256 and r128, if you want to compare sizes.
But I guess we can't cheat. Was the requirement that we did the icon 
in DRAW?
Geomol
13-Mar-2009
[11999x2]
I don't think so. Carl just said, we plan to go with an old script 
and change colors in that.
we = he
Henrik
13-Mar-2009
[12001x2]
Geomol, I made a very primitive SVG importer for R3. it can only 
handle one shape in one color, but it's nice if you need to draw 
it by hand. If you need it for complex shapes, let me know.
http://rebol.hmkdesign.dk/files/r3/gui/093.png

Some shapes in this image was done that way.
Geomol
13-Mar-2009
[12003]
Ok, I'm waiting for some reply from Carl, if he needs any of our 
help.
Pekr
13-Mar-2009
[12004]
We should start to write-down our wishes for View/VID imo, maybe 
we are close when Cyphre will be called to continue his work :-)
PatrickP61
13-Mar-2009
[12005]
I have some questions regarding timestamps on files.  They look like 
they are all GMT and don't take into account what time zone you are 
in.

To my way of thinking, they probably should default to what the system 
is doing.
For example:
Create any file TEST.r in your what-dir
>> GET QUERY %TEST.r

== [%TEST.r 7329 13-Mar-2009/20:26:42.429 file]		<-- notice the timestamp 
is not CST where I created this at 3pm, not 8pm

If you look at the file through Windows Explorer, you will see it 
is dated at the local time, not GMT.

Do I need to subtract 5 hours (DST) or 6 hours, depending upon my 
timezone and if we are on Daylight saving time?
Do we have some refinements or another way to handle that?
Pekr
13-Mar-2009
[12006]
WTF .... while sitting in a pub, having my 3rd good Czech beer, I 
plugged my USB pen in, started R3 and run Demo. I looked at what 
it does so many times, but never looked at the source. While VID 
3.4 contains only basic styles, when looking at various panels, I 
always thought - the code for this screen has to be some 5 pages 
long. WTFonce again - 10 - 15 lines of code with such a functionality? 
Awesome .... I think I will become even more REBOL fanatic ;-) ... 
Cheers :-)
Graham
13-Mar-2009
[12007]
You sure it was only 3 glasses of beer??
Pekr
13-Mar-2009
[12008x2]
yes, of course, now fourth! But beware - Czech beer is very special 
:-)
... but really, looking at SharePoint portal sources last week, and 
now into VID source, is quite a difference. I think that most of 
the systems out there, especially the big glory web and JS - are 
just - crap.