Recent Posts

Pages: [1] 2
1
News & Announce / ELENA 6.0 first beta is out
« Last post by Alex Rakov on March 24, 2023, 05:50:29 am »
After a hard work for more than a year a first beta version of ELENA 6.0 is out. It is released for all supported platforms : Windows x86 / x86-64 and Linux I386 / AMD64 / PPC64le / AARCH64

Please visit a release page to get an access for binaries : https://github.com/ELENA-LANG/elena-lang/releases/tag/v6.0.1b

If you have any questions, bug reports or suggestions, please post them on the discussion board : https://github.com/ELENA-LANG/elena-lang/discussions/565
2
News & Announce / ELENA sub reddit
« Last post by Alex Rakov on April 18, 2017, 04:58:11 am »
You may visit ELENA sub-reddit - https://www.reddit.com/r/elena_lang/
3
Tutorials / Tutorial: Stack allocated variables
« Last post by Alex Rakov on August 11, 2015, 05:43:26 am »
4
News & Announce / ELENA Twitter account
« Last post by Alex Rakov on August 04, 2015, 06:58:52 am »
ELENA Programming Language has a twitter account now - https://twitter.com/elena_language
5
News & Announce / ELENA 1.9.19.6 build (win32) is out
« Last post by Alex Rakov on July 15, 2015, 05:27:09 pm »
ELENA 1.9.19.6 build (win32) is out

A new build is available at http://sourceforge.net/projects/elenalang/files/ELENA%202.x/builds/

lib30 and the compiler are refactored
6
News & Announce / ELENA 1.9.19.5 setup blocked
« Last post by Alex Rakov on July 08, 2015, 08:38:40 am »
Windows blocks the downloaded setup from being executed.

You may either unblock the file or download zip archive.
7
News & Announce / ELENA 1.9.19.5 build (win32 / linux32) is out
« Last post by Alex Rakov on July 06, 2015, 04:20:54 pm »
ELENA 1.9.19.5 build (win32 / linux32) is out

A new build is available at http://sourceforge.net/projects/elenalang/files/ELENA%202.x/builds/

A lot of changes, lib30 is refactored, sqlite package
8
News & Announce / ELENA Source code migrated
« Last post by Alex Rakov on April 29, 2015, 12:33:27 pm »
ELENA source code was migrated to GitHub. SVN repository is now obsolete!

New repository address is now - http://github.com/ELENA-LANG/elena-lang

There are three branches: master (the latest release), current (a last stable build) and sandbox (work in progress)

The latest build is now available from github as well - http://github.com/ELENA-LANG/elena-lang/releases/tag/v1.9.19.4a
9
News & Announce / ELENA 1.9.19.4 build (win32 / linux32) is out
« Last post by Alex Rakov on April 28, 2015, 04:21:20 pm »
A new build is available at http://sourceforge.net/projects/elenalang/files/ELENA%202.x/builds/

$nil pseudo variable is added, to replace nil one.

In Linux version new examples are ported : goods, textfile, textdb

In Windows version gui samples added : agenda, c_a_g, graph

As usually any bug report is welcomed
10
Tutorials / Tutorial: Literal as an array of characters
« Last post by Alex Rakov on April 15, 2015, 08:33:11 am »
In this tutorial we will see how could we read the literal a character by character.

Let's consider the simple example: we will read each literal character and print it on the screen.

Code: [Select]
#define system.
#define extensions.

// ...

        #var l := "Hello world".
        #var i := 0.
        #loop (i < l length)?
        [
            console write:(l@i).
           
            i := i + 1.
        ].

So far so good. Let's now make our example a little bit more difficult:

Code: [Select]
        l := "Привет Мир".
        #var i := 0.
        #loop (i < l length)?
        [
            console write:(l@i).
           
            i := i + 1.
        ].

The first loop works but the second one fails.

Let's find what breaks our code.

Starting from 1.9.19 LiteralValue is UTF-8. So the literal is actually twice as long. All Russian characters are encoded by two bytes. So why the code was not broken in the first loop? Because CharValue is UTF-32. It has enough place to store any Unicode characters. But when we read the second byte CharValue raises the exception because the code is invalid.

Note that it would works well if "l" is WideLiteralValue. But we will have the similar problem for Chinese symbols.

Fortunately we could easily fix the problem if we will use CharValue.length method. It returns how much bytes it take to encode the symbol.

Code: [Select]
        i := 0.
        #loop (i < l length)?
        [
            console write:(l@i).
           
            i := i + l@i length.
        ].

Or we could use an enumerator:

Code: [Select]
        #var enum := l enumerator.
        #loop (enum next)?
        [
            console write:(enum get).
        ].

And the simplest way would be to use extensions'control helper:

Code: [Select]
       control run:l &forEach: ch [ console write:ch. ].
Pages: [1] 2