
QLB (قلب) - Program in Arabic, display algorithms as calligraphy - munaf
http://qlblang.org/
======
mahmud
Neat. I also wrote a bunch of Arabic Lisps, most toys that went nowhere :-)

My biggest obstacle has so far been _language_ itself: I think I'm too much of
an Arabic snob to settle for simple, dictionary translation of some technical
terms. I also hate transliterating, so I got distracted by months long process
of compiling a dictionary.

To give you an example, Qlb replies with "letter is unexpected" when it really
means "symbol". حرف vs رمز. A Lisp evaluator operates on expressions, of which
symbols are a subset.

Even within technical English, words like letter and character do NOT mean the
same thing, though they are similar.

Most of computational concepts one wants to expound either exist or have
strong counterparts in the classical Arabic linguistic, rhetoric and logical
traditions. Though not a strict requirement, the Arabic PL designer would
benefit greatly from familiarity with the Classical, very abstract and
deductive, byt often non-secular, works.

One of my favorite games is to read a passage out, say, a type-theoretic paper
and try to translate it to Arabic :-)

[Edit:

It _is_ an excellent hack this, but Arabic side of things could use more
polishing. قول is not a verb, but قُل is. قول or مقولة means "utterance", not
the very "say" as you might intend. لقوله، قم الليل الا قليلا

]

~~~
btilly
I'm reminded of Damian Conway's module to allow people to program in Latin.
One Latin expert that he knew had trouble learning because she kept trying to
"correct" the grammar. (He'd found a combination of tenses and genders that
was never ambiguous - which was a great help to his parser - but was in many
cases not what would really be used in Latin.)

~~~
mahmud
Except Arabic is a living language and has 300 "expert" speakers :-P

~~~
ramseynasser
Interesting, where do you get that number?

~~~
entropy_
Well, maybe he meant that very few people are actually really good at formal
arabic? I know I suck at it even though I'm Lebanese and it's supposed to be
my mother tongue. Arabic speakers tend to have a colloquial form of Arabic
that they speak which is a much simplified version of the formal Arabic
language.

I would say the closest analogy is Lebanese is to Arabic what French is to
Latin. Clearly derived from it, but very different and much simpler.

300 experts is definitely a very low estimate though. Should definitely be
higher.

PS: Hi Ramzi, long time no see :)

------
DanBC2
Nice.

Everyone knows about algorithm, right?

From Wikipedia:

> The word "Algorithm", or "Algorism" in some other writing versions, comes
> from the name al-Khwārizmī, pronounced in classical Arabic as Al-Khwarithmi.
> Al-Khwārizmī (Persian: الخوارزمي‎, c. 780-850) was a Persian mathematician,
> astronomer, geographer and a scholar in the House of Wisdom in Baghdad,
> whose name means "the native of Khwarezm", a city that was part of the
> Greater Iran during his era and now is in modern day Uzbekistan. He wrote a
> treatise in the Arabic language during the 9th century, which was translated
> into Latin in the 12th century under the title Algoritmi de numero Indorum.
> This title means "Algoritmi on the numbers of the Indians", where
> "Algoritmi" was the translator's Latinization of Al-Khwarizmi's name.

~~~
madaxe
And algebra and alchemy (chemistry) and the list goes on.

We have a lot to thank the Arabic world for.

~~~
knv
And alcohol of course.

~~~
shn
And for the modern day drug sold at every corner a.k.a. coffee

~~~
madaxe
Which contains the _al_ kaloid, caffeine!

------
saidajigumi
Great! Next step, programming in the Diwali style of Arabic script[1]. This is
one of the amazing forms of Arabic calligraphy that often graces classical
Arabic architecture and other works of art. Because really, don't we all want
software that looks like this[2]? ;-)

Unfortunately, I understand that Diwali takes sufficient liberties with the
forms of written Arabic that it's often very hard to comprehend even for those
highly literate in Arabic.

