SlideShare a Scribd company logo
Elixir紹介
2014/05/08
SICP Club LT
Livesense Inc.
HORINOUCHI Masato
Elixirとは
Elixir is a func-onal, meta-programming aware language built on
top of the Erlang VM. It is a dynamic language that focuses on
tooling to leverage Erlang's abili-es to build concurrent, distributed
and fault-tolerant applica-ons with hot code upgrades.
見た目は
Ruby
中身は
Lisp
特徴
• 近代的なシンタックス
• 全てが式
• 強力なメタプログラミング機能
• 第一級オブジェクトとしてのドキュメント
• Erlangランタイムとの相互運用
Fibonacci (Ruby)
class Fib
def self.fib n
case n
when 0 then 0
when 1 then 1
else fib(n - 1) + fib(n - 2)
end
end
end
puts Fib.fib 10
Fibonacci (Elixir)
defmodule Fib do
def fib(0), do: 1
def fib(1), do: 1
def fib(n), do: fib(n-1) + fib(n-2)
end
IO.puts Fib.fib 6
Install
• OS X (homebrew)
• $ brew install erlang –devel
• $ brew install elixir
• Windows
• なんか大変らしい
• Ubuntu
• PPA あるよ
REPL
$ iex
iex> defmodule Hello do
...> def world do
...> IO.puts "Hello, world"
...> end
...> end
iex> Hello.world
Hello, world
:ok
iex>
無名関数
iex> f = fn(x) -> x * 2 end
iex> f.(4)
8
iex> (fn(x) -> x * 3 end).(3)
9
map reduce
iex> Enum.map(
...> [1,2,3],
...> fn(x) -> x * 2 end)
[2, 4, 6]
iex> Enum.reduce(
...> [1,2,3],
...> fn(x, acc) -> x + acc end)
6
キーワード引数と括弧の省略
iex> if true do
...> 1
...> else
...> 2
...> end
1
iex> if true, do: 1, else: 2
1
iex> if true, [do: 1, else: 2]
1
iex> if(true, [do: 1, else: 2])
1
Homoiconicity
In a homoiconic language the primary representa3on of programs is
also a data structure in a primi3ve type of the language itself. This
makes metaprogramming easier than in a language without this
property, since code can be treated as data: reflec3on in the
language (examining the program's en33es at run3me) depends on
a single, homogeneous structure, and it does not have to handle
several different structures that would appear in a complex syntax.
To put that another way, homoiconicity is where a program's source
code is wriDen as a basic data structure that the programming
language knows how to access.
quote
iex> length [1,2,3]
3
iex> quote do: length [1,2,3]
{:length, [context: Elixir, import: Kernel], [[1, 2, 3]]}
iex> 1 + 2
3
iex> quote do: 1 + 2
{:+, [context: Elixir, import: Kernel], [1, 2]}
macro
iex> defmodule MyUnless do
...> defmacro unless(clause, options) do
...> quote do: if !unquote(clause),
...> unquote(options)
...> end
...> end
iex> require MyUnless
nil
Iex> MyUnless.unless true, do: 1, else: 2
2
defmacro if
defmacro if(condition, clauses) do
do_clause = Keyword.get(clauses, :do, nil)
else_clause = Keyword.get(clauses, :else, nil)
quote do
case unquote(condition) do
_ in [false, nil] -> unquote(else_clause)
_ -> unquote(do_clause)
end
end
end
if すらもマクロ
ご清聴ありがとうございました

More Related Content

What's hot

Textual programming in key stage 3
Textual programming in key stage 3Textual programming in key stage 3
Textual programming in key stage 3
eaglestone
 
VB.NET:An introduction to Namespaces in .NET framework
VB.NET:An introduction to  Namespaces in .NET frameworkVB.NET:An introduction to  Namespaces in .NET framework
VB.NET:An introduction to Namespaces in .NET framework
Richa Handa
 
LIL Presentation
LIL PresentationLIL Presentation
LIL Presentation
badsectoracula
 
Python - Lesson 1
Python - Lesson 1Python - Lesson 1
Python - Lesson 1
Andrew Frangos
 
web programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Malothweb programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Maloth
Bhavsingh Maloth
 
Create Your Own Language
Create Your Own LanguageCreate Your Own Language
Create Your Own Language
Hamidreza Soleimani
 
Before Starting Python Programming Language
Before Starting Python Programming LanguageBefore Starting Python Programming Language
Before Starting Python Programming Language
Kishan Tongrao
 
.Net framework components by naveen kumar veligeti
.Net framework components by naveen kumar veligeti.Net framework components by naveen kumar veligeti
.Net framework components by naveen kumar veligeti
Naveen Kumar Veligeti
 
Python Tutorial for Beginner
Python Tutorial for BeginnerPython Tutorial for Beginner
Python Tutorial for Beginner
rajkamaltibacademy
 
Programming
ProgrammingProgramming
Programming
monishagoyal4
 
Elixir's Object Oriented Layer
Elixir's Object Oriented LayerElixir's Object Oriented Layer
Elixir's Object Oriented Layer
Paolo Montrasio
 
Introduction To Python | Edureka
Introduction To Python | EdurekaIntroduction To Python | Edureka
Introduction To Python | Edureka
Edureka!
 
Presentation of Python, Django, DockerStack
Presentation of Python, Django, DockerStackPresentation of Python, Django, DockerStack
Presentation of Python, Django, DockerStack
David Sanchez
 
Introduction about Python by JanBask Training
Introduction about Python by JanBask TrainingIntroduction about Python by JanBask Training
Introduction about Python by JanBask Training
JanBask Training
 
Socket Programming In Python
Socket Programming In PythonSocket Programming In Python
Socket Programming In Python
didip
 
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
Bhavsingh Maloth
 
GDG Helwan Introduction to python
GDG Helwan Introduction to pythonGDG Helwan Introduction to python
GDG Helwan Introduction to python
Mohamed Hegazy
 
Erlang - Concurrent Language for Concurrent World
Erlang - Concurrent Language for Concurrent WorldErlang - Concurrent Language for Concurrent World
Erlang - Concurrent Language for Concurrent World
Zvi Avraham
 
Pharo foreign function interface (FFI) by example by Esteban Lorenzano
Pharo foreign function interface (FFI) by example by Esteban LorenzanoPharo foreign function interface (FFI) by example by Esteban Lorenzano
Pharo foreign function interface (FFI) by example by Esteban Lorenzano
FAST
 
Python final presentation kirti ppt1
Python final presentation kirti ppt1Python final presentation kirti ppt1
Python final presentation kirti ppt1
Kirti Verma
 

What's hot (20)

Textual programming in key stage 3
Textual programming in key stage 3Textual programming in key stage 3
Textual programming in key stage 3
 
VB.NET:An introduction to Namespaces in .NET framework
VB.NET:An introduction to  Namespaces in .NET frameworkVB.NET:An introduction to  Namespaces in .NET framework
VB.NET:An introduction to Namespaces in .NET framework
 
LIL Presentation
LIL PresentationLIL Presentation
LIL Presentation
 
Python - Lesson 1
Python - Lesson 1Python - Lesson 1
Python - Lesson 1
 
web programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Malothweb programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Maloth
 
Create Your Own Language
Create Your Own LanguageCreate Your Own Language
Create Your Own Language
 
Before Starting Python Programming Language
Before Starting Python Programming LanguageBefore Starting Python Programming Language
Before Starting Python Programming Language
 
.Net framework components by naveen kumar veligeti
.Net framework components by naveen kumar veligeti.Net framework components by naveen kumar veligeti
.Net framework components by naveen kumar veligeti
 
Python Tutorial for Beginner
Python Tutorial for BeginnerPython Tutorial for Beginner
Python Tutorial for Beginner
 
Programming
ProgrammingProgramming
Programming
 
Elixir's Object Oriented Layer
Elixir's Object Oriented LayerElixir's Object Oriented Layer
Elixir's Object Oriented Layer
 
Introduction To Python | Edureka
Introduction To Python | EdurekaIntroduction To Python | Edureka
Introduction To Python | Edureka
 
Presentation of Python, Django, DockerStack
Presentation of Python, Django, DockerStackPresentation of Python, Django, DockerStack
Presentation of Python, Django, DockerStack
 
Introduction about Python by JanBask Training
Introduction about Python by JanBask TrainingIntroduction about Python by JanBask Training
Introduction about Python by JanBask Training
 
Socket Programming In Python
Socket Programming In PythonSocket Programming In Python
Socket Programming In Python
 
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
 
GDG Helwan Introduction to python
GDG Helwan Introduction to pythonGDG Helwan Introduction to python
GDG Helwan Introduction to python
 
Erlang - Concurrent Language for Concurrent World
Erlang - Concurrent Language for Concurrent WorldErlang - Concurrent Language for Concurrent World
Erlang - Concurrent Language for Concurrent World
 
Pharo foreign function interface (FFI) by example by Esteban Lorenzano
Pharo foreign function interface (FFI) by example by Esteban LorenzanoPharo foreign function interface (FFI) by example by Esteban Lorenzano
Pharo foreign function interface (FFI) by example by Esteban Lorenzano
 
Python final presentation kirti ppt1
Python final presentation kirti ppt1Python final presentation kirti ppt1
Python final presentation kirti ppt1
 

Viewers also liked

A mathematical appraisal
A mathematical appraisalA mathematical appraisal
A mathematical appraisal
Alexander Decker
 
A moving average analysis of the age distribution and
A moving average analysis of the age distribution andA moving average analysis of the age distribution and
A moving average analysis of the age distribution and
Alexander Decker
 
Gresume0716
Gresume0716Gresume0716
Gresume0716
Girish Kaulgud
 
A440
A440A440
أخطاء و ضلالات سيد قطب بالكتاب والصفحة و رد العلماء عليه
 أخطاء و ضلالات سيد قطب بالكتاب والصفحة و رد العلماء عليه  أخطاء و ضلالات سيد قطب بالكتاب والصفحة و رد العلماء عليه
أخطاء و ضلالات سيد قطب بالكتاب والصفحة و رد العلماء عليه
ania amiis
 
Who’d be a parent - your role in drug and alcohol prevention
Who’d be a parent - your role in drug and alcohol prevention Who’d be a parent - your role in drug and alcohol prevention
Who’d be a parent - your role in drug and alcohol prevention
Mentor
 
Inside mml2wav.rb
Inside mml2wav.rbInside mml2wav.rb
Inside mml2wav.rb
Masato HORINOUCHI
 
The Digital Garage Certification
The Digital Garage CertificationThe Digital Garage Certification
The Digital Garage Certification
Stuart Seager
 
POSIX Threads
POSIX ThreadsPOSIX Threads
POSIX Threads
Masato HORINOUCHI
 
September 2010-President's List
September 2010-President's ListSeptember 2010-President's List
September 2010-President's ListLesley Johnson
 
学生、教職員が一線に並んで交流できる 「英語でビブリオバトル」
学生、教職員が一線に並んで交流できる 「英語でビブリオバトル」学生、教職員が一線に並んで交流できる 「英語でビブリオバトル」
学生、教職員が一線に並んで交流できる 「英語でビブリオバトル」
Yukie KONDO
 

Viewers also liked (11)

A mathematical appraisal
A mathematical appraisalA mathematical appraisal
A mathematical appraisal
 
A moving average analysis of the age distribution and
A moving average analysis of the age distribution andA moving average analysis of the age distribution and
A moving average analysis of the age distribution and
 
Gresume0716
Gresume0716Gresume0716
Gresume0716
 
A440
A440A440
A440
 
أخطاء و ضلالات سيد قطب بالكتاب والصفحة و رد العلماء عليه
 أخطاء و ضلالات سيد قطب بالكتاب والصفحة و رد العلماء عليه  أخطاء و ضلالات سيد قطب بالكتاب والصفحة و رد العلماء عليه
أخطاء و ضلالات سيد قطب بالكتاب والصفحة و رد العلماء عليه
 
Who’d be a parent - your role in drug and alcohol prevention
Who’d be a parent - your role in drug and alcohol prevention Who’d be a parent - your role in drug and alcohol prevention
Who’d be a parent - your role in drug and alcohol prevention
 
Inside mml2wav.rb
Inside mml2wav.rbInside mml2wav.rb
Inside mml2wav.rb
 
The Digital Garage Certification
The Digital Garage CertificationThe Digital Garage Certification
The Digital Garage Certification
 
POSIX Threads
POSIX ThreadsPOSIX Threads
POSIX Threads
 
September 2010-President's List
September 2010-President's ListSeptember 2010-President's List
September 2010-President's List
 
学生、教職員が一線に並んで交流できる 「英語でビブリオバトル」
学生、教職員が一線に並んで交流できる 「英語でビブリオバトル」学生、教職員が一線に並んで交流できる 「英語でビブリオバトル」
学生、教職員が一線に並んで交流できる 「英語でビブリオバトル」
 

Similar to Elixir紹介

20240412 QFM010 Elixir Reading List March 2024
20240412 QFM010 Elixir Reading List March 202420240412 QFM010 Elixir Reading List March 2024
20240412 QFM010 Elixir Reading List March 2024
Matthew Sinclair
 
Programing paradigm & implementation
Programing paradigm & implementationPrograming paradigm & implementation
Programing paradigm & implementation
Bilal Maqbool ツ
 
Seeking Clojure
Seeking ClojureSeeking Clojure
Seeking Clojure
chrisriceuk
 
OOP Comparative Study
OOP Comparative StudyOOP Comparative Study
OOP Comparative Study
Darren Tan
 
02 intro to programming in .net (part 2)
02   intro to programming in .net (part 2)02   intro to programming in .net (part 2)
02 intro to programming in .net (part 2)
Felisha Hosein
 
Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processors
Rebaz Najeeb
 
BUD17-104: Scripting Languages in IoT: Challenges and Approaches
BUD17-104: Scripting Languages in IoT: Challenges and ApproachesBUD17-104: Scripting Languages in IoT: Challenges and Approaches
BUD17-104: Scripting Languages in IoT: Challenges and Approaches
Linaro
 
Technologies of today
Technologies of todayTechnologies of today
Technologies of today
kagecat
 
Unit 1
Unit 1Unit 1
Unit 1
ankita1317
 
JAVA
JAVAJAVA
ICT-DBA4 -05-0811-Apply-Object-Oriented-Programming-Language-Skills.doc
ICT-DBA4 -05-0811-Apply-Object-Oriented-Programming-Language-Skills.docICT-DBA4 -05-0811-Apply-Object-Oriented-Programming-Language-Skills.doc
ICT-DBA4 -05-0811-Apply-Object-Oriented-Programming-Language-Skills.doc
AmanGunner
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
SIVAJISADHANA
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
SIVAJISADHANA
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
SIVAJISADHANA
 
DEF CON 23 - Saif el-sherei and etienne stalmans - fuzzing
DEF CON 23 - Saif el-sherei and etienne stalmans - fuzzingDEF CON 23 - Saif el-sherei and etienne stalmans - fuzzing
DEF CON 23 - Saif el-sherei and etienne stalmans - fuzzing
Felipe Prado
 
Introduction To Computer Programming
Introduction To Computer ProgrammingIntroduction To Computer Programming
Introduction To Computer Programming
Hussain Buksh
 
Compiler design
Compiler designCompiler design
Compiler design
sanchi29
 
Intro to Elixir talk
Intro to Elixir talkIntro to Elixir talk
Intro to Elixir talk
Carlos I. Peña
 
Welcome to the .Net
Welcome to the .NetWelcome to the .Net
Welcome to the .Net
Amr Shawky
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
Gwyneth Calica
 

Similar to Elixir紹介 (20)

20240412 QFM010 Elixir Reading List March 2024
20240412 QFM010 Elixir Reading List March 202420240412 QFM010 Elixir Reading List March 2024
20240412 QFM010 Elixir Reading List March 2024
 
Programing paradigm & implementation
Programing paradigm & implementationPrograming paradigm & implementation
Programing paradigm & implementation
 
Seeking Clojure
Seeking ClojureSeeking Clojure
Seeking Clojure
 
OOP Comparative Study
OOP Comparative StudyOOP Comparative Study
OOP Comparative Study
 
02 intro to programming in .net (part 2)
02   intro to programming in .net (part 2)02   intro to programming in .net (part 2)
02 intro to programming in .net (part 2)
 
Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processors
 
BUD17-104: Scripting Languages in IoT: Challenges and Approaches
BUD17-104: Scripting Languages in IoT: Challenges and ApproachesBUD17-104: Scripting Languages in IoT: Challenges and Approaches
BUD17-104: Scripting Languages in IoT: Challenges and Approaches
 
Technologies of today
Technologies of todayTechnologies of today
Technologies of today
 
Unit 1
Unit 1Unit 1
Unit 1
 
JAVA
JAVAJAVA
JAVA
 
ICT-DBA4 -05-0811-Apply-Object-Oriented-Programming-Language-Skills.doc
ICT-DBA4 -05-0811-Apply-Object-Oriented-Programming-Language-Skills.docICT-DBA4 -05-0811-Apply-Object-Oriented-Programming-Language-Skills.doc
ICT-DBA4 -05-0811-Apply-Object-Oriented-Programming-Language-Skills.doc
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
 
DEF CON 23 - Saif el-sherei and etienne stalmans - fuzzing
DEF CON 23 - Saif el-sherei and etienne stalmans - fuzzingDEF CON 23 - Saif el-sherei and etienne stalmans - fuzzing
DEF CON 23 - Saif el-sherei and etienne stalmans - fuzzing
 
Introduction To Computer Programming
Introduction To Computer ProgrammingIntroduction To Computer Programming
Introduction To Computer Programming
 
Compiler design
Compiler designCompiler design
Compiler design
 
Intro to Elixir talk
Intro to Elixir talkIntro to Elixir talk
Intro to Elixir talk
 
Welcome to the .Net
Welcome to the .NetWelcome to the .Net
Welcome to the .Net
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
 

More from Masato HORINOUCHI

Church Numerals
Church NumeralsChurch Numerals
Church Numerals
Masato HORINOUCHI
 
CPS & CTO
CPS & CTOCPS & CTO
FM synthesis
FM synthesisFM synthesis
FM synthesis
Masato HORINOUCHI
 
Scheme Interpreter in Ruby
Scheme Interpreter in RubyScheme Interpreter in Ruby
Scheme Interpreter in Ruby
Masato HORINOUCHI
 
Clock / Timer
Clock / TimerClock / Timer
Clock / Timer
Masato HORINOUCHI
 
Hash Tree
Hash TreeHash Tree

More from Masato HORINOUCHI (6)

Church Numerals
Church NumeralsChurch Numerals
Church Numerals
 
CPS & CTO
CPS & CTOCPS & CTO
CPS & CTO
 
FM synthesis
FM synthesisFM synthesis
FM synthesis
 
Scheme Interpreter in Ruby
Scheme Interpreter in RubyScheme Interpreter in Ruby
Scheme Interpreter in Ruby
 
Clock / Timer
Clock / TimerClock / Timer
Clock / Timer
 
Hash Tree
Hash TreeHash Tree
Hash Tree
 

Recently uploaded

20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
Pixlogix Infotech
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 

Recently uploaded (20)

20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 

Elixir紹介

  • 2. Elixirとは Elixir is a func-onal, meta-programming aware language built on top of the Erlang VM. It is a dynamic language that focuses on tooling to leverage Erlang's abili-es to build concurrent, distributed and fault-tolerant applica-ons with hot code upgrades.
  • 4. 特徴 • 近代的なシンタックス • 全てが式 • 強力なメタプログラミング機能 • 第一級オブジェクトとしてのドキュメント • Erlangランタイムとの相互運用
  • 5. Fibonacci (Ruby) class Fib def self.fib n case n when 0 then 0 when 1 then 1 else fib(n - 1) + fib(n - 2) end end end puts Fib.fib 10
  • 6. Fibonacci (Elixir) defmodule Fib do def fib(0), do: 1 def fib(1), do: 1 def fib(n), do: fib(n-1) + fib(n-2) end IO.puts Fib.fib 6
  • 7. Install • OS X (homebrew) • $ brew install erlang –devel • $ brew install elixir • Windows • なんか大変らしい • Ubuntu • PPA あるよ
  • 8. REPL $ iex iex> defmodule Hello do ...> def world do ...> IO.puts "Hello, world" ...> end ...> end iex> Hello.world Hello, world :ok iex>
  • 9. 無名関数 iex> f = fn(x) -> x * 2 end iex> f.(4) 8 iex> (fn(x) -> x * 3 end).(3) 9
  • 10. map reduce iex> Enum.map( ...> [1,2,3], ...> fn(x) -> x * 2 end) [2, 4, 6] iex> Enum.reduce( ...> [1,2,3], ...> fn(x, acc) -> x + acc end) 6
  • 11. キーワード引数と括弧の省略 iex> if true do ...> 1 ...> else ...> 2 ...> end 1 iex> if true, do: 1, else: 2 1 iex> if true, [do: 1, else: 2] 1 iex> if(true, [do: 1, else: 2]) 1
  • 12. Homoiconicity In a homoiconic language the primary representa3on of programs is also a data structure in a primi3ve type of the language itself. This makes metaprogramming easier than in a language without this property, since code can be treated as data: reflec3on in the language (examining the program's en33es at run3me) depends on a single, homogeneous structure, and it does not have to handle several different structures that would appear in a complex syntax. To put that another way, homoiconicity is where a program's source code is wriDen as a basic data structure that the programming language knows how to access.
  • 13. quote iex> length [1,2,3] 3 iex> quote do: length [1,2,3] {:length, [context: Elixir, import: Kernel], [[1, 2, 3]]} iex> 1 + 2 3 iex> quote do: 1 + 2 {:+, [context: Elixir, import: Kernel], [1, 2]}
  • 14. macro iex> defmodule MyUnless do ...> defmacro unless(clause, options) do ...> quote do: if !unquote(clause), ...> unquote(options) ...> end ...> end iex> require MyUnless nil Iex> MyUnless.unless true, do: 1, else: 2 2
  • 15. defmacro if defmacro if(condition, clauses) do do_clause = Keyword.get(clauses, :do, nil) else_clause = Keyword.get(clauses, :else, nil) quote do case unquote(condition) do _ in [false, nil] -> unquote(else_clause) _ -> unquote(do_clause) end end end