🌷 30 exercises in the Crystal language
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets πŸ›€ more cleanup of C code Apr 16, 2018
.gitignore πŸ›€ clean up code + comments Apr 16, 2018
.travis.yml ✨ Day 21 Aug 13, 2017
01_hello_world.cr ✨ Day 01 Jul 6, 2017
02_fibonacci.cr ✨ Day 02 Jul 6, 2017
03_io_interface.cr ✏️ fixed typo Jul 8, 2017
04_concurrency.cr πŸ›€ clean up code + comments Apr 16, 2018
05_http_server.cr ✨ Day 05 Jul 9, 2017
06_square_remainders.cr πŸ›€ clean up code + comments Apr 16, 2018
07_json_mapping.cr ✨ Day 07 Jul 12, 2017
08_bank_account.cr πŸ›€ clean up code + comments Apr 16, 2018
09_pascals_triangle.cr ✨ Day 09 Jul 16, 2017
10_run_length.cr ✨ Day 10 Jul 18, 2017
11_quine.cr ✨ Day 11 Jul 19, 2017
12_vector.cr ✨ Day 12 Jul 19, 2017
13_sieve_of_eratosthenes.cr ✨ Day 13 Jul 25, 2017
14_balanced_brackets.cr ✨ Day 14 Jul 25, 2017
15_geometric_center.cr πŸ›€ clean up code + comments Apr 16, 2018
16_monty_hall.cr ✨ Day 30 (finally)! Also, minor formatting fixes. Dec 28, 2017
17_sorts.cr ✨ Day 17 Aug 10, 2017
18_bindings.cr ✨ Day 18 Aug 10, 2017
19_almost_prime.cr ✨ Day 19 Aug 12, 2017
20_almost_prime.cr ✨ Day 20 Aug 12, 2017
21_dot_plot.cr ✨ Day 21 Aug 13, 2017
22_line_graph.cr ✨ Day 22 Aug 15, 2017
23_brainfuck.cr ✨ Day 23 Aug 16, 2017
24_knuths.cr ✨ Day 24 Aug 23, 2017
25_odering_game.cr ✨ Day 25 Aug 27, 2017
26_password.cr ✨ Day 30 (finally)! Also, minor formatting fixes. Dec 28, 2017
27_websockets.cr ✨ Day 27 Sep 6, 2017
28_map.cr ✨ Day 28 Sep 8, 2017
29_sum_of_multiples.cr ✨ Day 29 Oct 20, 2017
30_macros_low_level.cr ✨ Day 30 (finally)! Also, minor formatting fixes. Dec 28, 2017
Makefile πŸ’š tests Aug 13, 2017
README.md ✨ Day 30 (finally)! Also, minor formatting fixes. Dec 28, 2017
ideas.md ✨ Day 26 Aug 31, 2017

README.md

30 Days of Crystal

One exercise, once a day, for 30 days!

Progress: 30 / 30Β Β Β (100%)

Build Status

01 Hello World - Hello world!

02 Fibonacci - Comparing compiled speeds of the recursive and iterative Fibonacci functions, written in Crystal's easy and elegant syntax.

03 Math IO Interface - A simple CLI application that evaluates mathematical expressions, with a couple exciting options.

04 Concurrency - An illustration of Crystal's easy-to-use concurrency feature (fibers), and a discussion of its appropriate use.

05 HTTP Server - Building an HTTP Server in Crystal is awesomely intuitive! This one serves static files, too.

06 Square Remainders - Solving EP #120 with functional programming and logical thought.

07 JSON Mapping - Creating and rendering objects with the Crystal JSON API, introducing a very powerful feature of the language.

08 Bank Account - Exploring class variables, instance variables, and private methods through an application that keeps track of your bank account and its operations.

09 Pascal's Triangle - Generates and prints a number of rows from Pascal's Triangle using the nCk definition of the pattern.

10 Run-length Encoding - Simple data compression and expansion with RLE. Useful for languages with very repetitive words.

11 Quine - Turns out, quines in Crystal are pretty difficult without string dumping. String literals didn't work at all πŸ˜’, unlike in other languages.

12 Vector - Creating vectors - the mathematical object, not the data structure - with Crystal's efficient structs.

13 Sieve of Eratosthenes - A fun and quick one - searching for primality with an ancient formula!

14 Balanced Brackets - Checking for balanced brackets in a string. @atom come at me!

15 Geometric Center - Approximating the geometric center of a set of points with a bounded Newtonian search.

16 Monty Hall - Proving the solution to the Monty Hall Problem with simple experimentation.

17 Sorts - Simple implementations of three (heap, merge, quick) n(log(n)) sort algorithms! For a bigger challenge: rewrite them in C and link them in a Crystal program (Day 18).

18 Bindings - C bindings in Crystal are elegant and easy; here, we write and bind a primality function. (Unfortunately, C++ is not (yet) supported!)

19 Almost Prime (Part 1) - Calculating almost-primes with two prime factors and C bindings from Day 18. Day 20 introduces n-factor almost-prime determination!

20 Almost Prime (Part 2) - Determining n-factor almost-primes and n-number sum-of-primes as an extension of Day 19.

21 Dot Plot - Basically 15% of AP Stats in 20 lines of Crystal code. Bored? Try to rewrite this app in a more functional style, or save stdout to a file!

22 Line Graph - Dot plots ain't but a thing. Line graphs are way more fun (and a lot tougher, too)! Procs, blocks, and progress-tainting rocks are all over this project.

23 Brainfuck - You can't say you know a language until you write an interpreter for a ridiculous, esoteric language (that somehow also manages to be Turing complete) with that language. At least that's what they say.

24 Knuth's Algorithm - Knuth's algorithm S is a good excuse for to look at closures and function passing in Crystal, via Procs. Clean, easy-to-read syntax makes this a pleasing problem to solve.

25 Ordering Game - A simple CLI order-swapping game. It's an easy project to go through and a great introduction to command-line applications!

26 Password Storage - Password storage with Crystal's native Bcrypt implementation and a simple database in the form of an untyped text file. Not for use in production.

27 WebSockets - As we wrap up, it's time to do something fun. In this example, we play with WebSockets, HTTP handlers, and Procs (which also introduce closures!).

28 Map - A map of the Vanderbilt commons and first-year housing, with integrated directions between any two houses. More Procs, arrays, and module properties in this one!

29 Sum of Multiples - Sum up the multiples of any set of numbers, up to any limit you like. This program also introduces Crystal's free variables, a feature similar to C++ type templates.

30 Macros with Low-level operations - For our last day, we explore one of Crystal's more powerful features - macros - and look at the low-level operations available in Crystal.