[1] [http://islamic-arts.org/2012/arabic-calligraphy-and-type-
des...](http://islamic-arts.org/2012/arabic-calligraphy-and-type-design/) [2]
<http://www.typotheque.com/images/articles/thuraya/02.jpg>

------
munaf
For the curious, Qlb means "Heart" in Arabic.

Here's Conway's Game of Life: <http://twitpic.com/bv2cra>

------
leviathan
This acts simply as a direct translation of what looks like some sort of lisp
into Arabic symbols. I once did something similar with #define in C. The
calligraphy bit is a side effect of using Arabic letters, which tend to be
intrinsically good for calligraphy.

------
jlgreco
So are programs compiled into that rendered tile format? Is this using some
existing standard for transcribing algorithms into this calligraphy?

This looks very neat but I'm afraid I don't entirely understand it.

~~~
munaf
Just realized the title was misleading so I removed the word "render."

I don't _think_ the calligraphy is rendered automatically at the moment. Looks
like the author is doing it manually. I'm guessing automatic rendering is
planned, but not sure of that.

~~~
jlgreco
Hmm, I see. Do you know if the calligraphy itself could be
executed/interpreted? The idea of a visual representation of a program being
art but also executable appeals to me.

~~~
hypeibole
Ever heard of Piet?

<http://www.dangermouse.net/esoteric/piet.html>

<http://en.wikipedia.org/wiki/Piet_%28programming_language%29>

~~~
jlgreco
Oh man, that is fantastic. Some of those example programs are really
reminiscent of Wireworld.

<http://en.wikipedia.org/wiki/Wireworld>

------
philhippus
Probably about as easy to learn as brainfuck for Western progammers.
Interestingly shows the extra hurdle to be overcome for programmers who do not
natively use the romanic alphabet, with the more mainstream languages.

~~~
msoad
My native language is Farsi which it's alphabet is very similar to Arabic.
First problem is when we work on projects that need to output RTL text. We
have to program LTR with RTL string. No editor or IDE can handle it. Specially
command line tools. When a string contains both LTR and RTL text then it will
be a headache to maintain. You never know where is the ending quotation sign.
The other fun fact is, for us non English speakers who started programming
from early years of our life, some English words doesn't mean what they
actually mean. For example I didn't know what `inheritance` means in real life
but I was writing hierarchy in programs for a while!

~~~
graue
I'm a native English speaker, yet there were several words I knew the computer
meaning of before I knew the normal meaning. For example: icon and palette.
When people used the word "icon", but didn't mean the thing you click on to
start a program, I was confused.

------
killahpriest
Try this if you're stuck:

(قول "مرحبا يا عالم!")

    
    
       قول = say
       مرحبا = hello/welcome
       يا = oh
       عالم = world

~~~
vorg
This displays better:

‏(‏قول "مرحبا يا عالم!")‏)

You need to put a 0x200F (Unicode's right-to-left-mark) both before and after
the text, so the neutrally-directed characters ( ) and " will inherit the
directionality of the Arabic text, instead of the top-level left-to-right
context.

------
il_demente
If you are interested in Arabic programming languages then this will be a
treat ;)

Kalimat كلمات –meaning Words translated from Arabic– was designed and built as
a programming language that teaches children programming in Arabic as a part
of facilitating the process of bringing Computational Thinking to schools in
Egypt and allowing children to practice what the've learnt using a powerful
programming language.

With children on the mind of the language designer, he made sure that every
feature to be added won't add complexity to learning the language but rather
empower children to explore more about programming languages.

Kalimat is written in C++ using the QT Framework, and it runs on a virtual
machine written by the author of this programming language called SmallVM
(proving names can be deceiving :D). Both Kalimat and SmallVM are open source,
you can checkout the code repository here:
<https://code.google.com/p/kalimat/source/checkout>

Although Kalimat is written for children, that doesn't mean that it is weak or
to be considered as a toy language, it's quite the contrary actually. Under
this seemingly cuddly language, there's a small beast growing as the author
packs the language with features that appear in professional languages.

I am not the author of the language, so I am not familiar with all features of
this language, for more details you can:

1\. Checkout the language's website <http://www.kalimat-lang.com>.

2\. Usage guide [http://www.kalimat-
lang.com/wiki/%D8%AF%D9%84%D9%8A%D9%84_%D...](http://www.kalimat-
lang.com/wiki/%D8%AF%D9%84%D9%8A%D9%84_%D8%A7%D8%B3%D8%AA%D8%AE%D8%AF%D8%A7%D9%85_%D9%83%D9%84%D9%85%D8%A7%D8%AA)

3\. The author's blog under label Kalimat
<http://iamsamy.blogspot.com/search/label/kalimat>

