SlideShare une entreprise Scribd logo
1  sur  16
Télécharger pour lire hors ligne
MONAD ON GROOVY
      ==
 MANADOLOGIE
   masaki@metabolics.co.jp
         2011.06.17


                             1
monad?


                           Haskell

         monoid

continuation

......


                                     2
monad!

          (                          )



Haskell




              Maybe Monad   Groovy       (2009/8/30, Gr   )


                                                              3
example 1
                         2
    S = {2x|x ∈ N, x > 3}


            (comprehension)

x      3                      ,2 *x




                                      4
groovy way

def s(n) {
     ((0..n)
        .findAll { it**2 > 3 })
        .collect { it*2 }
}


    Groovy                  ,


                                 5
example 2
import static hr.helix.monadologie.MonadComprehension.foreach
def s(n) {
   foreach {
       x = takeFrom { 0..n }
       guard { x**2 > 3 }
       yield { 2*x }
   }
}



                                                                6
example 3
def pythags(n) {
   foreach {
       z = takeFrom { 1..n }
       x = takeFrom { 1..z }
       y = takeFrom { x..z }
       guard { x**2 + y**2 == z**2 }
       yield { [x, y, z] }
   }
}
assert pythags(12) == [[3, 4, 5], [6, 8, 10]]




                                                7
monadologie

 https://github.com/dsrkoc/monadologie

 by Dinko Srkoc




                                         8
what’s the point


monadologie            ?

=>        Collection       ,




                               9
interface Monad<M> {

    M unit(Object a)

    M bind(Closure f)

}




                        10
List                                (!)

  (List<X>          X                        )

List<X>          (X a) = { [a] } //

List<Y>          (List<X> m, f) =
  { m.inject([]) { r, e -> r + f(e) } } //

  // where f s.t. List<Y> f(X x)

  // f   apply                          []


                                                   11
unit, bind

bind(m, unit) == m

bind(unit(m), f) == f(m) //

bind(bind(m, f), g) ==
  bind(m, { bind(f(it), g) }) //




                                   12
Groovy                         ?

=> List (Collection)



             ,
                       (   )

       ...



                                   13
Option -       (e.g. null)

           Maybe Groovy safe reference “?.”

Either -

Reader -                 Closure

Writer -

State -

STM -

memoize,   ,

AST




                                              14
,   ?




                 (   )




        ...:-)



                         15
LT




     16

Contenu connexe

Tendances

プログラミングHaskell 13章 問題7
プログラミングHaskell 13章 問題7プログラミングHaskell 13章 問題7
プログラミングHaskell 13章 問題7Kiwamu Okabe
 
MessagePack - An efficient binary serialization format
MessagePack - An efficient binary serialization formatMessagePack - An efficient binary serialization format
MessagePack - An efficient binary serialization formatLarry Nung
 
「Frama-Cによるソースコード検証」 (mzp)
「Frama-Cによるソースコード検証」 (mzp)「Frama-Cによるソースコード検証」 (mzp)
「Frama-Cによるソースコード検証」 (mzp)Hiroki Mizuno
 
ARM 7 LPC 2148 lecture
ARM 7 LPC 2148 lectureARM 7 LPC 2148 lecture
ARM 7 LPC 2148 lectureanishgoel
 
LLVM Workshop Osaka Umeda, Japan
LLVM Workshop Osaka Umeda, JapanLLVM Workshop Osaka Umeda, Japan
LLVM Workshop Osaka Umeda, Japanujihisa
 
Presentation about arrays
Presentation about arraysPresentation about arrays
Presentation about arraysslave of Allah
 
Pratikum 2 urai wira s
Pratikum 2 urai wira sPratikum 2 urai wira s
Pratikum 2 urai wira sWirha Sykerz
 
Pratikum 1 hardiansyah
Pratikum 1 hardiansyahPratikum 1 hardiansyah
Pratikum 1 hardiansyahWirha Sykerz
 
FOSS4G Europe 2015: OL3-Cesium (3D for OpenLayers)
FOSS4G Europe 2015: OL3-Cesium (3D for OpenLayers)FOSS4G Europe 2015: OL3-Cesium (3D for OpenLayers)
FOSS4G Europe 2015: OL3-Cesium (3D for OpenLayers)Camptocamp
 
Introduction to rust
Introduction to rustIntroduction to rust
Introduction to rustmysangle
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2goMoriyoshi Koizumi
 
Bab 2
Bab 2Bab 2
Bab 2Zinoa
 
Python opcodes
Python opcodesPython opcodes
Python opcodesalexgolec
 

Tendances (20)

Img082
Img082Img082
Img082
 
