SlideShare a Scribd company logo
1 of 37
Download to read offline
lagénorhynque
(def fi e ag h e
:id @ age h e
: eadi g "/ a e ɛ̃/"
:a ia e [" "]
: a g age [C e Ha e E g i h f a ai ]
:i e e [ g a i g a g age- ea i g a a he a ic ]
:c i ["gi h b.c / age h e/d c . d e. ede a "
"gi h b.c / age h e/d c . d e.ca bi "]
:c ib e ["gi h b.c / a a -c ia /c e- i e- a"])
1.
2.
3.
/
( )
metaprogramming
R b 2
(
)
( )
( )
e c.
(
)
( )
( )
e c.
e ec i
me acla
em la e
mac
/
/
e c.
DSL ( )
e c.
d mai - eci c la g age
e c.
e c.
e g
Macro Club has t o rules, plus one
e ception. The rst rule of Macro Club
is Don t Write Macros. (...) The second
rule of Macro Club is Write Macros f
That s the Onl Wa to Encapsulate a
Pattern. (...) The e ception to the rule
is that ou can rite an macro that
makes life easier for our callers
hen compared ith an equi alent
function.
, Java
Class Method
he > c a G ee i g
...> i a e S i g a e;
...> G ee i g(S i g a e)
...> hi . a e = a e;
...>
...> S i g he ()
...> e "He , " + a e + "!";
...>
...> i a e S i g b ()
...> e "B , " + a e + " !";
...>
...>
c ea ed c a G ee i g
he > a g = e G ee i g(" ag h e")
g ==> G ee i g@377dca04
he > g.he ()
$3 ==> "He , ag h e!"
he > g.b ()
E :
b () ha i a e acce i G ee i g
g.b ()
^-------^
he > G ee i g.c a .ge Dec a edMe h d ()
$4 ==> Me h d[2] a a. a g.S i g G ee i g.he (), i a e a
a. a g.S i g G ee i g.b ()
he > a He = G ee i g.c a .ge Dec a edMe h d("he ")
He ==> a a. a g.S i g G ee i g.he ()
he > He .i e(g)
$6 ==> "He , ag h e!"
he > a B = G ee i g.c a .ge Dec a edMe h d("b
")
B ==> i a e a a. a g.S i g G ee i g.b ()
he > B .i e(g)
E ce i a a. a g.I ega Acce E ce i : c a REPL.$JShe
a Ref ec i . e I ega Acce E ce i (Ref ec i . a a
a Acce ib eOb ec .chec Acce (Acce ib eOb ec . a a:6
a Me h d.i e (Me h d. a a:556)
a (#10:1)
he > B . e Acce ib e( e)
he > B .i e(g)
$12 ==> "B , ag h e !"
(R b )
(P h )
e d
ge a
Ruby
method missing
i b( ai ):001:1* c a G ee i g
i b( ai ):002:2* def i i ia i e( a e)
i b( ai ):003:2* @ a e = a e
i b( ai ):004:1* e d
i b( ai ):005:2* def e h d_ i i g( , *a g )
i b( ai ):006:2* "# .ca i a i e , # @ a e !"
i b( ai ):007:1* e d
i b( ai ):008:1* e d
=> : e h d_ i i g
i b( ai ):009:0> g = G ee i g. e (" ag h e")
=> #<G ee i g:0 00007fcb472e0198 @ a e=" ag h e">
i b( ai ):010:0> g.he
=> "He , ag h e!"
i b( ai ):011:0> g.b
=> "B , ag h e!"
(P h )
__ge a __
open class Ruby
i b( ai ):001:1* c a S i g
i b( ai ):002:2* def he
i b( ai ):003:2* "He , # e f !"
i b( ai ):004:1* e d
i b( ai ):005:1* e d
=> :he
i b( ai ):006:0> " ag h e".he
=> "He , ag h e!"
Ruby
refinements
i b( ai ):001:1* d e G ee i g
i b( ai ):002:2* efi e S i g d
i b( ai ):003:3* def he
i b( ai ):004:3* "He , # e f !"
i b( ai ):005:2* e d
i b( ai ):006:1* e d
i b( ai ):007:0> e d
=> #< efi e e :S i g@G ee i g>
i b( ai ):008:1* d e M
i b( ai ):009:1* i g G ee i g
i b( ai ):010:2* c a << e f
i b( ai ):011:3* def f( a e)
i b( ai ):012:3* a e.he
i b( ai ):013:2* e d
i b( ai ):014:1* e d
i b( ai ):015:0> e d
=> :f
i b( ai ):016:0> M.f(" ag h e")
=> "He , ag h e!"
i b( ai ):017:0> " ag h e".he
T acebac ( ece ca a ):
4: f /U e / age h e/. be / e i /3.0.0/bi /i b
3: f /U e / age h e/. be / e i /3.0.0/bi /i b
2: f /U e / age h e/. be / e i /3.0.0/ ib/ b
1: f (i b):17:i `< ai >'
N Me h dE ( defi ed e h d `he ' f " ag h e":S i
e (Ja aSc i )
(Scala)
im lici cla
Ruby
i b( ai ):001:0> a e = " ag h e"
=> " ag h e"
i b( ai ):002:1* def a e.he
i b( ai ):003:1* "He , # e f !"
i b( ai ):004:1* e d
=> :he
i b( ai ):005:0> a e.he
=> "He , ag h e!"
i b( ai ):006:0> " ag h e".he
T acebac ( ece ca a ):
4: f /U e / age h e/. be / e i /3.0.0/bi /i b
3: f /U e / age h e/. be / e i /3.0.0/bi /i b
2: f /U e / age h e/. be / e i /3.0.0/ ib/ b
1: f (i b):6:i `< ai >'
N Me h dE ( defi ed e h d `he ' f " ag h e":S i
(P h )
(Ja aSc i )
(Cl j e)
Me h dT e
Clojure
e => (def ac e [ e & b d ]
`( he ( e )
@b d ))
#' e / e
e => ( e (= 1 2)
( i " e a "))
e a
i
e => ( e (= 1 1)
( i " e a "))
i
e => ( ac e a d-1
'( e (= 1 2)
( i " e a ")))
(c e.c e/ he (c e.c e/ (= 1 2)) ( i " e a
"))
Elixir
ie (1)> def d e M d
...(1)> def ac e ( e , d : b d ) d
...(1)> e d
...(1)> if ! e( e ) d
...(1)> e(b d )
...(1)> e d
...(1)> e d
...(1)> e d
...(1)> e d
: d e, M,
<<70, 79, 82, 49, 0, 0, 5, 120, 66, 69, 65, 77, 65, 116, 85, 56,
0, 0, 0, 17, 8, 69, 108, 105, 120, 105, 114, 46, 77, 8, 95, 95
102, 111, 95, 95, 10, 97, 116, 116, 114, ...>>, : e , 2
ie (2)> e i e M
M
ie (3)> M. e 1 == 2 d
...(3)> IO. " e a "
...(3)> e d
e a
:
ie (4)> M. e 1 == 1 d
...(4)> IO. " e a "
...(4)> e d
i
ie (5)> e d
...(5)> M. e 1 == 1 d
...(5)> IO. " e a "
...(5)> e d
...(5)> e d > Mac .e a d_ ce(__ENV__) >
...(5)> Mac . _ i g > IO.
if(!(1 == 1)) d
IO. (" e a ")
e d
:
R
J lia
Tem la e Ha kell
Scalame a
Mac P
H
S ee .j
Further Reading
DSL
R b 2
R b T
P h

More Related Content

What's hot

Mobile Number Portability - The Process Factory
Mobile Number Portability - The Process FactoryMobile Number Portability - The Process Factory
Mobile Number Portability - The Process FactoryBSP Media Group
 
سلسلة الليالى العشر فى الرياضيات للصف الثالث الابتدائى ترم اول
سلسلة الليالى العشر فى الرياضيات للصف الثالث الابتدائى ترم اولسلسلة الليالى العشر فى الرياضيات للصف الثالث الابتدائى ترم اول
سلسلة الليالى العشر فى الرياضيات للصف الثالث الابتدائى ترم اولأمنية وجدى
 
Actividadesfimdesemana 16e17 junho
Actividadesfimdesemana 16e17 junhoActividadesfimdesemana 16e17 junho
Actividadesfimdesemana 16e17 junhoFUNDAÇÃO EDP
 
(Manuel procedures programme_transversal_ar)
(Manuel procedures programme_transversal_ar)(Manuel procedures programme_transversal_ar)
(Manuel procedures programme_transversal_ar)Lamiss Violoniste
 
η νεκρανάσταση του πιο βρώμικου αντικομμουνισμού
η νεκρανάσταση του πιο βρώμικου αντικομμουνισμούη νεκρανάσταση του πιο βρώμικου αντικομμουνισμού
η νεκρανάσταση του πιο βρώμικου αντικομμουνισμούKostas Panagio
 
[Waterworks] City Presentation - Rosenheim(Germany)
[Waterworks] City Presentation - Rosenheim(Germany)[Waterworks] City Presentation - Rosenheim(Germany)
[Waterworks] City Presentation - Rosenheim(Germany)shrdcinfo
 
मदीना की फज़ीलत और उसकी ज़ियारत एंव निवास के आदाब
मदीना की फज़ीलत और उसकी ज़ियारत एंव निवास के आदाबमदीना की फज़ीलत और उसकी ज़ियारत एंव निवास के आदाब
मदीना की फज़ीलत और उसकी ज़ियारत एंव निवास के आदाबNisreen Ly
 
Porto de mos conferencias fora de portas
Porto de mos conferencias fora de portasPorto de mos conferencias fora de portas
Porto de mos conferencias fora de portasempreendedorismolike
 
Lesson 7 world_history_medieval_period_new_
Lesson 7 world_history_medieval_period_new_Lesson 7 world_history_medieval_period_new_
Lesson 7 world_history_medieval_period_new_Anna Romana
 
アラプリ新企画書
アラプリ新企画書アラプリ新企画書
アラプリ新企画書Arappli Taro
 
La santé du point de vue de l’individu de la mesure aux décisions collectives.
La santé du point de vue de l’individu   de la mesure aux décisions collectives.La santé du point de vue de l’individu   de la mesure aux décisions collectives.
La santé du point de vue de l’individu de la mesure aux décisions collectives.Réseau Pro Santé
 
How to make Halloween more accessible for kids with special needs macaroni kid
How to make Halloween more accessible for kids with special needs   macaroni kidHow to make Halloween more accessible for kids with special needs   macaroni kid
How to make Halloween more accessible for kids with special needs macaroni kidJoanna Lowy
 
Anadhikar-probesh-Robindranath_Thakur
Anadhikar-probesh-Robindranath_ThakurAnadhikar-probesh-Robindranath_Thakur
Anadhikar-probesh-Robindranath_Thakurbdkites
 
Preliminary results of EJC survey on training needs for data journalism
Preliminary results of EJC survey on training needs for data journalismPreliminary results of EJC survey on training needs for data journalism
Preliminary results of EJC survey on training needs for data journalismLiliana Bounegru
 

What's hot (20)

Mobile Number Portability - The Process Factory
Mobile Number Portability - The Process FactoryMobile Number Portability - The Process Factory
Mobile Number Portability - The Process Factory
 
سلسلة الليالى العشر فى الرياضيات للصف الثالث الابتدائى ترم اول
سلسلة الليالى العشر فى الرياضيات للصف الثالث الابتدائى ترم اولسلسلة الليالى العشر فى الرياضيات للصف الثالث الابتدائى ترم اول
سلسلة الليالى العشر فى الرياضيات للصف الثالث الابتدائى ترم اول
 
Actividadesfimdesemana 16e17 junho
Actividadesfimdesemana 16e17 junhoActividadesfimdesemana 16e17 junho
Actividadesfimdesemana 16e17 junho
 
alongamentos
alongamentosalongamentos
alongamentos
 
(Manuel procedures programme_transversal_ar)
(Manuel procedures programme_transversal_ar)(Manuel procedures programme_transversal_ar)
(Manuel procedures programme_transversal_ar)
 
η νεκρανάσταση του πιο βρώμικου αντικομμουνισμού
η νεκρανάσταση του πιο βρώμικου αντικομμουνισμούη νεκρανάσταση του πιο βρώμικου αντικομμουνισμού
η νεκρανάσταση του πιο βρώμικου αντικομμουνισμού
 
Good Photo Composition
Good Photo CompositionGood Photo Composition
Good Photo Composition
 
Pruebas de hipotesis
Pruebas de hipotesisPruebas de hipotesis
Pruebas de hipotesis
 
[Waterworks] City Presentation - Rosenheim(Germany)
[Waterworks] City Presentation - Rosenheim(Germany)[Waterworks] City Presentation - Rosenheim(Germany)
[Waterworks] City Presentation - Rosenheim(Germany)
 
मदीना की फज़ीलत और उसकी ज़ियारत एंव निवास के आदाब
मदीना की फज़ीलत और उसकी ज़ियारत एंव निवास के आदाबमदीना की फज़ीलत और उसकी ज़ियारत एंव निवास के आदाब
मदीना की फज़ीलत और उसकी ज़ियारत एंव निवास के आदाब
 
Porto de mos conferencias fora de portas
Porto de mos conferencias fora de portasPorto de mos conferencias fora de portas
Porto de mos conferencias fora de portas
 
Lesson 7 world_history_medieval_period_new_
Lesson 7 world_history_medieval_period_new_Lesson 7 world_history_medieval_period_new_
Lesson 7 world_history_medieval_period_new_
 
Body odor & sweat concern in vietnam
Body odor & sweat concern in vietnamBody odor & sweat concern in vietnam
Body odor & sweat concern in vietnam
 
アラプリ新企画書
アラプリ新企画書アラプリ新企画書
アラプリ新企画書
 
La santé du point de vue de l’individu de la mesure aux décisions collectives.
La santé du point de vue de l’individu   de la mesure aux décisions collectives.La santé du point de vue de l’individu   de la mesure aux décisions collectives.
La santé du point de vue de l’individu de la mesure aux décisions collectives.
 
How to make Halloween more accessible for kids with special needs macaroni kid
How to make Halloween more accessible for kids with special needs   macaroni kidHow to make Halloween more accessible for kids with special needs   macaroni kid
How to make Halloween more accessible for kids with special needs macaroni kid
 
Anadhikar-probesh-Robindranath_Thakur
Anadhikar-probesh-Robindranath_ThakurAnadhikar-probesh-Robindranath_Thakur
Anadhikar-probesh-Robindranath_Thakur
 
Preliminary results of EJC survey on training needs for data journalism
Preliminary results of EJC survey on training needs for data journalismPreliminary results of EJC survey on training needs for data journalism
Preliminary results of EJC survey on training needs for data journalism
 
الإستاتيكا
الإستاتيكاالإستاتيكا
الإستاتيكا
 
Regulation of Chinese Wine Imports 2011
Regulation of Chinese Wine Imports 2011Regulation of Chinese Wine Imports 2011
Regulation of Chinese Wine Imports 2011
 

Similar to メタプログラミング入門

Functional Gradient Boosting based on Residual Network Perception
Functional Gradient Boosting based on Residual Network PerceptionFunctional Gradient Boosting based on Residual Network Perception
Functional Gradient Boosting based on Residual Network PerceptionAtsushi Nitanda
 
Mario chaves
Mario chavesMario chaves
Mario chavesAvantica
 
التفاضل و التكامل
التفاضل و التكاملالتفاضل و التكامل
التفاضل و التكاملمحمد الجمل
 
Despacho conjunto nº300 97 de 09 setembro
Despacho conjunto nº300 97 de 09 setembroDespacho conjunto nº300 97 de 09 setembro
Despacho conjunto nº300 97 de 09 setembropatronatobonanca
 
Toan pt.de075.2012
Toan pt.de075.2012Toan pt.de075.2012
Toan pt.de075.2012BẢO Hí
 
Working in the UnOffice: A Guide to Coworking for Indie Workers, Small Busine...
Working in the UnOffice: A Guide to Coworking for Indie Workers, Small Busine...Working in the UnOffice: A Guide to Coworking for Indie Workers, Small Busine...
Working in the UnOffice: A Guide to Coworking for Indie Workers, Small Busine...Night Owls Press
 
เฉลยข้อสอบเมทริกซ์ ตอนที่ 1
เฉลยข้อสอบเมทริกซ์  ตอนที่ 1เฉลยข้อสอบเมทริกซ์  ตอนที่ 1
เฉลยข้อสอบเมทริกซ์ ตอนที่ 1K'Keng Hale's
 
ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 4 - ΤΕΛΕΣΤΕΣ και η ΔΟΜΗ ΕΛΕΓΧΟΥ (ΕΚΤΥΠΩΣΗ)
ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 4 - ΤΕΛΕΣΤΕΣ και η ΔΟΜΗ ΕΛΕΓΧΟΥ (ΕΚΤΥΠΩΣΗ)ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 4 - ΤΕΛΕΣΤΕΣ και η ΔΟΜΗ ΕΛΕΓΧΟΥ (ΕΚΤΥΠΩΣΗ)
ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 4 - ΤΕΛΕΣΤΕΣ και η ΔΟΜΗ ΕΛΕΓΧΟΥ (ΕΚΤΥΠΩΣΗ)Dimitris Psounis
 
Lois de kirchhoff, dipôles électrocinétiques
Lois de kirchhoff, dipôles électrocinétiquesLois de kirchhoff, dipôles électrocinétiques
Lois de kirchhoff, dipôles électrocinétiquesAchraf Ourti
 
ΠΛΗ31 ΜΑΘΗΜΑ 1.3 (ΕΚΤΥΠΩΣΗ)
ΠΛΗ31 ΜΑΘΗΜΑ 1.3 (ΕΚΤΥΠΩΣΗ)ΠΛΗ31 ΜΑΘΗΜΑ 1.3 (ΕΚΤΥΠΩΣΗ)
ΠΛΗ31 ΜΑΘΗΜΑ 1.3 (ΕΚΤΥΠΩΣΗ)Dimitris Psounis
 
Наибольшая общая мера: 2500 лет
Наибольшая общая мера: 2500 летНаибольшая общая мера: 2500 лет
Наибольшая общая мера: 2500 летsixtyone
 
Strain Letter for Kyle
Strain Letter for KyleStrain Letter for Kyle
Strain Letter for KyleKyle Erwin
 
-scientific proof in al-quran
-scientific proof in al-quran-scientific proof in al-quran
-scientific proof in al-quranR&R Darulkautsar
 
C Baan BSc thesis presentation
C Baan BSc thesis presentationC Baan BSc thesis presentation
C Baan BSc thesis presentationChristopher Baan
 
ΠΛΗ31 ΜΑΘΗΜΑ 2.2 (ΕΚΤΥΠΩΣΗ)
ΠΛΗ31 ΜΑΘΗΜΑ 2.2 (ΕΚΤΥΠΩΣΗ)ΠΛΗ31 ΜΑΘΗΜΑ 2.2 (ΕΚΤΥΠΩΣΗ)
ΠΛΗ31 ΜΑΘΗΜΑ 2.2 (ΕΚΤΥΠΩΣΗ)Dimitris Psounis
 
Convocazione consiglio comunale
Convocazione consiglio comunaleConvocazione consiglio comunale
Convocazione consiglio comunaleredazione gioianet
 

Similar to メタプログラミング入門 (20)

Functional Gradient Boosting based on Residual Network Perception
Functional Gradient Boosting based on Residual Network PerceptionFunctional Gradient Boosting based on Residual Network Perception
Functional Gradient Boosting based on Residual Network Perception
 
Mario chaves
Mario chavesMario chaves
Mario chaves
 
التفاضل و التكامل
التفاضل و التكاملالتفاضل و التكامل
التفاضل و التكامل
 
Despacho conjunto nº300 97 de 09 setembro
Despacho conjunto nº300 97 de 09 setembroDespacho conjunto nº300 97 de 09 setembro
Despacho conjunto nº300 97 de 09 setembro
 
Toan pt.de075.2012
Toan pt.de075.2012Toan pt.de075.2012
Toan pt.de075.2012
 
Working in the UnOffice: A Guide to Coworking for Indie Workers, Small Busine...
Working in the UnOffice: A Guide to Coworking for Indie Workers, Small Busine...Working in the UnOffice: A Guide to Coworking for Indie Workers, Small Busine...
Working in the UnOffice: A Guide to Coworking for Indie Workers, Small Busine...
 
เฉลยข้อสอบเมทริกซ์ ตอนที่ 1
เฉลยข้อสอบเมทริกซ์  ตอนที่ 1เฉลยข้อสอบเมทริกซ์  ตอนที่ 1
เฉลยข้อสอบเมทริกซ์ ตอนที่ 1
 
ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 4 - ΤΕΛΕΣΤΕΣ και η ΔΟΜΗ ΕΛΕΓΧΟΥ (ΕΚΤΥΠΩΣΗ)
ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 4 - ΤΕΛΕΣΤΕΣ και η ΔΟΜΗ ΕΛΕΓΧΟΥ (ΕΚΤΥΠΩΣΗ)ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 4 - ΤΕΛΕΣΤΕΣ και η ΔΟΜΗ ΕΛΕΓΧΟΥ (ΕΚΤΥΠΩΣΗ)
ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 4 - ΤΕΛΕΣΤΕΣ και η ΔΟΜΗ ΕΛΕΓΧΟΥ (ΕΚΤΥΠΩΣΗ)
 
Lois de kirchhoff, dipôles électrocinétiques
Lois de kirchhoff, dipôles électrocinétiquesLois de kirchhoff, dipôles électrocinétiques
Lois de kirchhoff, dipôles électrocinétiques
 
Groupes
GroupesGroupes
Groupes
 
ΠΛΗ31 ΜΑΘΗΜΑ 1.3 (ΕΚΤΥΠΩΣΗ)
ΠΛΗ31 ΜΑΘΗΜΑ 1.3 (ΕΚΤΥΠΩΣΗ)ΠΛΗ31 ΜΑΘΗΜΑ 1.3 (ΕΚΤΥΠΩΣΗ)
ΠΛΗ31 ΜΑΘΗΜΑ 1.3 (ΕΚΤΥΠΩΣΗ)
 
Prelude to halide_public
Prelude to halide_publicPrelude to halide_public
Prelude to halide_public
 
Наибольшая общая мера: 2500 лет
Наибольшая общая мера: 2500 летНаибольшая общая мера: 2500 лет
Наибольшая общая мера: 2500 лет
 
Ppt wkc 18 novembre
Ppt wkc 18 novembrePpt wkc 18 novembre
Ppt wkc 18 novembre
 
Strain Letter for Kyle
Strain Letter for KyleStrain Letter for Kyle
Strain Letter for Kyle
 
-scientific proof in al-quran
-scientific proof in al-quran-scientific proof in al-quran
-scientific proof in al-quran
 
Ecuacionesfuncionales2 1
Ecuacionesfuncionales2 1Ecuacionesfuncionales2 1
Ecuacionesfuncionales2 1
 
C Baan BSc thesis presentation
C Baan BSc thesis presentationC Baan BSc thesis presentation
C Baan BSc thesis presentation
 
ΠΛΗ31 ΜΑΘΗΜΑ 2.2 (ΕΚΤΥΠΩΣΗ)
ΠΛΗ31 ΜΑΘΗΜΑ 2.2 (ΕΚΤΥΠΩΣΗ)ΠΛΗ31 ΜΑΘΗΜΑ 2.2 (ΕΚΤΥΠΩΣΗ)
ΠΛΗ31 ΜΑΘΗΜΑ 2.2 (ΕΚΤΥΠΩΣΗ)
 
Convocazione consiglio comunale
Convocazione consiglio comunaleConvocazione consiglio comunale
Convocazione consiglio comunale
 

More from Kent Ohashi

インターフェース定義言語から学ぶモダンなWeb API方式: REST, GraphQL, gRPC
インターフェース定義言語から学ぶモダンなWeb API方式: REST, GraphQL, gRPCインターフェース定義言語から学ぶモダンなWeb API方式: REST, GraphQL, gRPC
インターフェース定義言語から学ぶモダンなWeb API方式: REST, GraphQL, gRPCKent Ohashi
 
Team Geek Revisited
Team Geek RevisitedTeam Geek Revisited
Team Geek RevisitedKent Ohashi
 
Scala vs Clojure?: The Rise and Fall of Functional Languages in Opt Technologies
Scala vs Clojure?: The Rise and Fall of Functional Languages in Opt TechnologiesScala vs Clojure?: The Rise and Fall of Functional Languages in Opt Technologies
Scala vs Clojure?: The Rise and Fall of Functional Languages in Opt TechnologiesKent Ohashi
 
Clojureコレクションで探るimmutableでpersistentな世界
Clojureコレクションで探るimmutableでpersistentな世界Clojureコレクションで探るimmutableでpersistentな世界
Clojureコレクションで探るimmutableでpersistentな世界Kent Ohashi
 
英語学習者のためのフランス語文法入門: フランス語完全理解(?)
英語学習者のためのフランス語文法入門: フランス語完全理解(?)英語学習者のためのフランス語文法入門: フランス語完全理解(?)
英語学習者のためのフランス語文法入門: フランス語完全理解(?)Kent Ohashi
 
JavaからScala、そしてClojureへ: 実務で活きる関数型プログラミング
JavaからScala、そしてClojureへ: 実務で活きる関数型プログラミングJavaからScala、そしてClojureへ: 実務で活きる関数型プログラミング
JavaからScala、そしてClojureへ: 実務で活きる関数型プログラミングKent Ohashi
 
実用のための語源学入門
実用のための語源学入門実用のための語源学入門
実用のための語源学入門Kent Ohashi
 
労働法の世界
労働法の世界労働法の世界
労働法の世界Kent Ohashi
 
Clojureで作る"simple"なDSL
Clojureで作る"simple"なDSLClojureで作る"simple"なDSL
Clojureで作る"simple"なDSLKent Ohashi
 
RDBでのツリー表現入門
RDBでのツリー表現入門RDBでのツリー表現入門
RDBでのツリー表現入門Kent Ohashi
 
Everyday Life with clojure.spec
Everyday Life with clojure.specEveryday Life with clojure.spec
Everyday Life with clojure.specKent Ohashi
 
たのしい多言語学習
たのしい多言語学習たのしい多言語学習
たのしい多言語学習Kent Ohashi
 
Ductモジュール入門
Ductモジュール入門Ductモジュール入門
Ductモジュール入門Kent Ohashi
 
Clojure REPL: The Good Parts
Clojure REPL: The Good PartsClojure REPL: The Good Parts
Clojure REPL: The Good PartsKent Ohashi
 
"Simple Made Easy" Made Easy
"Simple Made Easy" Made Easy"Simple Made Easy" Made Easy
"Simple Made Easy" Made EasyKent Ohashi
 
Clojurian Conquest
Clojurian ConquestClojurian Conquest
Clojurian ConquestKent Ohashi
 
ClojurianからみたElixir
ClojurianからみたElixirClojurianからみたElixir
ClojurianからみたElixirKent Ohashi
 
GraphQL API in Clojure
GraphQL API in ClojureGraphQL API in Clojure
GraphQL API in ClojureKent Ohashi
 

More from Kent Ohashi (20)

インターフェース定義言語から学ぶモダンなWeb API方式: REST, GraphQL, gRPC
インターフェース定義言語から学ぶモダンなWeb API方式: REST, GraphQL, gRPCインターフェース定義言語から学ぶモダンなWeb API方式: REST, GraphQL, gRPC
インターフェース定義言語から学ぶモダンなWeb API方式: REST, GraphQL, gRPC
 
Team Geek Revisited
Team Geek RevisitedTeam Geek Revisited
Team Geek Revisited
 
Scala vs Clojure?: The Rise and Fall of Functional Languages in Opt Technologies
Scala vs Clojure?: The Rise and Fall of Functional Languages in Opt TechnologiesScala vs Clojure?: The Rise and Fall of Functional Languages in Opt Technologies
Scala vs Clojure?: The Rise and Fall of Functional Languages in Opt Technologies
 
Clojureコレクションで探るimmutableでpersistentな世界
Clojureコレクションで探るimmutableでpersistentな世界Clojureコレクションで探るimmutableでpersistentな世界
Clojureコレクションで探るimmutableでpersistentな世界
 
英語学習者のためのフランス語文法入門: フランス語完全理解(?)
英語学習者のためのフランス語文法入門: フランス語完全理解(?)英語学習者のためのフランス語文法入門: フランス語完全理解(?)
英語学習者のためのフランス語文法入門: フランス語完全理解(?)
 
JavaからScala、そしてClojureへ: 実務で活きる関数型プログラミング
JavaからScala、そしてClojureへ: 実務で活きる関数型プログラミングJavaからScala、そしてClojureへ: 実務で活きる関数型プログラミング
JavaからScala、そしてClojureへ: 実務で活きる関数型プログラミング
 
実用のための語源学入門
実用のための語源学入門実用のための語源学入門
実用のための語源学入門
 
労働法の世界
労働法の世界労働法の世界
労働法の世界
 
Clojureで作る"simple"なDSL
Clojureで作る"simple"なDSLClojureで作る"simple"なDSL
Clojureで作る"simple"なDSL
 
RDBでのツリー表現入門
RDBでのツリー表現入門RDBでのツリー表現入門
RDBでのツリー表現入門
 
GraphQL入門
GraphQL入門GraphQL入門
GraphQL入門
 
Everyday Life with clojure.spec
Everyday Life with clojure.specEveryday Life with clojure.spec
Everyday Life with clojure.spec
 
たのしい多言語学習
たのしい多言語学習たのしい多言語学習
たのしい多言語学習
 
Ductモジュール入門
Ductモジュール入門Ductモジュール入門
Ductモジュール入門
 
Clojure REPL: The Good Parts
Clojure REPL: The Good PartsClojure REPL: The Good Parts
Clojure REPL: The Good Parts
 
"Simple Made Easy" Made Easy
"Simple Made Easy" Made Easy"Simple Made Easy" Made Easy
"Simple Made Easy" Made Easy
 
Clojurian Conquest
Clojurian ConquestClojurian Conquest
Clojurian Conquest
 
ClojurianからみたElixir
ClojurianからみたElixirClojurianからみたElixir
ClojurianからみたElixir
 
GraphQL API in Clojure
GraphQL API in ClojureGraphQL API in Clojure
GraphQL API in Clojure
 
法学入門
法学入門法学入門
法学入門
 

Recently uploaded

Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?Watsoo Telematics
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 

Recently uploaded (20)

Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 

メタプログラミング入門

  • 1.
  • 2. lagénorhynque (def fi e ag h e :id @ age h e : eadi g "/ a e ɛ̃/" :a ia e [" "] : a g age [C e Ha e E g i h f a ai ] :i e e [ g a i g a g age- ea i g a a he a ic ] :c i ["gi h b.c / age h e/d c . d e. ede a " "gi h b.c / age h e/d c . d e.ca bi "] :c ib e ["gi h b.c / a a -c ia /c e- i e- a"])
  • 4.
  • 6. ( ) ( ) ( ) e c. ( ) ( ) ( ) e c. e ec i me acla em la e mac
  • 7.
  • 8. / / e c. DSL ( ) e c. d mai - eci c la g age
  • 10. e g Macro Club has t o rules, plus one e ception. The rst rule of Macro Club is Don t Write Macros. (...) The second rule of Macro Club is Write Macros f That s the Onl Wa to Encapsulate a Pattern. (...) The e ception to the rule is that ou can rite an macro that makes life easier for our callers hen compared ith an equi alent function.
  • 11.
  • 12.
  • 13. , Java Class Method he > c a G ee i g ...> i a e S i g a e; ...> G ee i g(S i g a e) ...> hi . a e = a e; ...> ...> S i g he () ...> e "He , " + a e + "!"; ...> ...> i a e S i g b () ...> e "B , " + a e + " !"; ...> ...> c ea ed c a G ee i g
  • 14. he > a g = e G ee i g(" ag h e") g ==> G ee i g@377dca04 he > g.he () $3 ==> "He , ag h e!" he > g.b () E : b () ha i a e acce i G ee i g g.b () ^-------^
  • 15. he > G ee i g.c a .ge Dec a edMe h d () $4 ==> Me h d[2] a a. a g.S i g G ee i g.he (), i a e a a. a g.S i g G ee i g.b () he > a He = G ee i g.c a .ge Dec a edMe h d("he ") He ==> a a. a g.S i g G ee i g.he () he > He .i e(g) $6 ==> "He , ag h e!"
  • 16. he > a B = G ee i g.c a .ge Dec a edMe h d("b ") B ==> i a e a a. a g.S i g G ee i g.b () he > B .i e(g) E ce i a a. a g.I ega Acce E ce i : c a REPL.$JShe a Ref ec i . e I ega Acce E ce i (Ref ec i . a a a Acce ib eOb ec .chec Acce (Acce ib eOb ec . a a:6 a Me h d.i e (Me h d. a a:556) a (#10:1) he > B . e Acce ib e( e) he > B .i e(g) $12 ==> "B , ag h e !"
  • 17. (R b ) (P h ) e d ge a
  • 18. Ruby method missing i b( ai ):001:1* c a G ee i g i b( ai ):002:2* def i i ia i e( a e) i b( ai ):003:2* @ a e = a e i b( ai ):004:1* e d i b( ai ):005:2* def e h d_ i i g( , *a g ) i b( ai ):006:2* "# .ca i a i e , # @ a e !" i b( ai ):007:1* e d i b( ai ):008:1* e d => : e h d_ i i g i b( ai ):009:0> g = G ee i g. e (" ag h e") => #<G ee i g:0 00007fcb472e0198 @ a e=" ag h e"> i b( ai ):010:0> g.he => "He , ag h e!" i b( ai ):011:0> g.b => "B , ag h e!"
  • 19. (P h ) __ge a __
  • 20.
  • 21. open class Ruby i b( ai ):001:1* c a S i g i b( ai ):002:2* def he i b( ai ):003:2* "He , # e f !" i b( ai ):004:1* e d i b( ai ):005:1* e d => :he i b( ai ):006:0> " ag h e".he => "He , ag h e!"
  • 22. Ruby refinements i b( ai ):001:1* d e G ee i g i b( ai ):002:2* efi e S i g d i b( ai ):003:3* def he i b( ai ):004:3* "He , # e f !" i b( ai ):005:2* e d i b( ai ):006:1* e d i b( ai ):007:0> e d => #< efi e e :S i g@G ee i g>
  • 23. i b( ai ):008:1* d e M i b( ai ):009:1* i g G ee i g i b( ai ):010:2* c a << e f i b( ai ):011:3* def f( a e) i b( ai ):012:3* a e.he i b( ai ):013:2* e d i b( ai ):014:1* e d i b( ai ):015:0> e d => :f
  • 24. i b( ai ):016:0> M.f(" ag h e") => "He , ag h e!" i b( ai ):017:0> " ag h e".he T acebac ( ece ca a ): 4: f /U e / age h e/. be / e i /3.0.0/bi /i b 3: f /U e / age h e/. be / e i /3.0.0/bi /i b 2: f /U e / age h e/. be / e i /3.0.0/ ib/ b 1: f (i b):17:i `< ai >' N Me h dE ( defi ed e h d `he ' f " ag h e":S i
  • 25. e (Ja aSc i ) (Scala) im lici cla
  • 26. Ruby i b( ai ):001:0> a e = " ag h e" => " ag h e" i b( ai ):002:1* def a e.he i b( ai ):003:1* "He , # e f !" i b( ai ):004:1* e d => :he i b( ai ):005:0> a e.he => "He , ag h e!" i b( ai ):006:0> " ag h e".he T acebac ( ece ca a ): 4: f /U e / age h e/. be / e i /3.0.0/bi /i b 3: f /U e / age h e/. be / e i /3.0.0/bi /i b 2: f /U e / age h e/. be / e i /3.0.0/ ib/ b 1: f (i b):6:i `< ai >' N Me h dE ( defi ed e h d `he ' f " ag h e":S i
  • 27. (P h ) (Ja aSc i ) (Cl j e) Me h dT e
  • 28.
  • 29. Clojure e => (def ac e [ e & b d ] `( he ( e ) @b d )) #' e / e
  • 30. e => ( e (= 1 2) ( i " e a ")) e a i e => ( e (= 1 1) ( i " e a ")) i
  • 31. e => ( ac e a d-1 '( e (= 1 2) ( i " e a "))) (c e.c e/ he (c e.c e/ (= 1 2)) ( i " e a "))
  • 32. Elixir ie (1)> def d e M d ...(1)> def ac e ( e , d : b d ) d ...(1)> e d ...(1)> if ! e( e ) d ...(1)> e(b d ) ...(1)> e d ...(1)> e d ...(1)> e d ...(1)> e d : d e, M, <<70, 79, 82, 49, 0, 0, 5, 120, 66, 69, 65, 77, 65, 116, 85, 56, 0, 0, 0, 17, 8, 69, 108, 105, 120, 105, 114, 46, 77, 8, 95, 95 102, 111, 95, 95, 10, 97, 116, 116, 114, ...>>, : e , 2
  • 33. ie (2)> e i e M M ie (3)> M. e 1 == 2 d ...(3)> IO. " e a " ...(3)> e d e a : ie (4)> M. e 1 == 1 d ...(4)> IO. " e a " ...(4)> e d i
  • 34. ie (5)> e d ...(5)> M. e 1 == 1 d ...(5)> IO. " e a " ...(5)> e d ...(5)> e d > Mac .e a d_ ce(__ENV__) > ...(5)> Mac . _ i g > IO. if(!(1 == 1)) d IO. (" e a ") e d :
  • 35. R J lia Tem la e Ha kell Scalame a Mac P H S ee .j
  • 36.
  • 37. Further Reading DSL R b 2 R b T P h