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

World: r3wp

[I'm new] Ask any question, and a helpful person will try to answer.

Normand
12-Jul-2006
[360]
Multiple refinement functions :  I need to formulate a function with 
more than one refinement.  I know in Rebol we usually use the word 
'either to formulate them, but with more than 3 refinements (and 
its following default case) it becomes tedious.   Structures like 
'record-operations: func [/delit /addit /modit] [ either  delit [print 
"delete"] [either addit [print "add"] [either modit [print "modify"][print 
"no refinement"]]]]'  are overly complicated.  I would like a more 
flat structure, to be able to distinguish the conditions which are 
independants from the ones mutually dependants, albeit mutually exclusive. 
 I tried multiple if's but that does not seem to work.  What are 
the good options to code multiple refinements functions.  The mail 
list does not seem to have an example discussing just that.  And 
in the source, most functions with multiple refinements are native.
Sunanda
12-Jul-2006
[361]
Multiple ifs should work....
   if addit [addit code termined with a return]
  if modit [ modit code terminated with a return]


If you have multiple refinements that make up one logical unit, try 
something like this:


f: func [/a /b /c /d] [if all [a b c] [print 'abc return true] print 
'not-triggered]
f/a
not-triggered
f/b/c/a
abc
true
Geomol
12-Jul-2006
[362]
If you allow more than one refinement at a time, an approach is to 
build up the code in a block, depending on the refinements (using 
if), and then evaluate the block at the end of the function. Example:


f: func [/a /b /c] [blk: copy [] if a [append blk [print "ref a active"]] 
if b [append blk [print "ref b active"]] if c [append blk [print 
"ref c active"]] do blk]

>> f/c/a
ref a active
ref c active
Anton
12-Jul-2006
[363]
How about this ?
f: func [/aref /bref /cref /local refs symbs][
	refs: copy [aref bref cref]
	symbs: copy []

 forall refs [if get refs/1 [append symbs to-char #"a" - 1 + index? 
 refs]] ; convert to #"a" #"b" #"c" ...
	switch rejoin symbs [
		"abc" [print "All of them"]
		"ac" [print "Just A and C"]
		"b" [print "Just B"]
	]
]
Normand
12-Jul-2006
[364]
Thanks for those answers.
Anton
13-Jul-2006
[365]
Using an issue (or could be a string) instead of a block:

f: func [/aref /bref /cref /local refs symbs][
	refs: copy [aref bref cref]
	symbs: copy #

 forall refs [if get refs/1 [append symbs to-char #"a" - 1 + index? 
 refs]] ; convert to #"a" #"b" #"c" ...
	switch symbs [
		#abc [print "All of them"]
		#ac [print "Just A and C"]
		#b [print "Just B"]
	]
]
Ingo
13-Jul-2006
[366]
Newer version also have case ...

case [
 aref [ print 'aref]
 bref [print 'bref]
 true [print 'default]
]
Maxim
13-Jul-2006
[367x5]
normand,  a lot of us forget about the two following words:  ANY 
  ALL
they are extremely powerfull when used together in cascade, and allow 
you to bake many ifs and eithers into one line of code:

ANY   stops evaluating an expression while it encounters none! values,
ALL   stops evaluating at the first none! value it encounters.
here is an example for handling multiple non-exlusive switches:


lets say you have refinements /a /b /c /d.      /d is mutually-exlusive 
to all others and a + b reacts differently than when alone... trying 
to wrap that in if/either can be a nightmare, and its impossible 
using case or switch... BUT using any/all actually makes it quite 
visual and simple to see flow:
option:	ANY [
	ALL [d (print "Exclusive d submitted") 1]
	ALL [a b (print "A and B supplied together") 2]
	ALL [a (print "A alone") 3]
	ALL [b (print "B alone") 4]
	0
]

if d [print "D also specified" option: option + 10]
here, the first occurence of any possible refinement combination 
returns a number, the trailing 0 is there so that ANY does not return 
none (which could also be what you want)

the /d is checked a part since its not exclusive.
Normand
14-Jul-2006
[372]
Glad to see that in Rebol there are many ways to Rome.

Alphabetical sort - Is there a built-in way to obtain the right sort 
order for the french language.

a b c d e é è ë f g ... I dont see it as a 'sort refinement, and 
'am a bit surprised.  Else why fuss with 8 bit chars?  So I suppose 
it is there, but don't see it.

In plain sort, the accented caracters are coming last! a: [é è ê 
ë a c b d e g f h i k j l m n p o q r t s u v x w y z]   sort a
== [a b c d e f g h i j k l m n o p q r s t u v w x y z è é ê ë]
Volker
14-Jul-2006
[373x2]
Sort sorts only by ascii, the other things you need to compare yourself.
Else why fuss with 8 bit chars
 - erm, to display such chars, for example in altme?
Sunanda
15-Jul-2006
[375]
Sorting.....Check this thread. It contains worked solutions for correct 
sorting in Hungarian. French should be similar:

http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlMWWJ
Anton
15-Jul-2006
[376]
Surely French rebolers have dealt with sorting... Have you checked 
rebolfrance  ?
Normand
16-Jul-2006
[377]
Ill do. Thanks.
BenK
18-Jul-2006
[378]
HNewbie here and considering purchasing View/Pro. Not rich so I was 
wondering, will I have to pay again when Rebol3 comes out?
Gabriele
19-Jul-2006
[379]
licensing for R3 hasn't been discussed at all so far. you should 
probably ask your question to cindy at rebol dot com.
Pekr
19-Jul-2006
[380x2]
isn't it preliminary to talk about licensing of R3, when even alpha 
was not posted? :-)
(so we don't know much about architecture, I mean - e.g. language 
extensibility via plug-ins ..)
BenK
19-Jul-2006
[382]
I'll ask Cindy: only thing I wish to know is if DLL access is not 
free in R3 if there will be a (cheap) upgrade path for R2 licensees.
james_nak
19-Jul-2006
[383]
BenK, I waited a real long time to purchase Pro/sdk but glad I did 
as I had a project come up that required binding my app into a simple 
to use .exe.
BenK
19-Jul-2006
[384]
Well, I have no such requirements, no commercialisation of anything 
I write (it's just for my own and my family's use) so there's no 
way I can justify coughing up much money; just looking for the bare 
minimum I can get away with
Henrik
19-Jul-2006
[385]
good question on the licensing. I'm also about to buy the SDK and 
it would be nice to know how much it's going to be worth until a 
3.0 SDK comes out.
BenK
19-Jul-2006
[386]
If Cindy answers, I'll pass it on here...
BenK
24-Jul-2006
[387]
For thos einterested: just received e-mail from Cindy stating that 
there will be a (cheaper) upgrade path to R3 for R2 licensees, butno 
details available just yet.
xavier
13-Jan-2007
[388]
.
RayA
31-May-2007
[389]
G'day,
Pekr
31-May-2007
[390]
hi :-)
RayA
31-May-2007
[391]
I'm new to REBOL (discovered it by accident searching for internet 
operating systems) and was pleasantly surprised to discover this 
powerful language/environment with an active/passionate community. 
I'm not a programming guru, but would like to understand the language/environment 
and the types of applications it is good for (and not good for). 
So would anybody be able to point me to the "idiot's guide to REBOL"? 
Does REBOL provide architecture documentation/guidelines and/or frameworks 
for the development of scalable, fault tolerant, manageable, with 
hot code swapping for soft real-time 24x7 applications? Thank you 
in advance for your recommendations.
Pekr
31-May-2007
[392x5]
heh, huh, tought questions :-)
Well, you joined our community in the correct time, for us we are 
close, actually very close to change REBOL millenium. 1.June there 
will be REBOL 3 released to selected developers. REBOL 3 is BIG change 
in architecture, for the good of course!
We will get things like threading, most of the stuff is going to 
be open-sourced, we will be able to extend rebol by own components, 
modules will be available too, and many other changes.
For things that do exist:

Resources:

- http://www.rebol.com- corporate site, you will find docs linked 
there

- http://www.rebol.net- developer's central. Sadly site was much 
more rich, but there was a server crash some time ago. But - still 
valuable rources - test releases, Carl's blogs, RAMBO bug database 
etc.
ah, and I forgot - http://www.rebol.org- script archive, mail list 
archive
RayA
31-May-2007
[397]
Good, I guess I can go straight to REBOL 3! Will there be documentation, 
tutorials, architectues, etc. etc?
Pekr
31-May-2007
[398x4]
yes, of course, there should be. Part of the project is - DevBase, 
DocBase. DocBase is going to be based upon MediaWiki. I suggest you 
to install latest View release and then run Carl's DevCon slides. 
DevCon was held in Paris few weeks ago. Videos should be available 
shortly.
http://www.rebol.com/notes/devcon07-carl.zip
R3 should be released to public July 15. Of course there will be 
some bugs to sort out, some things to finish, etc. In the meantime, 
you can study some docs - most things will stay valid. It is not 
change in philosophy, whole architecture will just get much stronger.
Now for some frameworks:
RayA
31-May-2007
[402]
Thank you for the links! I briefly saw some of the information, but 
not being a guru, I'm really looking for the "idiot's guide to REBOL" 
that gently introduces the reader to the power of REBOL through simple 
examples so I/others can "think deifferently" about programming and 
undo all the years of bad habits from other languages.
Pekr
31-May-2007
[403x2]
We have XML-RPC for intercommunication, my guess is - not used much, 
but fine when you want to connect to server, which does use it.


Rugby - RPC broker. VERY easy to use, you would be surprised! You 
simply start server, you define which functions you expose, something 
like server [my-func1 my-func2] and then you just connect. It uses 
functions stubs, so actually your source code is not revealed to 
client.
REBOL/services - architecture developed by RT themselves, which will 
be part of every REBOL release, to standardise. You can find it via 
rebol.net IIRC. There are some docs, examples. It is not fully finished, 
it does not work if you are behind the proxy, and is not properly 
async, hence ppl work for R3 (which is async by default). Very strong 
concept, and once R3 is out, we will ruin other languages world via 
simplicity. You should also learn more about dialects, what they 
are, how those could be used, etc.
RayA
31-May-2007
[405]
I live in the East Bay of Northern California, and I'd be interested 
to meet REBOL developers/users in the area, if anybody is interested. 
Also, out of curiosity, where are the active developers located?
Pekr
31-May-2007
[406x3]
Uniserve - multiplexing engine, kind of Medusa (Python). Uniserve 
engine is used for Cheyenne web server (look for that group here), 
and it is kind of cool web server, faster than Apache 1, fully REBOL 
based (well, who said scripting languages are slow? ;-), you don't 
need to install anything. It allows you to plug/unplug services when 
server is running!
active developers? Here on AltME plus ML ... we are small community, 
but you mostly get your response/help in minutes/hours ....
also - in Rebol/View, start desktop and go to rebol.com site to see 
some tools, demos. Right clicking them you can get to its source 
code ...
RayA
31-May-2007
[409]
If you are are the norm, then this group is very responsive and helpful! 
Are developers using REBOL in there jobs or mostly in their spare 
time?