プログラミングHaskell 13章 問題7
プログラミングHaskell 13章 問題7プログラミングHaskell 13章 問題7
プログラミングHaskell 13章 問題7
 
MessagePack - An efficient binary serialization format
MessagePack - An efficient binary serialization formatMessagePack - An efficient binary serialization format
MessagePack - An efficient binary serialization format
 
Mathcad - modified secant method 2
Mathcad - modified secant method 2Mathcad - modified secant method 2
Mathcad - modified secant method 2
 
「Frama-Cによるソースコード検証」 (mzp)
「Frama-Cによるソースコード検証」 (mzp)「Frama-Cによるソースコード検証」 (mzp)
「Frama-Cによるソースコード検証」 (mzp)
 
ARM 7 LPC 2148 lecture
ARM 7 LPC 2148 lectureARM 7 LPC 2148 lecture
ARM 7 LPC 2148 lecture
 
2008 june 10
2008 june 102008 june 10
2008 june 10
 
LLVM Workshop Osaka Umeda, Japan
LLVM Workshop Osaka Umeda, JapanLLVM Workshop Osaka Umeda, Japan
LLVM Workshop Osaka Umeda, Japan
 
Presentation about arrays
Presentation about arraysPresentation about arrays
Presentation about arrays
 
QB_DCE_Anuj part 2
QB_DCE_Anuj part 2QB_DCE_Anuj part 2
QB_DCE_Anuj part 2
 
OOP in Rust
OOP in RustOOP in Rust
OOP in Rust
 
Pratikum 2 urai wira s
Pratikum 2 urai wira sPratikum 2 urai wira s
Pratikum 2 urai wira s
 
Pratikum 1 hardiansyah
Pratikum 1 hardiansyahPratikum 1 hardiansyah
Pratikum 1 hardiansyah
 
FOSS4G Europe 2015: OL3-Cesium (3D for OpenLayers)
FOSS4G Europe 2015: OL3-Cesium (3D for OpenLayers)FOSS4G Europe 2015: OL3-Cesium (3D for OpenLayers)
FOSS4G Europe 2015: OL3-Cesium (3D for OpenLayers)
 
Introduction to rust
Introduction to rustIntroduction to rust
Introduction to rust
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2go
 
Exercise #22
Exercise #22Exercise #22
Exercise #22
 
Bab 2
Bab 2Bab 2
Bab 2
 
Exercise #8 notes
Exercise #8 notesExercise #8 notes
Exercise #8 notes
 
Python opcodes
Python opcodesPython opcodes
Python opcodes
 

En vedette

Brighton Hospital Presentation
Brighton Hospital PresentationBrighton Hospital Presentation
Brighton Hospital PresentationKnoll Larkin
 
2016 1003 GIGAPP Accion de innovacion HackINTEF
2016 1003 GIGAPP Accion de innovacion HackINTEF2016 1003 GIGAPP Accion de innovacion HackINTEF
2016 1003 GIGAPP Accion de innovacion HackINTEFFelix Serrano Delgado
 
Social Studies Review Final Benchmark Td
Social Studies Review Final Benchmark TdSocial Studies Review Final Benchmark Td
Social Studies Review Final Benchmark TdBrice Cave
 
WSU Pharm 2008 Presentation
WSU Pharm 2008 PresentationWSU Pharm 2008 Presentation
WSU Pharm 2008 PresentationKnoll Larkin
 
Turning Point Presentation 5.18.07
Turning Point Presentation 5.18.07Turning Point Presentation 5.18.07
Turning Point Presentation 5.18.07Knoll Larkin
 
Teknopreneurship program
Teknopreneurship programTeknopreneurship program
Teknopreneurship programpatuari
 
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your BusinessBarry Feldman
 

En vedette (8)

Brighton Hospital Presentation
Brighton Hospital PresentationBrighton Hospital Presentation
Brighton Hospital Presentation
 
No uml
No umlNo uml
No uml
 
2016 1003 GIGAPP Accion de innovacion HackINTEF
2016 1003 GIGAPP Accion de innovacion HackINTEF2016 1003 GIGAPP Accion de innovacion HackINTEF
2016 1003 GIGAPP Accion de innovacion HackINTEF
 
Social Studies Review Final Benchmark Td
Social Studies Review Final Benchmark TdSocial Studies Review Final Benchmark Td
Social Studies Review Final Benchmark Td
 
WSU Pharm 2008 Presentation
WSU Pharm 2008 PresentationWSU Pharm 2008 Presentation
WSU Pharm 2008 Presentation
 
Turning Point Presentation 5.18.07
Turning Point Presentation 5.18.07Turning Point Presentation 5.18.07
Turning Point Presentation 5.18.07
 
