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

World: r3wp

[rebcode] Rebcode discussion

Maxim
21-Apr-2006
[1464]
They would be really usefull for editing faces,and other object-based 
REBOL resources... if they are in opcodes, we could expect a big 
speed improvement, even if that meant to "freeze" some aspects of 
the object within the rebocode loop. (JIT compile on demand  ;-)
ICarii
7-Jul-2006
[1465x7]
getting a weird variable cross over in a rebcode code block where 
the function will run fine sometimes then inexplicably swaps its 
variable contents while under recursion..
ill post the code so anyone interested can have a play
http://rebol.mustard.co.nz/sudoku_gen.r
The issue is in the TestUniqueness function when it recurses within 
itself - the Gen function works fine
the irritating thing is that the TestUniqueness function does work 
about 5% of the time..
The variables swapping over are yp and sev - yp is an integer and 
sev is a series..
have tried the same code under rebview1352031.exe and rebview1361031.exe 
but same results.
Ladislav
18-Sep-2006
[1472x2]
Brian: I found my post above:

Kru: this really seems to be APPLY related, because the following 
code crashes too:

mulr: rebcode [][return 4]
mull: rebcode [][loop 10000000 [apply a mulr []] return a]
mull
is that the crash you mean?
BrianH
18-Sep-2006
[1474x2]
Yup.
I never ran into it myself, but that's what I was talking about.
Ladislav
18-Sep-2006
[1476]
this seems to be corrected in
>> rebol/version
== 1.3.61.3.1
BrianH
18-Sep-2006
[1477x2]
If so, cool.
Did they ever make a new rebcode alpha based on the latest REBOL 
version? I know I requested it many times...
Ladislav
18-Sep-2006
[1479]
The version above is the latest I have got, so I think there is not 
a newer one
BrianH
18-Sep-2006
[1480]
Ah well. The rebcode VM was the basis for much of my own research 
projects. I would really like to see it return, as I am blocked on 
those projects until I can count on rebcode being there and safe 
to use. As it is, I rarely get to use REBOL professionally, it's 
more of an enabling tool.
Jerry
21-Oct-2006
[1481]
How can I rewrite the following regular REBOL code into REBCODE?
There is no REBCODE version of "TO-CHAR".

; data is binary!
poke data j to-char data/:i
Anton
21-Oct-2006
[1482]
Implementing memory move ?
Jerry
21-Oct-2006
[1483x2]
Yes. Implementing memory move.
REBCODE is AMAZING ...


I am trying to convert a 300+ MB file from little-endian 16-bit Unicode 
to UTF-8. I am pretty sure that all the characters in this file are 
ASCII characters, so I can just discard the second byte (0x00) of 
every 16-bit Unicode character. Beside that, the beginning 2 bytes 
(0xFFFE) need to be discard too. 


In these two days, I wrote REBOL scripts for this purpose in different 
ways, and I suffered in different ways, too. Sometime I got out-of-memory 
error, sometimes I didn't. Even if I didn't get any error, the performance 
would definitely dramatically dropped down after few minutes because 
of the memory issue, I guess. I would take me 30 minutes to convert 
the file in my PC. I was trying to make it less than 10 minutes, 
so I kept asking stupid questions in the AtlME REBOL3 World.

 

Few ours ago, REBCODE came to my mind out of the blue. I remembered 
Carl said something like 10-30 faster. Because I am no REBOL expert, 
I'd never used REBCODE before. I took 1-2 hours to read the REBCODE 
document, then I do my very first REBCODE code in my life. Guess 
what? It turned out very well. The REBCODE version took only 45 seconds. 
It's AMAZING.
[unknown: 5]
21-Oct-2006
[1485]
Good to hear Jerry.
Maxim
21-Oct-2006
[1486x2]
compared to what when not using rebcode?
oh, the 30 minutes you write above... , was that using REBOL?
Jerry
21-Oct-2006
[1488]
Yes, the 30-minntes version is in REBOL
Gregg
21-Oct-2006
[1489]
Do you need to conver the data when using rebcode? In REBOL you would, 
but I think you can poke it in rebcode. e.g. 


