Returning to Crystal after 4 years

I am excited to be back.
I have had a look at Crystal in 2018, and put it on the back burner due to it not having a 1.0 release yet.
Then I forgot about it :sweat_smile: and now I rediscovered it and I really like the concise and productive syntax while still being able to produce portable (static) binaries.

I’m currently doing a course on Crystal (Crystal Lang - Learn Programming with Crystal | codingphase) because my main programming language has been Python recently.

I’m also picking up some exercises on exercism: Crystal on Exercism

Is there anything else you would recommend me to look at?

3 Likes

Welcome back!

There is a book now , in paper, Book: Crystal Programming

2 Likes

@mavu thank you very much! I appreciate that.

There is a book now , in paper, Book: Crystal Programming

Good point, I’ll have a look, but I usually prefer videos, to be honest.
I don’t know why, but I just can learn more easily that way. :sweat_smile:

Another good source of Crystal use is on Rosetta Code.

Here is a list of all the problems with Crystal examples.

There’s also a thread on this in the forum.

2 Likes

@jzakiya thank you for that, but it seems the link is broken?

404

Hmm…I don’t know what|where that link goes to, but the one for the Crystal Rosetta Code examples I provided works. https://rosettacode.org/wiki/Category:Crystal

That one, yes, but this one (also mentioned in the linked post at the top) doesn’t:
https://rosettacode.org/wiki/Reports:Tasks_not_implemented_in_Crystal

Oh, good catch.
Rosetta Code updated their website this year and I guess they killed some of their old urls.

Here’s the link to all their programming tasks: Rosetta Code Tasks

I did a quick search and couldn’t find where the list of not done tasks for Crystal (each language) is now. Maybe they axed it (too much work?). I’ll try to see if it still exists later when I have the time.

But you can still see what the done Crystal examples are, and see from the whole list what’s yet to be done in Crystal. That’s a good place to start learning how to use Crystal, the easiest thing being to translate the Ruby example (if it exists) and then Crystalize it into iconic Crystal.

EDIT: I meant to say idiomatic Crystal.

1 Like

That is a great suggestion, thank you, @jzakiya :+1:

iconic Crystal

Is this a used term in the Crystal community, like “Pythonic” in the Python community? (idiomatic Python code)

If you want a quick tour, check code-maven.com/slides/crystal

There are two books available as ebook pdf, as mention by others.

For the newest document, you have to read offical reference

Check Blogs and search/ask on current form, you can get lots of useful information.

You can search Crystal lang on Youtube, there are many videos too.

1 Like

@zw963 thank you very much!

Do you also have any recommendation for functional programming in Crystal?

From my point of view, functional programming in Crystal all come from Ruby, if you are a typical Ruby programmer, and know the lambda and Proc.new in ruby, you probably know every things about it, if you are not, only reading The ruby programming language write by the author of Ruby is enough.

You don’t need learn Haskell or Lisp for this purpose.

1 Like

Quick note: one big difference with Ruby related to functional programming is the struct construct of Crystal. struct objects are allocated in the stack instead of in the heap, and therefore, are copied over (passed as values). As mentioned in the book,

… structs are mostly useful for immutable data types and/or stateless wrappers of other types…

PS: Welcome back @nheer!

2 Likes

Thank you, both so much @zw963 and @beta-ziliani this is much appreciated! :+1:

[…] struct objects are allocated in the stack instead of in the heap, and therefore, are copied over (passed as values).

Wow, that sounds super useful for functional programming. Thank you :slight_smile:

1 Like

For me, a Crystal user about six months of experience, didn’t find that in the process of using Crystal, there are many functional usages related to struct, admittedly, using struct far more than when using with Ruby, almost always used to hold some structured data, used to replace Hash, you know, type is key, that is the reason, that’s why everyone loves Crystal over Ruby here.

1 Like