1.2. Hello, worlds!

As customary, the simplest (and of doubtful usefulness) hello-world program would be:

print "Hello, world!"

To run this, create a file called hello.blep and type-in the text above. Then write in the console blep hello.blep. [3]

This prints, “Hello world!”, as expected, on the screen. This can even be made an one-liner, using the command x, typing bleps x print Hello world or even shorter, as blepx print Hello world (blepx is just a shortcut for bleps x) [1] :

Of course this is not of much interest, as we came to Anableps looking for graphic excellence, so let’s see how can we greet-in in a more graphical way: see the following code (hello.1 ) [2]

label l: .text "Hello, world!": .font garamond : .place @ origin
save: .filename hello.png : .size 400x400

Now this is getting better!: after running it, we have produced an image file with a text on it, and it was something pretty simple to do. Notching-up things a little, let’s do something similar in three dimensions, as the following example shows (manual.hello2):

sphere s: .radius 40 80 cm
sticker t: .text "Hello, world!" : .onto s.surface : .angle 45 deg
save: .filename scene.png

Here, with barely three lines of code, we have created an space with an ellipsoid inside (note the two radius value for the sphere), and stuck a label on its surface.

Given a library with objects and powerful operators to place and modify them, the expressive power and thus the possibilities are huge: that is what Anableps and this user manual are about.

Footnotes

[1]Before we finish this minimal example, just note that whereas the simplest code is print "hello world", the shortest hello world would be "hello world"?. The ? postfix operator works the same as print
[2]You can type-in the examples given here, (which is perfectly fine and probably the best attitude towards learning fast) but very soon the examples will get much larger, so It’s good to known that Anableps can do it for you: type anableps example <reference.snippet_id> -o <filename> and you’ll get a copy of it in <filename>. Snippet ids will be given for each example.
[3]That is, you can run this directly on the command line (blepx print "hello world")

1.2.1. A slightly more complex example

So far we have just shown that Anableps blah blah (an example of lego?)