Learning mode for crystal on exercism
I am currently planning to build a learning mode for the crystal. A learning mode means that the language has a syllabus tree covering various language-centric concepts. I have set up a base “tree”, and over time more could be added. Here is my current draft:
Here is what every concept will cover:
Basics
- Create variabels and constants
- How to define a method and how to call a method
- Default parameters
Numbers
- Cover basic “math” methods (
+
,-
,*
,**
,/
,%
) - How to round a number
- Floats, Uint, int and all the forms of them e.g int16 etc
- How to convert between different number types
- Prioritization in math methods
Binary & octal & hexadecimal
- How to create Binary & octal & hexadecimal
- TBD
Bools
-
True
/False
-
&&
,||
!
classes
- General oop
- Initialize
- Instance variables
- Class variables
Getters/setters
- Getter
- Property
Strings
- What a string is and how to create them
- Interpolation
- Empty?
- Size
- Indexing
- Convert a string to a number and the other way around
String methods
- Escaping
- gsub
- TBD
Conditionals
- If/elsif/else
- Comparisons operators(
==
,<=
etc) - Unless
Case (switch)
- How to create a case
- When to use a case
Modules
- How to create a module
- Difference between a class and a module
- Extend & include
Ternary operator
- How to create a ternary operator
Char
- Basics of what a char is and how to use them
- TBD
While & Until
- How to create a while loop
- Next
- Break
- Until
- Difference between until and while
Range
- Range with numbers, chars, and strings
- Range with
..
and...
- How to slice a String
Nil
- Introduction to nil
- Explain that
[x]?
returns the item if it exists otherwise nil.
Union types
- Explain how to create a union type
- Explain that assigning for example
Int32?
means (Int32 | Nil) - Explain
typeof
vs.class
Rasing errors
- Explain how to raise errors
- Explain errors in crystal
Array
- How to create an array
- Declaring an empty array
- Declaring a nested array
- Indexing and slicing arrays
- Join and split
- Explain that arrays are mutable
- Explain append(
<<
) - Delete/pop
Array methods
- Sort
- uniq
- shift
- fil
- concat
- Compact
- First
- Last
- Flatten
- Reverse
- Rotate
- Shuffle
- Index
- TBD
Enumeration
- each
- all?
- any?
- count
- each_with_index
- find
- none?
- map
- map_with_index
- one?
- products
- reduce
- sum
- Sort_by
More enumeration
Comment: Some of this will there not be any deep dive on, just a mention
- chunks
- cycles
- each cons
- each cons pair
- each slice
- group_by
- in_groups_of
- max_by
- max_of
- min_by
- min_of
- reject
- Select
- skip_while
- skip
- take_while
Symbols
- What a symbol is
- Comparison between symbols and strings
- Convert a symbol to a string
Tuples
- How to create a tuple
- Difference between array and tuple
- When to use a tuple and when to use an array
- Explain that tuples are immutable
Hashes
- Explain how to create a hash
- Explain how to create a hash with symbols
- Explain how to create an empty hash
- Explain hash methods TBD
Named tuple
- How to create a named tuple and the difference between a hash.
Decompositon & multiple assignment
- How to do multiple assignments
- How to use the splat operator
Now when the very WIP explanation is over.
The reason I want to bring this up with the crystal community is that once the tree is implemented it is quite hard to do major changes to the root of the tree. With that said after the base is implemented it is possible to make new branches, for example, say we want a concept about a math module. We can just branch that of numbers and there will be no pain points. Although say we decide to change so we first learn strings and then bools. Such a change will require a lot of work and should be avoided.
Thereby I want feedback on everything, on the order, is a concept missing from the root (for example there should be a concept about regex before arrays (not about new branches, just changes that affect current branches). Is there something in the explanation of the concept that should be added/explained at an earlier/later concept.
Here is an example of how the tree looks for C# syllabus tree on exercism and Elxir syllabus on Exercism.
Feedback on more “branches”(not the root which is shown in the tree) to be added is welcome but there are already 23 concepts and as I am the only one working on this, so could take a while until those gets added.