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

World: r3wp

[!REBOL3-OLD1]

Cyphre
14-Nov-2006
[1609]
Sure, ieven AGG2.3 (which Rebol is using) supports high quality downscaling 
of images(among other types of image filters). As I know lot of Rebolers 
would like to generate quality thumbnails ;) I'll try to talk with 
Carl about including this in future versions of Rebol.
Henrik
14-Nov-2006
[1610]
That would shave off a lot of development time for an app, I'm developing. 
Just this one feature. Thanks.
Maxim
14-Nov-2006
[1611]
I'd just like to be able to select transform filters on the fly.
Pekr
15-Nov-2006
[1612]
Gabriele - so if Carl did not forget, then the whole picture of architecture 
is not clear yet, or is it? :-)
Cyphre
15-Nov-2006
[1613]
Pekr: AFAIK Carl is also working on some diagrams so you will see 
the design soon.
Pekr
15-Nov-2006
[1614]
ok, good to know, thanks. I think that many ppl here are waiting 
for R3 already. I believe some would prefer incomplete alpha (complete 
to some degree), to already start testing for bugs, testing interfaces, 
ports, etc.
Cyphre
15-Nov-2006
[1615x2]
Maxim: yes, this is already in current DRAW but only two filters 
are supported. (NN and bilinear)
pekr: I'm sure Carl release the testing version ASAP (ie. when he 
decide it make sense to test it externally)
Pekr
15-Nov-2006
[1617]
your answer implies it is under testing "internally", right? :-)
Robert
17-Nov-2006
[1618]
I'm always wondering why people depend on the next release to start 
their app... take what you have and do it. There is always a way. 
It's like with a team. You got the people you have and good management 
is, to get to the goal with your team you have. Winning with a dreamteam 
is no art.
Maxim
17-Nov-2006
[1619]
Robert, I don't any of us is waiting on R3... we are just waiting 
on it, to test it, as Pekr says.   There are things we cannot fix 
for RT, like view performance, draw crashes, etc.
Henrik
17-Nov-2006
[1620]
I'm always wondering why people depend on the next release to start 
their app... take what you have and do it.
 <--- Precisely!