Teknopreneurship program
Teknopreneurship programTeknopreneurship program
Teknopreneurship program
 
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
 

Similaire à 110617 lt

Tugasmatematikakelompok 150715235527-lva1-app6892
Tugasmatematikakelompok 150715235527-lva1-app6892Tugasmatematikakelompok 150715235527-lva1-app6892
Tugasmatematikakelompok 150715235527-lva1-app6892drayertaurus
 
OSDC.fr 2012 :: Cascalog : progammation logique pour Hadoop
OSDC.fr 2012 :: Cascalog : progammation logique pour HadoopOSDC.fr 2012 :: Cascalog : progammation logique pour Hadoop
OSDC.fr 2012 :: Cascalog : progammation logique pour HadoopPublicis Sapient Engineering
 
Andrei rusu-2013-amaa-workshop
Andrei rusu-2013-amaa-workshopAndrei rusu-2013-amaa-workshop
Andrei rusu-2013-amaa-workshopAndries Rusu
 
Tugas matematika kelompok
Tugas matematika kelompokTugas matematika kelompok
Tugas matematika kelompokachmadtrybuana
 
Tugasmatematikakelompok
TugasmatematikakelompokTugasmatematikakelompok
Tugasmatematikakelompokgundul28
 
2. Definite Int. Theory Module-5.pdf
2. Definite Int. Theory Module-5.pdf2. Definite Int. Theory Module-5.pdf
2. Definite Int. Theory Module-5.pdfRajuSingh806014
 
ASFWS 2012 - Obfuscator, ou comment durcir un code source ou un binaire contr...
ASFWS 2012 - Obfuscator, ou comment durcir un code source ou un binaire contr...ASFWS 2012 - Obfuscator, ou comment durcir un code source ou un binaire contr...
ASFWS 2012 - Obfuscator, ou comment durcir un code source ou un binaire contr...Cyber Security Alliance
 
Deep generative model.pdf
Deep generative model.pdfDeep generative model.pdf
Deep generative model.pdfHyungjoo Cho
 
Christian Gill ''Functional programming for the people''
Christian Gill ''Functional programming for the people''Christian Gill ''Functional programming for the people''
Christian Gill ''Functional programming for the people''OdessaJS Conf
 
Fast parallelizable scenario-based stochastic optimization
Fast parallelizable scenario-based stochastic optimizationFast parallelizable scenario-based stochastic optimization
Fast parallelizable scenario-based stochastic optimizationPantelis Sopasakis
 
functions limits and continuity
functions limits and continuityfunctions limits and continuity
functions limits and continuityPume Ananda
 
lesson10-thechainrule034slides-091006133832-phpapp01.pptx
lesson10-thechainrule034slides-091006133832-phpapp01.pptxlesson10-thechainrule034slides-091006133832-phpapp01.pptx
lesson10-thechainrule034slides-091006133832-phpapp01.pptxJohnReyManzano2
 
Computer Aided Assessment (CAA) for mathematics
Computer Aided Assessment (CAA) for mathematicsComputer Aided Assessment (CAA) for mathematics
Computer Aided Assessment (CAA) for mathematicstelss09
 
Group theory notes
Group theory notesGroup theory notes
Group theory notesmkumaresan
 
Error control coding bch, reed-solomon etc..
Error control coding   bch, reed-solomon etc..Error control coding   bch, reed-solomon etc..
Error control coding bch, reed-solomon etc..Madhumita Tamhane
 
19 trig substitutions-x
19 trig substitutions-x19 trig substitutions-x
19 trig substitutions-xmath266
 

Similaire à 110617 lt (20)

Tugasmatematikakelompok 150715235527-lva1-app6892
Tugasmatematikakelompok 150715235527-lva1-app6892Tugasmatematikakelompok 150715235527-lva1-app6892
Tugasmatematikakelompok 150715235527-lva1-app6892
 
OSDC.fr 2012 :: Cascalog : progammation logique pour Hadoop
OSDC.fr 2012 :: Cascalog : progammation logique pour HadoopOSDC.fr 2012 :: Cascalog : progammation logique pour Hadoop
OSDC.fr 2012 :: Cascalog : progammation logique pour Hadoop
 
Andrei rusu-2013-amaa-workshop
Andrei rusu-2013-amaa-workshopAndrei rusu-2013-amaa-workshop
Andrei rusu-2013-amaa-workshop
 
Tugas matematika kelompok
Tugas matematika kelompokTugas matematika kelompok
Tugas matematika kelompok
 
Tugasmatematikakelompok
TugasmatematikakelompokTugasmatematikakelompok
Tugasmatematikakelompok
 
