Question: Learning Julia (Strings, For Loops, etc)?


Learning Julia (Strings, For Loops, etc)?

Answers 2
Added at 2016-12-11 15:12

Learning a programming language is always a challenge, because you are not familiar with the syntax or what functions are available. I decided to learn Julia because it has its focus in academia. On the Internez i read that it copies a lot of good things from Python. I have already worked with Python and enjoyed the Pythonic syntax.

I started with a calculation of bit values of 2 strings and this is my result.

function crypt(message, key)
    result = ""
    while length(result) < length(key)
        result *= string(Char(Int(message[length(result)+1]) $ Int(key[length(result)+1])))
    return result

It looks really awkward and ugly in my eyes when i compare it to Python. But i could not find any Tutorials or Guides how to use this language. And the documentation on their website isn't much help neither.

How do i learn this language? Where do i get information about it?

ps. Python:

def crypt(message, key):
    result = [chr(ord(m) ^ ord(k)) for m, k in zip(message, key)]
    return "".join(result)
nr: #1 dodano: 2016-12-11 16:12

There are several basic tutorials listed on the Julia homepage at

nr: #2 dodano: 2016-12-11 17:12

Something like this looks close enough:

julia> function crypt(message, key)
          join([Char(Int(m) $ Int(k)) for (m, k) in zip(message, key)])
crypt (generic function with 1 method)

julia> crypt("Hello", "world")

and not that much uglier than the Python. But beauty is in the eye of the beholder, as they say...

As for learning the language:

enter image description here

Source Show
◀ Wstecz