Anton
18-Nov-2006
[1621]
Some planned things have to wait for features to be implemented. 
But there is so much other stuff that can be done while waiting there 
is no reason to be idle.
Pekr
18-Nov-2006
[1622]
I mentioned "waiting" in another sense though - it was wrong word 
choosed on my side probably, I just meant "awaiting", not "waiting 
for", sorry. And my argument was, that in MY opinion, devs would 
welcome more often, incomplete early alpha releases, than inhouse 
only testing of R3, late release. I very much liked days of Rebcode 
development - I found it very vital cooperation, and it clearly showed, 
that some community folks had very good influence on RebCode architecture 
itself ...
Louis
23-Nov-2006
[1623x2]
rebol [
	purpose: "Demonstrate how to use the findany function."
	note:  {This is a function I would like included in Rebol3.
		One of you experts (I don't remember who) made this function 

                for me, and I use it all the time. Do you see any ways it can
		be improved before I submit it? --- Louis
	}
]

s: "findany will return true if it finds in this sentence any of 
the strings you enter in the request box."
print [s newline]

forever [

 bs: copy parse (request-text/title "Enter the strings you want to 
 find separated by a space.") none

	findany: func [ 
	     "Searches string x for any substring found in block ys."
	     x [string!] "string"
	     ys [block!] "block of substrings"
	    /local pos
	] [
	    foreach y ys [
	         if pos: find x y [return pos]
	     ]
	]

either findany s bs [print true][print false]

]
halt
rebol [
	purpose: "Demonstrate how to use the findall function."
	note:  {This is a function I would like included in Rebol3.
		This is my function. Do you see any ways it can
		be improved before I submit it? --- Louis}
]

s: "findall will return true only if it finds in this sentence all 
the strings you enter in the request box."
print [s newline]

forever [

 bs: copy parse (request-text/title "Enter the strings you want to 
 find separated by a space.") none

	findall: func [
		"Seaches string s for all substrings find in block bs."
		s [string!] "string to search in"
		bs [block!] "block of strings to search for"
	][
		findit: func [
			s [string!] "string to search in"
		        b [string!] "string to search for" 
		][
			if find s b [either find s b [true][false]]
		]
		foreach b bs [either findit s b [true][break/return false]]
	]

either findall s bs [print true][print false]

]
halt
Anton
24-Nov-2006
[1625x3]
Functions like these are very useful to have. I could have used them 
recently while doing file searching.
However, I wouldn't like to see these functions included as is.

- Not very efficient. That's ok  for searching small strings or the 
contents of short files, but bad when searching large files for many 
strings. 

- Not generic. The name suggests many datatypes are supported. Better 
names might be find-any-string, find-all-strings
- The above FINDALL does not keep FINDIT as a local.

- The argument names are too short, so they are not distinct or descriptive 
enough.

- The return values are not defined clearly in the function doc strings. 
The above issues are fixable, but it will take some time.
(Actually, the efficiency issue will take the most time to resolve.)
(... but, most important is defining the user interface and functionality 
clearly, as well as eliminating undesireable side-effects.)
Louis
24-Nov-2006
[1628]
Who can make these functions the most efficient, and display them 
in a benchmark program to prove it? And correct all the other problems 
mentioned by Anton.
Anton
24-Nov-2006
[1629x2]
Yes.... "who ?".... :-)
The above find-any suffers from this problem, which needs at least 
to be documented in the function description.
	>> pos: findany "hello cat dog license" ["dog" "cat"]
	== "dog license"

("cat" appears before "dog" in the input string, but because "dog" 
was searched first, it was returned first.)
Maxim
24-Nov-2006
[1631x2]
this is the same limitation as in parse which is not optimal, IMHO.
the 'ANY in the name implies any of the options are equivalent, so 
its the first in the input which is the desired return value, as 
anton points out.
[unknown: 5]
24-Nov-2006
[1633]
Louis, the way I benchmark in REBOL is to do a trace count.  In other 
words if the execution of the trace generates more output than another 
method then I assume that method is less efficient.
Anton
25-Nov-2006
[1634x4]
Stayed up all night, and succeeded in making a parse rule generator, 
so if we want to search a string for any substrings:

string: {Hello there Anton. Arrow in the box. What nice antlers you 
have.}
substrings: ["ant" "antler" "anton" "arrow" "bar" "box"]

rule: [start: [["a" [["nt" action ["ler" action | "on" action]] | 
"rrow" action]] | ["b" ["ar" action | "ox" action]]] | skip]
Found at: 13 Substring: "Ant"
Found at: 13 Substring: "Anton"
Found at: 20 Substring: "Arrow"
Found at: 33 Substring: "box"
Found at: 48 Substring: "ant"
Found at: 48 Substring: "antler"
true
So you can see the rule is built from the substrings.
Thus we are able to search large files for any number of substrings 
in a single pass parse. :)
(very happy about this..) I'll clean it up and publish it probably 
later tonight.
Jerry
25-Nov-2006
[1638]
Nice job. Anton.
Anton
25-Nov-2006
[1639]
Thankyou, Jerry. I wonder if anyone else made a parse generator like 
that ?
Louis
25-Nov-2006
[1640x3]
Maxim and Anton, what difference does it make which value is returned? 
It is the true or false that I am looking for. If any of the strings 
are found, why look any farther? I'm sure you guys have a reason, 
but I want to know what it is.
is returned = is returned first
If you keep looking after already having an answer, how can that 
be more efficient?
Anton
25-Nov-2006
[1643x4]
Well, that functionality works perfectly for your case, but there 
are many other cases where the position of the match(es) is also 
wanted.
.. and a name like FINDALL suggests that it returns those matches.
Your functions might better be named:  ANY-SUBSTRINGS? and ALL-SUBSTRINGS?

FINDANY and FINDALL might be fine for personal use, but to get acceptance 
out in the community, the names should be more accurate.
For the single-pass parse, the action can be defined by the user 
to either continue or break the parse. (So FINDANY would break, whereas 
FINDALL would continue.)
Louis
25-Nov-2006
[1647x2]
OK, it really doesn't make any difference to me what the functions 
are named, as long as the names are easy to remember.
But I would really like to see funtions that find-any-substring and 
that find-all-substrings included in REBOL3, as they make programming 
a lot easier---at least for me.
Maxim
25-Nov-2006
[1649x3]
Louis, hehe you'll eventually realize that semantics in rebol are 
pretty important... simply because Carl puts soooo much effort I 
guess it all makes us anal about it  ;-)
in parse, a good example of where the index creates many problems 
is when you use the 'TO or 'THRU words.
they jump exactly like the above... and well it makes them much less 
usefull within the context of trying to get to the next value of 
"equivalent" values.
Louis
26-Nov-2006
[1652x2]
Maxim, I see. Thanks for the explanation. It will be interesting 
to see Anton's function.
You guys a way more advance to me. That is why I hang out here---I 
get help when I get stuck. And by the way, thanks to all of you guys 
for the help.
Gregg
26-Nov-2006
[1654]
Anton, my LIKE? function generates parse rules, but I doubt it's 
as advanced as yours, since it's just meant for simple pattern matching 
and doesn't deal with multiple search targets.
Anton
26-Nov-2006
[1655]
Gregg, I think I recently made a function probably similar to your 
LIKE?.  Have you published that somewhere ?

But yes, multiple search terms are the next level up. To get the 
full range of matching rules with multiple search terms will take 
some work, however the basis is there.
Anton
27-Nov-2006
[1656]
Ok, here it is:

http://anton.wildit.net.au/rebol/library/string-search-functions.r


do http://anton.wildit.net.au/rebol/library/demo-string-search-functions.r
Gregg
27-Nov-2006
[1657]
It's on REBOl.org. I finally decided to publish it (it's old) when 
I published my file-list script, which uses it.
Louis
27-Nov-2006
[1658]
Anton, I think line 437 should be:

	find-every-string: func [