2. Definite Int. Theory Module-5.pdf
2. Definite Int. Theory Module-5.pdf2. Definite Int. Theory Module-5.pdf
2. Definite Int. Theory Module-5.pdf
 
ASFWS 2012 - Obfuscator, ou comment durcir un code source ou un binaire contr...
ASFWS 2012 - Obfuscator, ou comment durcir un code source ou un binaire contr...ASFWS 2012 - Obfuscator, ou comment durcir un code source ou un binaire contr...
ASFWS 2012 - Obfuscator, ou comment durcir un code source ou un binaire contr...
 
Deep generative model.pdf
Deep generative model.pdfDeep generative model.pdf
Deep generative model.pdf
 
Christian Gill ''Functional programming for the people''
Christian Gill ''Functional programming for the people''Christian Gill ''Functional programming for the people''
Christian Gill ''Functional programming for the people''
 
Fast parallelizable scenario-based stochastic optimization
Fast parallelizable scenario-based stochastic optimizationFast parallelizable scenario-based stochastic optimization
Fast parallelizable scenario-based stochastic optimization
 
functions limits and continuity
functions limits and continuityfunctions limits and continuity
functions limits and continuity
 
lesson10-thechainrule034slides-091006133832-phpapp01.pptx
lesson10-thechainrule034slides-091006133832-phpapp01.pptxlesson10-thechainrule034slides-091006133832-phpapp01.pptx
lesson10-thechainrule034slides-091006133832-phpapp01.pptx
 
Clojure night
Clojure nightClojure night
Clojure night
 
Ex algebra (5)
Ex algebra  (5)Ex algebra  (5)
Ex algebra (5)
 
Computer Aided Assessment (CAA) for mathematics
Computer Aided Assessment (CAA) for mathematicsComputer Aided Assessment (CAA) for mathematics
Computer Aided Assessment (CAA) for mathematics
 
Group theory notes
Group theory notesGroup theory notes
Group theory notes
 
24 modelling
24 modelling24 modelling
24 modelling
 
Error control coding bch, reed-solomon etc..
Error control coding   bch, reed-solomon etc..Error control coding   bch, reed-solomon etc..
Error control coding bch, reed-solomon etc..
 
19 trig substitutions-x
19 trig substitutions-x19 trig substitutions-x
19 trig substitutions-x
 
MUMS Opening Workshop - An Overview of Reduced-Order Models and Emulators (ED...
MUMS Opening Workshop - An Overview of Reduced-Order Models and Emulators (ED...MUMS Opening Workshop - An Overview of Reduced-Order Models and Emulators (ED...
MUMS Opening Workshop - An Overview of Reduced-Order Models and Emulators (ED...
 

Dernier

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 

Dernier (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

110617 lt

  • 1. MONAD ON GROOVY == MANADOLOGIE masaki@metabolics.co.jp 2011.06.17 1
  • 2. monad? Haskell monoid continuation ...... 2
  • 3. monad! ( ) Haskell Maybe Monad Groovy (2009/8/30, Gr ) 3
  • 4. example 1 2 S = {2x|x ∈ N, x > 3} (comprehension) x 3 ,2 *x 4
  • 5. groovy way def s(n) { ((0..n) .findAll { it**2 > 3 }) .collect { it*2 } } Groovy , 5
  • 6. example 2 import static hr.helix.monadologie.MonadComprehension.foreach def s(n) {    foreach {        x = takeFrom { 0..n }        guard { x**2 > 3 }        yield { 2*x }    } } 6
  • 7. example 3 def pythags(n) {    foreach {        z = takeFrom { 1..n }        x = takeFrom { 1..z }        y = takeFrom { x..z }        guard { x**2 + y**2 == z**2 }        yield { [x, y, z] }    } } assert pythags(12) == [[3, 4, 5], [6, 8, 10]] 7
  • 9. what’s the point monadologie ? => Collection , 9
  • 10. interface Monad<M> { M unit(Object a) M bind(Closure f) } 10
  • 11. List (!) (List<X> X ) List<X> (X a) = { [a] } // List<Y> (List<X> m, f) = { m.inject([]) { r, e -> r + f(e) } } // // where f s.t. List<Y> f(X x) // f apply [] 11
  • 12. unit, bind bind(m, unit) == m bind(unit(m), f) == f(m) // bind(bind(m, f), g) == bind(m, { bind(f(it), g) }) // 12
  • 13. Groovy ? => List (Collection) , ( ) ... 13
  • 14. Option - (e.g. null) Maybe Groovy safe reference “?.” Either - Reader - Closure Writer - State - STM - memoize, , AST 14
  • 15. , ? ( ) ...:-) 15
  • 16. LT 16