4\. To begin learning the language, you can check Kalimat By Example tutorial
here: [http://www.kalimat-
lang.com/wiki/%D9%83%D9%84%D9%85%D8%A7%D8...](http://www.kalimat-
lang.com/wiki/%D9%83%D9%84%D9%85%D8%A7%D8%AA_%D8%A8%D8%A7%D9%84%D8%A3%D9%85%D8%AB%D9%84%D8%A9)

Side Note: Unfortunately the language website, usage guide and the blog are
written in Arabic.

However, these are some of the features I'm aware of:

\- Destructuring

\- Tail Call Elimination

\- Lambda Expression

\- Parallel Procedures

\- Green Threads

\- CSP Channels

\- Callbacks in FFI (similar to Java's JNI, Python's ctypes and C#'s
P/Invoke') which enables using external libraries and frameworks like OpenGL
<http://iamsamy.blogspot.com/2012/12/opengl-in-kalimat.html>

Along with primitive features like

\- Events

\- Defining classes with fields, Signals and Slots

\- Defining Modules

~~~
mahmud
First I hear of this. I know of Arabic Logo and Jeem.

~~~
il_demente
It is a sad thing it doesn't get enough publicity despite the effort put to it
I guess. As far as I know, it got covered in a few Arabic forums and
magazines, but didn't get any global awareness.

I myself learnt about كلمات because the guy behind it was a TA in our
university. He's a real inspiration and some of his ideas are really
innovational.

Judging by your name, I think you are an Arabic speaker, if so you could check
his blog to see for yourself <http://iamsamy.blogspot.com/>.

About a year ago he started another blog titled Computational Thinking in
Egypt if you're interested: <http://ctegypt.blogspot.com/>.

~~~
mahmud
صراحة اخبار مفرحة.بتابع مدونة اﻻستاذ سامي من اﻵن، واشكرك على تعريفي به وعمله.

------
mulligan
Cool project,

one nit in the description: "The name قلب is pronounced 'alb "

in standard arabic, it is actually "qalb", some dialects happen to drop the q
sound

~~~
ramseynasser
Spoiler Alert: I'm Lebanese ;-)

------
christiangenco
This makes me really appreciate non-english speaking programmers. They not
only have to learn all the logic and syntax I do, they had to learn the
symbols and what they meant and the english words.

------
shaunxcode
this is amazing, I created a similar hack for the "deseret" language. There is
a running repl at <http://deseretpl.org>

It has multiple levels of authentication - highest is:

user: elohim pass: melk

It is essentially a port of a toy lisp (soy) I wrote a while back so deseret
keys map straight to their ascii equivalent (as that is what deseret itself
really did).

QLB is much cooler in that it seems to be make semantic sense.

------
NelsonMinar
I was a little confused by the link; the main image is a screenshot of what
looks like a fairly ordinary Arabic text editor. I think the calligraphy
referenced here is the tile mosaic in the photograph. There's more photos of
geometric / artistic typesetting of QLB code in Nasser's tweets and blog. Is
this Kufic-like calligraphy being autogenerated from the source code? Or is it
laid out by hand?

------
pointernil
Some years ago I asked: what would "programming" look like if it was not
"invented"/"dominated" by the western culture? It's not only about the symbols
... how about f.e. a more holistic approach to problem solving instead the
dominating "commanding" approach used to "control" a machine ...

------
bamdadd
Why its not right to left and aligned to left ?

[https://github.com/nasser/---/blob/master/public/lib/amthila...](https://github.com/nasser/---/blob/master/public/lib/amthila/konway.qlb)

~~~
bamakhrama
This is because github does not _yet_ support right-to-left (RTL) programming
languages ;-) To display the text RTL, you need to specify the direction
attribute ("dir") in HTML.

~~~
ramseynasser
Exactly. Although @jorendorff on GitHub turned me on to a great Unicode
feature that might help: <https://github.com/nasser/---/pull/4>

------
hfahim
Thats artistic.. how did you overcome RTL support ?

~~~
ramseynasser
Glad you like it! RTL was overcome by using the latest CodeMirror and this
<https://github.com/marijnh/CodeMirror/pull/1103>

------
Issam
interesting experiment! but I think we should benefit from other cultures
experiments also; I mean, is there any similar (Chinese,Japanese, ...etc)
programming language? and what are the benefits or experience they got from
these languages?

