Presented at Open Source South Carolina, 8/14/19
Presented by Drew Varner, Owner of NineFX
Abstract: The talk will survey the functional programming landscape. We will introduce different functional languages and discuss their strengths and weaknesses. We will look at major open source projects powered by functional languages and discuss who is using them and why.
3. Who am I?
Drew Varner, Developer
• Erlang, Elixir, ReasonML, Scala
• Member: Erlang Ecosystem Foundation (EEF)
• Member: EEF Security Working Group
• Voting Member: OASIS Open CTI, OpenC2, and MQTT
Technical Committees
• Co-editor: TAXII 2.1 Specification
4. Who are we?
NineFX, Inc.
• Software company @ USC/Columbia Technology Incubator
• Actively supporting and developing functional software for
Federal clients
• Software written in Erlang, Elixir, and ReasonML
5. The right tools
Why?
• Immutability (Concurrency)
• Hindley–Milner (HM) type systems
• ML languages
• Haskell
• Recursion
• Especially tail recursion
• Little to no side effects
• Referential transparency
6. This stuff isn't new
Lisp 1958
ML 1972
Caml 1987
Erlang 1987
Haskell 1990
https://xkcd.com/297/
16. Tools of the trade: asdf
clojure coq chicken (Scheme)
elixir elm erlang
haskell scala ocaml
racket
(Scheme derivative)
lfe
(Lisp-flavored Erlang)
17. Immutability (Object-Oriented)
List<Integer> items = new ArrayList<Integer>();
items.add(1);
items.add(2);
trustme.borrow(items);
// ...
int total = 0;
for (int i=0; i < items.size(); i++) {
total = total + items.get(i);
}
19. Immutability, a big change
Erlang Elixir Scala
1> A = 1.
1
2> A = A + 1.
** exception
error: no match of
right hand side
value 2
iex(1)> a = 1
1
iex(2)> a = a + 1
2
scala> var x = 1
x: Int = 1
scala> x = x + 1
mutated x
scala> val y = 1
y: Int = 1
scala> y = y + 1
^
error: reassignment to val
21. Lists in Erlang
• Singly linked lists
• Head of list: first item
• Tail of list: remaining items
A B C
Eshell V10.3.1 (abort with ^G)
1> List = ["A", "B", "C"].
["A","B","C"]
2> hd(List).
"A"
3> tl(List).
["B","C"]