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

World: r3wp

[Rebol School] Rebol School

[unknown: 5]
16-Feb-2009
[2175x2]
Exactly,  why not just create an updated rebcode then.
Brian's answer was more like an excuse than a reason.
Steeve
16-Feb-2009
[2177]
:)
Anton
16-Feb-2009
[2178]
Sleepy time for me. I think I might try make the C DLL tomorrow.
Vladimir
16-Feb-2009
[2179]
Thanks Anton!
Steeve
16-Feb-2009
[2180]
Ch is a good candidate, it allows to build c code dynamicly
Vladimir
16-Feb-2009
[2181]
There.... lookup table done...... speed difference obvious :)
pause after click on button is rendering first frame....

do http://www.visaprom.com/tunel.r
Steeve
16-Feb-2009
[2182]
do you have a little gain with this ?

	repeat i 256 [
		foreach pixel lookup [
			set [pozicija red ugao] pixel
			red: red + i - 1 // 63 / 2 + 1
			p: pick pick level red ugao
			if (p > 0) [
				boja: pick paleta p
				change/dup skip ekran/image pozicija boja pixel_size
			]
		]
		show ekran
	]
Vladimir
16-Feb-2009
[2183x2]
its a nice refinment of code :)
maybe its faster but my pc i to fast for me to notice.... Earlier 
today I tested script on three years old laptop.... Now I tried it 
on my home pc.. (amd 5000) and its to fast.... :)
kib2
16-Feb-2009
[2185]
Hi. I've got a local variable "level" inside an object, defined has 
follow : "level: length? t".

If I try to print it, no problem. But  if I use "build-markup {<%level%>}", 
REBOL raises a "ERROR no-value in: level". Any idea ?
Geomol
16-Feb-2009
[2186x2]
Is your build-markup call outside the object? If yes, then you have 
to refer to level as object/level (where object is the name of your 
object).
o: make object! [t: "abc" level: length? t]
build-markup {<%o/level%>}
kib2
16-Feb-2009
[2188]
Geomol: no build-markup is called within my object. But I forget 
to say that I use "return build-markup {<%level%>}"
I don't know if I can "return" local vars ?
Geomol
16-Feb-2009
[2189]
return is normally used from within a function. So you have a function 
within your object, that returns what you say?
kib2
16-Feb-2009
[2190]
2 secs, I post the snippet
Geomol
16-Feb-2009
[2191]
>> o: make object! [t: "abc" level: length? t f: func [] [return 
build-markup {<%level%>}]]
>> o/f
== "***ERROR no-value in: level"

heh, funny! :-)
kib2
16-Feb-2009
[2192]
http://clojurepastebin.appspot.com/2005
Geomol
16-Feb-2009
[2193x2]
Seems like a binding problem.
This works:


>> o: make object! [t: "abc" level: length? t f: func [] [return 
build-markup {<%o/level%>}]]
>> o/f
== "3"
kib2
16-Feb-2009
[2195x2]
In fact, my html-handler instance is within another object.
Geomol: So, I have to refer to the object:/level as you told me before, 
that's it ?
Geomol
16-Feb-2009
[2197]
The difference is, you have level as a local to your function, I 
have level as a member of the object. What do you give to build-markup? 
It's a string, right? So build-markup don't know, what you mean by 
level, I think.
kib2
16-Feb-2009
[2198]
Yes, I give it a string. But changing to "return build-markup {<%html-handler/level%>}" 
raises the same error.
Geomol
16-Feb-2009
[2199x3]
Look at it from build-markup's viewpoint. How should it know, what 
level mean? This is a bit tricky part of REBOL, but it's also one 
of REBOL forces.
level can mean anything depending on the context.
If you write you return like this, it will work:

return build-markup rejoin ["<%" level "%>"]
kib2
16-Feb-2009
[2202]
Geomol: No, sorry I can't understand. level is defined one line before 
I use build-markup ( forget the print statement).
Geomol
16-Feb-2009
[2203]
Now we force the value of level inside the string, before the string 
is giving to build-markup
kib2
16-Feb-2009
[2204]
You're right, it works well. But I still don't understand the behaviour.
Geomol
16-Feb-2009
[2205]
In my last example, the string become something like {<%3%>}

In your example, the string is {<%level%>}. This is what build-markup 
see, and it has to figure out, what level mean. It can't figure that 
out, because level is a local of your function.
kib2
16-Feb-2009
[2206]
Geomol: you mean that build-markup is sort of blind on locals ?
Geomol
16-Feb-2009
[2207]
All functions are in a situation like this. {<%level%>} is just a 
string giving to a function.
kib2
16-Feb-2009
[2208]
I've never seen such a behavior in whatever langage I've used, but 
I'm starting to understand it : thanks for the clarification.
Geomol
16-Feb-2009
[2209x2]
Maybe you can think of it as two persons, one giving the other a 
string. The person receiving the string read "<%level%>". That person 
now have to figure out, what level mean. The person live in a context 
(the global context in this situation, because everybody can call 
build-markup). So it look up level in the global context and find 
nothing, so it gives an error.
If you instead write: rejoin ["<%" level "%>"]

then level is replaced by the value of level and a string is made, 
and this new string is sent to build-markup.
kib2
16-Feb-2009
[2211x2]
Yes, nice comparison Geomol, we see that you live in the stars :)
It's all clear now, but I shall forget about my bad habbits.
Geomol
16-Feb-2009
[2213]
Learning REBOL is also about unlearning what you're used to. :-)
kib2
16-Feb-2009
[2214x2]
and sometimes unlearning if even more difficult than learning !
is RebGUI widely used ?
Rebolek
16-Feb-2009
[2216]
I used it for one program that was used to fix translation of Windows 
Vista in 15 or 19 different languages. It depends on your definition 
of "widely".
kib2
16-Feb-2009
[2217]
Rebolek: I meant "was it a good alternative to VID ?". The only thing 
I miss in every Rebol GUI I've seen is font antialiasing.
Geomol
16-Feb-2009
[2218x3]
kib, if you run under Windows and wants anti-aliasing:

view layout [box black effect [draw [text "Hello World!"]]]
font-A: make face/font [size: 32]

view layout [box 200x100 black effect [draw [font font-A text "Hello 
World!"]]]
view layout [box 200x100 black effect [draw [pen red fill-pen yellow 
font font-A text "Hello W
orld!" vectorial]]]
kib2
16-Feb-2009
[2221x2]
Geomol: in this case, you're drawing them with AGG. Your text is 
not selectable.
But that gives me an idea : is there something like NodeBox in Rebol 
?
Geomol
16-Feb-2009
[2223]
right, you figure that part out and make a nice GUI for us! :-)
kib2
16-Feb-2009
[2224]
No problem! give me just a min ... or a year :)