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

World: r4wp

[#Red] Red language group

Kaj
23-Nov-2012
[4344x2]
With paren!, Fibonacci is now:
parameter: 40

fibonacci: func [n [integer!]] [
	either n < 2 [n] [(fibonacci n - 1) + fibonacci n - 2]
]

prin "Fibonacci "  prin parameter  prin ": "
print fibonacci parameter
BrianH
23-Nov-2012
[4346]
To illustrate my point in a dumb way: alias 'true "false"
Kaj
23-Nov-2012
[4347x4]
Yes, that's dumb enough that anyone would quickly figure out not 
to do that
Anyway, I increased the parameters of both Fibonacci and Mandelbrot 
to have a better benchmarking range for fast languages, such as Red/System
With this parameter and a more exact comparison, Red/System is 70 
times faster than Red
Red is 2.2 times faster than R3
BrianH
23-Nov-2012
[4351]
Kaj, you are assuming that people don't want to create deliberate 
bugs. If any REBOL-like language with an interpreter of JIT becomes 
popular, we are going to have to assume that some developers will 
be malicious. Remember SQL-injection attacks. Don't add a feature 
that is only better than another way of doing that feature in that 
it is so trivially easy to use as an attack vector that anyone could 
use it with the stupidest code imaginable.
Kaj
23-Nov-2012
[4352]
Programming is a security hole. If you want to allow people to do 
safe programming, you have to make it safe by disallowing many things. 
That would obviously include ALIAS
BrianH
23-Nov-2012
[4353]
Also, REBOL-like languages are easy to generate from a dialect. A 
translator could write data files in a dialect, which could be used 
to generate the wrapper functions and assignment statements. And 
a half-way decent optimizer could get rid of the wrappers using the 
same methods that would allow it to statically resolve refinements. 
There's no reason to support an astoundly worse method.
Kaj
23-Nov-2012
[4354]
I will happily allow people to use ALIAS on my Try REBOL server, 
just like I'm allowing most other REBOL features, because the server 
operating system is the party that establishes safe boundaries
BrianH
23-Nov-2012
[4355]
astoundly -> astoundingly
Bad typing day.
Kaj
23-Nov-2012
[4356x4]
You are welcome to try our server to see if you can break it with 
ALIAS
On my machine, REBOL catches up enormously when it can do many iterations 
in a very small loop. Apparently, a very small function will eventually 
fit in the CPU cache, so the VM gets less of a cache hit compared 
to compiled languages
With increased iterations, the effect is big in Fibonacci, but dramatic 
in Mandelbrot
Of course, most programs do not afford that advantage
BrianH
23-Nov-2012
[4360]
I remember there being a spreadsheet expression evaluator that made 
it a point to have a small enough number of operations in its bytecode 
that it could fit two operations per byte. That means that with cache 
issues taken into account, its code was drastically faster than fully 
compiled code. The interpreter fit entirely in the instruction cache 
of a 486, and the bytecode was much smaller than regular native instructions, 
so the bytecode could be pushed into the CPU faster. This kind of 
a thing is even more of an issue now, with CPUs that are many times 
more faster than the memory busses, and even bigger caches.
Kaj
23-Nov-2012
[4361]
On Mandelbrot with 50'000 iterations instead of the standard 1000, 
Red/System is 80 times faster than R3
BrianH
23-Nov-2012
[4362x2]
R3 is obviously not designed with that kind of interpreter though, 
and isn't even bytecode compiled. That is more a trick for rebcode 
:)
GPU shader languages often use that trick though.
Kaj
24-Nov-2012
[4364x2]
If anyone wants to help Red and thinks he can't start programming 
yet, please give it a presence here under Tested on RPi:
http://elinux.org/RPi_Programming
Arnold
24-Nov-2012
[4366]
I have to wait to start programming my Raspberry Pi until I actually 
get it from Sinterklaas. After that I can try to test Red on it. 
I watched your presentation on programming in Red on the Raspberry 
Pi. No Syllable yet? WHat Linux did you use on the Rasp again Kaj?
Kaj
24-Nov-2012
[4367x5]
Ah, so you volunteer for editing the wiki :-)
I said it in the video: Raspian, Arch Linux, and my preferred Bodhi 
Linux (based on Raspian)
Raspbian, that is
RISC OS runs best, though, but no Red
Syllable would have to be ported to ARM, which is a lot of work
Arnold
25-Nov-2012
[4372]
Possible to port Red to RISC OS too? Or a lot of work too %Y\ ?

I could contribute to the wiki (which one are we talking about here?) 

Now I have my 10x10 checkers game in Version 1.0.0 released I have 
some time to spend on the script Doc asked for. Can the specifications 
be reposted please?
PeterWood
25-Nov-2012
[4373]
I have just uploaded a basic script to generate Red/System API docs 
to Github. It could do with a lot of polishing, perhaps you could 
take a look?
Jerry
25-Nov-2012
[4374]
Red/System API Docs ... Just what I need, Thanks, Peter. :-)
Marco
25-Nov-2012
[4375]
I would like to report a bug in red-system. I would prefer not to 
register myself anywhere. Which is the simplest way ?
Kaj
25-Nov-2012
[4376]
Arnold, I'm talking about the RPi wiki I linked above
Arnold
25-Nov-2012
[4377]
Added to the favorites!
DocKimbel
25-Nov-2012
[4378]
Marco, you can report it here, and someone will then re-post it in 
the bugtracker on github.
Marco
25-Nov-2012
[4379]
red-system question:
How can I create a simple array of constants?
Kaj
25-Nov-2012
[4380x4]
That's a bit tricky. There's no explicit support for specifying that
You can write such a list in the arguments of a function, so you 
can make a constructor function that takes the constants and delivers 
the array
Actually, when you use a typed constructor function, you already 
get access to the arguments array, but it's an array of stuct!s of 
type typed-value!
If you can use the array in that form, you can use that trick, but 
you have to stay within the function because the array is on the 
stack
DocKimbel
25-Nov-2012
[4384]
I have some design notes for supporting literal arrays of scalar 
values (integers, bytes, floats, booleans), but as we haven't had 
the need for them in Red construction so far, I have not implemented 
such support yet.
Marco
25-Nov-2012
[4385]
I am trying to write a test red-system program but it is a pain:

I write it in my editor, then open a Rebol console and do change-dir... 
do/args ... then:

If I open a window console and run the program I can not compile 
it anymore (it is locked by the console?), and if I try to run it 
in Rebol with call/console ... it hangs. Which is the right method?
DocKimbel
25-Nov-2012
[4386]
Are you compiling the same program again while it is already running?
Marco
25-Nov-2012
[4387]
No, but now I see that I must wait some seconds before a new compilation.
DocKimbel
25-Nov-2012
[4388]
On which platform are you?
Marco
25-Nov-2012
[4389]
win 7. Acer Aspire 2.0 Ghz
DocKimbel
25-Nov-2012
[4390x2]
If I open a window console and run the program I can not compile 
it anymore (it is locked by the console?), and if I try to run it 
in Rebol with call/console ... it hangs. 


I don't get this part...Your program seems to be still running while 
you think it has finished.
If you have no loop in your code nor system calls that might block, 
you could try disabling your anti-virus program to see if that's 
not the one interfering.
PeterWood
25-Nov-2012
[4392x2]
Does call/console work under Windows 7?


call/console "ver" causes REBOL to hang on my machine after printing 
"The handle is invalid twice."
Perhaps it is better to use call/output?

>> console-output: make string! 2000
== ""
>> call/output "ver" console-output
== 0
>> console-output
== "^/Microsoft Windows [Version 6.1.7601]^/"