SlideShare a Scribd company logo
1 of 16
Download to read offline
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

More Related Content

What's hot

プログラミング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
 

What's hot (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
 

Viewers also liked

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
 

Viewers also liked (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
 

Similar to 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
 

Similar to 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...
 

Recently uploaded

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
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
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
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
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
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
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
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
 

Recently uploaded (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
+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...
 
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
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
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
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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
 

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