mem-move: rebcode [bin [binary!] src dst /local v] [pick v bin src 
 poke bin dst v]
Jerry
22-Oct-2006
[1490x3]
Gregg, Thank you.

I've just found out that "to-char" is not necessary in Rebcode, the 
value picked from a binary! can be poked into a binary! without using 
"to-char" first. This is different from the regular REBOL code.
I would like to have an interactive console for REBCODE. That would 
be greate for learning the REBCODE dialect.

>> iRebcode       ; switch to REBCODE console
:> set.i a 10     
:> add.i a 20      
:> print a        
== 30             
:> exit           ; back to REBOL console
>> print a
== 30
It is possible, I mean, the interactive REBCODE console idea.
Geomol
23-Oct-2006
[1493x5]
Something like:

iRebcode: has [b] [while [(b: ask ":> ") <> "exit"] [do do append/only 
[rebcode []] load b]]
Guess it needs some binding.
Better version:

iRebcode: has [b] [while [(b: ask ":> ") <> "exit"] [if error? try 
[do do append/only copy [rebcode []] load b] [print "Syntax error!"]]]
That must be an one-liner rebcode prompt.
Good idea, Jerry! Thanks! :-)
Jerry
23-Oct-2006
[1498x3]
>> iRebcode: has [b] [while [(b: ask ":> ") <> "exit"] [if error? 
try [do  do append/only copy [rebcode []] load b] [print "Syntax 
error!"]]]
>> iRebcode
:> set.i a 10
:> print a
?unset?
:>
Binding seems to be needed ... I don't know how to do that.
Geomol, Thank you for your iRebcode function. Your inspire me to 
rewrite it into an "interactive draw" function:

>> iDraw: has [b canvas draw-blk temp-draw-blk] [
[        draw-blk: copy []

[        canvas: view/new layout [box 400x400 black effect [draw 
draw-blk]]
[        while [ (b: ask "iDraw >> ") <> "exit"] [
[                temp-draw-blk: copy draw-blk
[                if error? try [
[                        append draw-blk load b
[                        show canvas
[                    ] [
[                        print "Syntax error!"
[                        draw-blk: temp-draw-blk
[                    ]
[            ]
[        draw-blk ; return value
[    ]
>>
>> iDraw
iDraw >> fill-pen red circle 100x100 100
iDraw >> fill-pen 20 blue box 50x50 100x100
iDraw >> text "Fun"
iDraw >> exit
>>
Anton
24-Oct-2006
[1501]
That looks quite handy actually.
BrianH
24-Oct-2006
[1502x2]
Simpler version:

iRebcode: has [b] [while [(b: ask ":> ") <> "exit"] [if error? try 
[do rebcode [] load b] [print "Syntax error!"]]]
No need for the do append copy - the rebcode function is a function, 
not syntax.
Geomol
24-Oct-2006
[1504]
Jerry, iRebcode works ok for me under OSX.
BrianH, cool! :-)
Gabriele
25-Oct-2006
[1505]
Jerry, about the above, remember that A must already refer to a integer 
value before you can use set.i.
Jerry
25-Oct-2006
[1506]
I see. Thank you, Gabriele.
Jean-François
7-Dec-2006
[1507]
Have a look

The Synthesis kernel written by Dr. Henry Massalin as his PhD. thesis 
is commonly viewed to be the 
mother of all self-modifying code."
via SteDekorte et al :
http://www.dekorte.com/blog/blog.cgi?do=item&id=2336
Geomol
8-Dec-2006
[1508]
Interesting! And it's made for the Motorola 68030 CPU.
[unknown: 5]
9-Dec-2006
[1509]
I thought rebcode was a function built into all new builds of REBOL 
- is it?  if not why not?
Henrik
9-Dec-2006
[1510]
it's not finished yet.
Maxim
9-Dec-2006
[1511]
only a few beta versions had rebcode in them
[unknown: 5]
9-Dec-2006
[1512]
grrr.  Seems they should put it in anyway to others for at least 
access to the support that it may provide.
Maxim
9-Dec-2006
[1513]
and a (shrinking) number of ops are buggy.... but a bug in rebcode 
is much more dramatic than in normal REBOL