When I first looked at REBOL, I didn’t think much of it:
foreach e [1 2 3] [ print e ]
Pretty obvious what this does, and it’s the sort of thing you’ve seen a million times, eh? Not to mention the square brackets …
But then I saw stuff like this:
write/binary %Google.html read/binary http://www.google.com
That started to pique my interest! I can't think of another language in which writing the contents of a URL to a file are so concise. It might as well be wget or curl.
I noticed a few other strange things about this syntax as well. First, the URL was not quoted. It was just written out as is. And the file name was prefixed by a percent sign. I had to know more about this, and what I discovered was much deeper than I ever expected.
Like all programming languages, REBOL has tokens whose type can be determined by their lexical form. To give a common example, when an interpreter or compiler encounters the token 3, it interprets it as an integer (of some kind). These kinds of tokens are usually known as literals. Most languages have string and numeric literals, and that’s about it. REBOL on the other hand has a lot of literals: strings, numbers, URLs, blocks, parens, paths, words, files, and so on.
Here are some examples:
Example | REBOL Type |
3 | integer! |
3.2 | decimal! |
"fish" | string! |
{fish} | string! |
http://www.google.com | url! |
ftp://ftp.nowhere.com | url! |
%Google.html | file! |
word! | |
word: | set-word! |
lit-word! | |
read/binary | path! |
[1 2 3] | block! |
(1 2 3) | paren! |
There are many more. As you can see, a few of these have equivalents in other languages, but most don’t. In fact, some of these look suspiciously like the kinds of things in which a compiler or interpreter would be interested. That’s true, and it’s the basis of what's known as the data exchange dialect.
Let’s digress a bit. REBOL is composed of a hierarchy of dialects. There are several built-in dialects, and REBOL gives developers the ability to create their own. The basis of all the dialects is the data exchange dialect, which isn’t a programming language per se. It's just a free-form sequence of literals that can be interpreted however one wishes. For example:
[http://www.google.com http://www.yahoo.com] fetch no-one@nowhere.com
If we were to replace literals above with their types, we'd get
block! word! email!
(Yes, email addresses are another literal data type.) The data exchange dialect can be used much like XML. You can pass around chunks of it and the REBOL interpreter will happily tell you what the types and values of the literals are. It makes for a much better XML than XML, in my opinion. Here's an example:
data: load "[http://www.google.com http://www.yahoo.com] fetch no-one@nowhere.com" foreach literal data [ print type?/word literal ]
The code above prints out the following:
block! word! email!
When the load function is passed a string, it interprets the contents of the string as a sequence of literals, and returns a block! containing those literals. Thus, the data variable has the following value:
[[http://www.google.com http://www.yahoo.com] fetch no-one@nowhere.com]
So, if the block above is an example of the data exchange dialect, what dialect is actual programming code written in? The DO dialect. Ordinarily, when the REBOL interpreter starts processing a file, it assumes that the file is written in the DO dialect. Like all dialects, the DO dialect is a stream of literals whose types are determined by the rules of the data exchange dialect. However, what is done with them afterwards is determined by the rules of the DO dialect.
For example, when the DO dialect encounters the literal* print, it says, "Ah! This is a literal of type word!". It then looks up the value of that word and finds that it points to a function taking a single argument. It then prints the value of that argument to standard output. E.g.,
print "REBOL"
This does exactly what one would expect.
All of this barely scratches the surface of REBOL. There's the syntax of the DO dialect, those strange beasts called words, Bindology and contexts, and so on. The purpose of this post was to get you interested. Hopefully you'll read more at rebol.com.
*Note that strictly speaking, print is a literal in the data exchange dialect, but a token in the DO dialect. However, in the interests of reducing confusion, I stuck with the former term.
One of your example can be shorter and simpler :
ReplyDeletedata: load "[http://www.google.com http://www.yahoo.com] fetch no-one@nowhere.com"
foreach literal data [
print type?/word literal
]
Anyway, very nice blog.
Thanks, DideC! I changed the code to reflect your excellent suggestion.
ReplyDeleteThis is one of the shortest introductions to Rebol that I have seen.
ReplyDeletechenlina20160725
ReplyDeleteoakley sunglasses
burberry outlet
adidas superstar
adidas yeezy
replica watches
christian louboutin outlet
oakley sunglasses
cheap oakley sunglasses
true religion outlet
christian louboutin outlet
coach outlet
coach outlet
cartier watches
cheap jordan shoes
kobe 9
ray ban sunglasses outlet
jordan 3
coach outlet store online
true religion jeans sale
hermes handbags
asics outlet
louis vuitton outlet
kate spade
michael kors outlet
oakley vault
jordan 8
louis vuitton handbags
air jordans
cheap oakley sunglasses
nike roshe runs
coach outlet store online
louis vuitton outlet stores
coach outlet
air max 90
air jordan 13
jordan 4 toro
kate spade
coach factory outlet
coach outlet store online clearances
michael kors outlet
as
fake rolex watches
ReplyDeletemichael kors handbags
christian louboutin
pandora uk
michael kors outlet online
adidas
pandora charms sale clearance
adidas superstar trainers
nfl jerseys cheap
coach outlet online
xushengda0323
This is really a great stuff for sharing. Keep it up. Do My Medical Science Assignment Thanks for sharing.
ReplyDeleteI appreciate your efforts in preparing this post. Buy Operating System Assignment Help I really like your blog articles.
ReplyDeletecavaliers jerseys
ReplyDeletecheap oakley sunglasses
harden shoes
bottes ugg
adidas superstar shoes
uggs outlet
cheap jordan shoes
coach factory outlet online
ray ban sunglasses outlet
ugg boots
mt0816
شركة مكافحة حشرات بالكويت
ReplyDeleteشركة نقل عفش بالكويت
شركة تنظيف منازل بالكويت
فني صحي بالكويت
شركة الرشيد للخدمات المنزلية
ReplyDeleteسباك بالكويت
شركة تسليك مجاري بالكويت
شركة غسيل سجاد بالكويت
lacoste polo
ReplyDeletehermes handbags
nike air huarache
coach outlet online
moncler jackets
air max 90
adidas superstars
ferragamo belt
birkin bag
jordan 4
mbt shoes outlet
ReplyDeletekobe 9
adidas yeezy boost
yeezy shoes
fila shoes
lebron 15 shoes
michael kors purses
balenciaga triple s
kobe 9
lebron 10
Foam insulation company in Dammam Thermal insulation company in Riyadh Dammam Cleaning Company Transfer of Afash Medina Moving furniture in Jeddah An insect control company in Dammam Insulation of roofs with the Detection of water leaks in Makkah
ReplyDeleteHome Services Disposal of household insects with natural recipes Clean the kitchen and arrange it Clean the living room Cleaning the bathrooms House cleaning company in Madinah Anti-bed bugs Best colors bedrooms Modern
ReplyDeletejordan shoes
ReplyDeletechristian louboutin shoes
golden goose sneakers
kd 12
balenciaga
supreme new york
nike cortez
nike air max 2017
cheap jordans
cheap jordans
longchamp handbags
ReplyDeletebape hoodie
adidas yeezy
adidas stan smith
balenciaga shoes
longchamp
lebron 11
adidas tubular
vapormax
golden goose outlet
Eminem is an American rapper and one of the most successful artists in hip-hop. As of 2020, Eminem net worth is now estimated to be $230 million.
ReplyDeletecami avizesi - no deposit bonus forex 2021 - takipçi satın al - takipçi satın al - takipçi satın al - takipcialdim.com/tiktok-takipci-satin-al/ - instagram beğeni satın al - instagram beğeni satın al - btcturk - tiktok izlenme satın al - sms onay - youtube izlenme satın al - no deposit bonus forex 2021 - tiktok jeton hilesi - tiktok beğeni satın al - binance - takipçi satın al - uc satın al - sms onay - sms onay - tiktok takipçi satın al - tiktok beğeni satın al - twitter takipçi satın al - trend topic satın al - youtube abone satın al - instagram beğeni satın al - tiktok beğeni satın al - twitter takipçi satın al - trend topic satın al - youtube abone satın al - takipcialdim.com/instagram-begeni-satin-al/ - tiktok takipçi satın al - tiktok beğeni satın al - twitter takipçi satın al - trend topic satın al - youtube abone satın al - instagram beğeni satın al - perde modelleri - instagram takipçi satın al - takipçi satın al - instagram takipçi satın al - betboo
ReplyDeletetakipçi satın al
ReplyDeletetakipçi satın al
takipçi satın al
takipçi satın al
takipçi satın al
takipçi satın al
takipçi satın al
takipçi satın al
takipçi satın al
takipçi satın al
takipçi satın al
takipçi satın al
takipçi satın al
takipçi satın al
takipçi satın al
takipçi satın al
takipçi satın al
takipçi satın al
takipçi satın al
takipçi satın al
takipçi satın al
instagram takipçi satın al
instagram takipçi satın al
takipçi satın al
takipçi satın al
instagram takipçi satın al
instagram takipçi satın al
instagram takipçi satın al
instagram takipçi satın al
takipçi satın al
instagram takipçi satın al
takipçi satın al
ReplyDeleteinstagram takipçi satın al
https://www.takipcikenti.com
marsbahis
ReplyDeletebetboo
sultanbet
marsbahis
betboo
sultanbet
yasaklı sitelere giriş
ReplyDeletepepsi kodları
wall hack kodu
ücretsiz antivirüs programları
yeni kimlik yenileme ücreti
internetsiz oyunlar
en hızlı dns sunucuları
hız testi
tiktok jeton hilesi
bitcoin nasıl alınır
ReplyDeletetiktok jeton hilesi
youtube abone satın al
gate io güvenilir mi
referans kimliği nedir
tiktok takipçi satın al
bitcoin nasıl alınır
mobil ödeme bozdurma
mobil ödeme bozdurma
mmorpg oyunlar
ReplyDeleteinstagram takipçi satın al
tiktok jeton hilesi
tiktok jeton hilesi
SAC EKİMİ ANTALYA
referans kimliği nedir
İnstagram takipçi satın al
MT2 PVP SERVERLAR
instagram takipçi satın al
perde modelleri
ReplyDeletesms onay
mobil ödeme bozdurma
nft nasıl alınır
ankara evden eve nakliyat
trafik sigortası
dedektör
web sitesi kurma
aşk kitapları
en son çıkan perde modelleri
ReplyDeletelisans satın al
nft nasıl alınır
özel ambulans
minecraft premium
en son çıkan perde modelleri
yurtdışı kargo
uc satın al