User Tools

Site Tools


2019:notes_on_teaching_elixir

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
2019:notes_on_teaching_elixir [2019/04/29 14:06] – [Ordering for teaching functions] adolfont2019:notes_on_teaching_elixir [2020/11/19 11:42] (current) – external edit 127.0.0.1
Line 3: Line 3:
  
 ===== Ordering for teaching functions ===== ===== Ordering for teaching functions =====
 +
 +<html>
 +<blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">Right now everyone teaches anonymous functions first because they are easier to express in iex. Here&#39;s our ordering: <br><br>1. We introduce the concept of a module. Not coding, just the concept. <br>2. Invoking M.f() in a module<br>3. defmodule/def. <br>4. Pipes. <br>5. Anon f.<br><br>I ❤️ this order</p>&mdash; Bruce Tate (@redrapids) <a href="https://twitter.com/redrapids/status/1121022240047403008?ref_src=twsrc%5Etfw">April 24, 2019</a></blockquote>
 +<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
 +</html>
  
  
Line 15: Line 20:
  
 [[https://elixirforum.com/t/is-introducing-elixir-getting-started-in-functional-programming-still-good/21984|"I prefer books as my preferred method of learning"]] [[https://elixirforum.com/t/is-introducing-elixir-getting-started-in-functional-programming-still-good/21984|"I prefer books as my preferred method of learning"]]
 +
 +
 +===== Method =====
 +
 +<html>
 +<blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">&quot;If you want to teach someone a real skill, teach him how to fail. He will never learn it in school.&quot; - <a href="https://twitter.com/nntaleb?ref_src=twsrc%5Etfw">@nntaleb</a></p>&mdash; Nassim Nicholas Taleb&#39;s Wisdom (@TalebWisdom) <a href="https://twitter.com/TalebWisdom/status/1134230061270405120?ref_src=twsrc%5Etfw">May 30, 2019</a></blockquote>
 +<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
 +</html>
 +
 +
 +===== Calling functions =====
 +
 +Module, function and arguments.
 +
 +==== By arity ====
 +
 +=== Zeroary functions ===
 +
 +<code>
 +Math.pi()
 +alias :math, as: Math
 +Math.pi()
 +</code>
 +
 +=== Unary functions ===
 +
 +<code>
 +Kenel.abs(-34)
 +Kernel.abs (-34)
 +Kernel.absolute(-34)
 +</code>
 +
 +<code>
 +Kernel.abs(-34)
 +Kernel.abs -34
 +Kernel.abs (-34)
 +
 +Kernel.round(34.6)
 +Kernel.floor(34.6)
 +Kernel.ceil(34.9)
 +</code>
 +
 +=== Binary functions ===
 +
 +<code>
 +Kernel.max(1,2)  
 +Kernel.max(2,1)  
 +Kernel.min(2,1)  
 +Kernel.div(10,4)
 +Kernel.rem(10,4)
 +Kernel.div(10,0)
 +</code>
 +
 +
 +
2019/notes_on_teaching_elixir.1556546770.txt.gz · Last modified: 2020/11/19 11:42 (external edit)