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

World: r3wp

[Rebol School] Rebol School

BrianH
24-Dec-2011
[4075]
The main built-in function that takes advantage of the flexibility 
is FUNCT, which copies the spec and body before it does its collection 
of locals and binding to the static local object. In R2, the spec 
and body are copied again after that by the MAKE action, doubling 
the copying overhead. In R3, they aren't.
Endo
27-Dec-2011
[4076x2]
Is it possible to send command -line arguments to the new REBOL process 
using LAUNCH?
launch "test.r" ;this one works

launch "-s test.r" ;REBOL starts in TRACE ON mode (I don't know if 
%test.r will start or not, too much trace log to wait)

launch "--secure allow test.r" ;shows USAGE and doesn't start %test.r
launch "-q test.r" ; trace mode again.
I'm using R2 2.7.8.3.1
Pekr
27-Dec-2011
[4078]
Not sure launch can do that, or if there was not related any bug. 
But - you might use CALL, it is now free ....
Gregg
27-Dec-2011
[4079]
I standardized on using CALL some time back, as RUN and LAUNCH weren't 
available or consistent in all REBOL versions. system/options/boot 
makes using CALL easy for LAUNCH-like behavior.
Endo
27-Dec-2011
[4080]
@Pekr - @Gregg: Thank you. For encapped files, system/options/boot 
points to encapped .exe right?
Gregg
27-Dec-2011
[4081x2]
Yes.
In cases where I need to launch REBOL from encapped, I have included 
config options; sometimes on a per-command basis, so I can launch 
a specific version of REBOL for different needs.
Endo
27-Dec-2011
[4083]
You put rebol.exe into your encapped file? Or into the same folder?
And how do you put license.key to enable /Pro features?
GrahamC
27-Dec-2011
[4084]
you don't need key if encapped.
Gregg
27-Dec-2011
[4085]
I haven't done that for commercial products where I would have to 
redistribute REBOL; only systems where the environment is controlled 
and REBOL is in use/licensed.
Endo
27-Dec-2011
[4086]
Ok, now I see.

If I have a encapped script and need to launch a new REBOL process 
to execute another script (not encapped), is it the correct way, 
CALL my exe with a command-line argument to execute the other script?
nve
27-Dec-2011
[4087]
I want to declare a function with several rafinments by only one 
can be selected :
myfunc: func [/r1 /r2] [...]
myfunc/f1 or myfunc/f2
I don't want to allow : myfunc/f1/f2
Henrik
28-Dec-2011
[4088x2]
That is not possible, but you can determine presedence of use in 
the function body, so the outcome would be the same, or you could 
make an error, if both refinements are used.
>> a: func [/b /c] [if all [b c] [make error! "Only one refinement 
can be used."]]
>> a
== none
>> a/b
== none
>> a/c
== none
>> a/b/c
** User Error: Only one refinement can be used.
** Near: make error! "Only one refinement can be used."
GrahamC
28-Dec-2011
[4090]
Endo, launch with parameters stopped workng years ago.  So, we had 
to move to call instead
Endo
28-Dec-2011
[4091]
GrahamC: Thanks. I'll keep that in mind.
nve
28-Dec-2011
[4092]
@Henrik : thanks a lot !
BrianH
28-Dec-2011
[4093x2]
nve, there is a built-in error that might be better for you to use. 
Try this:
>> cause-error 'script 'bad-refines none
** script error: incompatible or invalid refinements
That error is apparently not in R2 though, sorry.
ChristianE
4-Jan-2012
[4095]
nve, there's TOO-MANY-REFINES in R2:

>> cause-error 'script 'too-many-refines none
** Script Error: Too many refinements
Marco
16-Jan-2012
[4096x2]
Is there a way to avoid conversion of numbers to scientific notation 
by mold?
>> mold 0.004
== "4E-3"


or have you a function to convert back a string representing a number 
with exponent to one eithout it?
eithout = without
Gregg
16-Jan-2012
[4098x4]
You have to do it yourself.
Many people have examples and funcs out there for it.
http://www.rebol.org/view-script.r?script=format-decimal.r
I have a general FORMAT func I use, but it's quite heavy as it handles 
a lot of things.
Marco
16-Jan-2012
[4102]
Thanks. The one from Nick should be ok.
Ladislav
16-Jan-2012
[4103]
You can also check

http://www.rebol.org/view-script.r?script=printf.r
Endo
17-Jan-2012
[4104x2]
I've also put a format-number function that I use on Checklists on 
Altme. It works well for me.
>> format-number 1 / 3
== "0.333333333333333"
Under Checklists / Code Snippets.
Marco
18-Jan-2012
[4106]
The function by Nick is a little slow since I have a lot of numbers. 
This is faster but not very fast:

format-decimal: func [x /local e q] [
	x: form x
    if find x "E-" [ 
		e: to-integer next next q: find x "E-"
		clear q
		remove find x "."
		if #"-" = first x [x: next x]
		insert/dup x "0" e
		insert next x "."
	]
	head x
]

The idea from Ladislav is nice but I would like most a more "rebol" 
solution.
Endo
18-Jan-2012
[4107]
Scientific notation of numbers and automatic reformating time! values 
(00:00:00 --> 0:00) are the most annoying parts of REBOL for me.
It would be more useful if it doesn't happen when FORMing.
Evgeniy Philippov
23-Jan-2012
[4108]
Is there a possibility for cyrillic/Russian at Rebol/View except 
for pixelart drawing the characters?
Kaj
23-Jan-2012
[4109x2]
In R3/View, but it's currently buggy and limited to Windows and Amiga
Since you'd have to switch languages anyway, you could also consider 
Red with the GTK+ binding
Evgeniy Philippov
23-Jan-2012
[4111:last]
Uh. In Red, everything is possible with any bindings