1. David Krentzlin
  2. lisp-unleashed blog

Commits

certainty  committed f4e0cb6

updated example

  • Participants
  • Parent commits b86f7c5
  • Branches default

Comments (0)

Files changed (1)

File _posts/2012-10-25-pipes_and_filters_in_ruby.md

View file
 So ruby allows the following:
 
 {% highlight ruby %}
-%w(Alicia David Lucie Jenny).map(&:downcase).map(&:reverse).map(&:capitalize)
+puts %w(Alicia David Lucie Jenny).map(&:downcase).map(&:reverse).map(&:capitalize)
 {% endhighlight %}
 
 When I looked at this I thought, wow that looks like a lot like a pipe on the unix command line.
 
 With this in place we can run the expression from the beginning and get the the following result:
 
-      Aicila
-      Divad
-      Eicul
-      Ynnej
+    ["Aicila", "Divad", "Eicul", "Ynnej"]
 
 Not so bad for a couple of lines of code. With this in place we can do some nice experiments.
 Note that in other languages you get these kinds of things with function composition. So the