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

World: r3wp

[Rebol School] Rebol School

Henrik
6-Feb-2009
[1562]
I have no better solution right now. I plan slicehost, linode or 
similar later.
shadwolf
6-Feb-2009
[1563]
if i was president i would ban apach and impose cheyenne! :O
kib2
6-Feb-2009
[1564]
Henrik: where are your pages ?
Henrik
6-Feb-2009
[1565]
http://rebol.hmkdesign.dk/files/r3/gui/
kib2
6-Feb-2009
[1566]
Henrik: you wrote the R3 gui demo ?
shadwolf
6-Feb-2009
[1567x3]
i like the gold progress bars henrik  ^^
sliders in 032 are nice too
toggle ar too big in my opinion a toggle is to be put in a list of 
parameters
Henrik
6-Feb-2009
[1570x2]
I only skin R3. I did not write the demo. Skin is far from finished.
(the gold progress bars are long gone. :-))
Geomol
6-Feb-2009
[1572]
kib, if you wanna see, what can be done with REBOL, take a look at 
Canvas RPaint (see group Canvas). It's an port of the old DPaint 
for the Amiga made in REBOL. More than 12'000 lines of REBOL source 
(600kb) or 176kb compressed.
kib2
8-Feb-2009
[1573]
Hi, can someone help ?
Janko
8-Feb-2009
[1574]
about what?
kib2
8-Feb-2009
[1575x2]
Janko: thanks. I'm starting and don't understand why this snippet 
does not work : http://clojurepastebin.appspot.com/1003
In fact, I don't even know if it's the right way to write a 2 arguments 
function.
Geomol
8-Feb-2009
[1577]
Most REBOL programmers use FUNC, and not FUNCTION, because it's easier. 
Let me see, if I can rewrite your function with func...
kib2
8-Feb-2009
[1578]
Geomol: I just followed the book I bought, it tells me that func 
uses globals, and globals may not be the best no ?
Geomol
8-Feb-2009
[1579x4]
hm, you can make locals with FUNC.
It doesn't work, because RETOUR isn't defined. You just declare it 
(as a block). You need to actually make the block.
quartile: func [
	liste	[block!]
	/local malong retour
][
  retour: clear []

  malong: length? liste

  either (modulo malong 2) [ insert retour (length? liste) ] [ print 
  "longueur impaire" ]
  return retour
]
That may not be, what you want. I haven't figured out yet, what you 
want the function to do. :-)
kib2
8-Feb-2009
[1583x2]
Geomol: thanks! so when you declare an object, it's not build ?
don't mind about that function purpose : it does nothing interesting 
at the moment
Geomol
8-Feb-2009
[1585x2]
:-) Careful. We have to get the terms right, because they mean something, 
declare, object, etc.
Examples of words, that get declared (defined or known from now on) 
and also get build:

a: none
b: 42
c: make block! 16


If you specify words to be local to a function, they don't get declared 
(build). It just mean, that when you refer to those words, they will 
be local to the function.
kib2
8-Feb-2009
[1587]
Geomol: right, i'll try to take care of my vocabulary :)
Geomol
8-Feb-2009
[1588]
so

my-func: func [
	var1 var2
	/local var3 var4
][
.....
]


In this, var1 and var2 are two arguments to the function. var3 and 
var4 are treated local to the function, but they're not created yet.
kib2
8-Feb-2009
[1589]
Thanks Geomol, that's clearer now. I had to go for lunch, I'll be 
back in a few mins. (I've got a lot of questions, I find my book 
not clear at all).
Geomol
8-Feb-2009
[1590x3]
An example:


>> fibonacci: func [i /local n old-n older-n] [n: 1 old-n: 0 loop 
i [older-n: old-n old-n: n n: old-n + older-n print n]]
>> fibonacci 5
1
2
3
5
8
I said "careful" up there, becuse you also have objects in REBOL.
Another version, you might find useful (at least to see how to make 
the same thing in different ways, and with different number of variables):

fibonacci: func [
	i
	/local a b
][
	set [a b] [1 1]
	 loop i [
		print a
		set [a b] reduce [b a + b]
	]
]
kib2
8-Feb-2009
[1593x2]
nice!
I said my book wasn't clear because in presenting blocks, it uses 
the words "arrays", then "lists" and "series" inside : it's quiet 
confusing.
Geomol
8-Feb-2009
[1595x2]
I guess, words like "arrays" and "lists" are common in other languages. 
In REBOL, you'll see the word "series" a lot.
A block is a series of elements (inside [ and ]).
kib2
8-Feb-2009
[1597]
Geomol: ok, but is there any difference between all these terms ?
Geomol
8-Feb-2009
[1598]
Try in the REBOL console:

>> ? datatype!
Henrik
8-Feb-2009
[1599]
you can ask whether a datatype is a series with 'series?.
kib2
8-Feb-2009
[1600]
So what's the difference between a block and a serie ? A serie is 
a block for me no ? (the inverse may not be right)
Henrik
8-Feb-2009
[1601]
not all series are alike. We tend to differ between strings and blocks 
and blocks come in a few different types, optimized for specific 
use, but they may hold the same content.
Geomol
8-Feb-2009
[1602]
A computer language theorist might tell you differences between arrays, 
lists and series. I suggest, you take the practical view and look 
at what datatypes, you find in REBOL.
Henrik
8-Feb-2009
[1603]
kib2, let REBOL decide what is what, by asking the datatype:

>> series? [a b c]
== true
>> series? "abc"
== true


You can do that, because REBOL has so many different datatypes, allowing 
you to be precise in your expression.
Geomol
8-Feb-2009
[1604]
>> series? "abc"
== true
>> series? []
== true
>> series? make list! 10
== true

So there are many kinds of series.
kib2
8-Feb-2009
[1605]
Geomol: Rebol is the langage where I've found the more datatypes 
!
Geomol
8-Feb-2009
[1606x2]
hehe :-)
kib, me too.
Henrik
8-Feb-2009
[1608]
if we didn't have this many datatypes (R3 has even more), parsing 
and dialects would be less fun.
Geomol
8-Feb-2009
[1609]
kib, you'll see, the number of datatypes is one of the really really 
huge forces of rebol.
kib2
8-Feb-2009
[1610x2]
email!, url!, money! etc. That's good when you parse something
Henrik: R3 adds other datatypes ? like ?