SlideShare a Scribd company logo
Understanding
                       Function Currying
                                                Javascript / AS3




                                                Thomas Burleson
                                       Digital Solutions Architect


Sunday, April 29, 12
Anonymous Functions

                          Closures
                              Function Currying
                                             Partial Applications




Sunday, April 29, 12
Function Currying:
                       Combine function with variables to create new function.




                                Variables are cached [captured] as function arguments
                                Outer variables are accessed via closure scope by inner Function




Sunday, April 29, 12
But how/why do we use     Function Currying


                          Explore existing Javascript code

                                Refactor code (to remove verbosity)

                                       Apply DRY concept

                                              Concise Code, Easy Maintenance




Sunday, April 29, 12
Refactoring with DRY

                         Existing Code

                               Anonymous Functions


                                     Closures

                                         Function Currying




Sunday, April 29, 12
REST Service (asynchronous)




Sunday, April 29, 12
Not DRY
                       Verbose!
                       Difficult to maintain




Sunday, April 29, 12
Uses 'function currying'
                       at two (2) levels :
                            onSuccess()

                            forClass()




Sunday, April 29, 12
Video Tutorial   (click to run)



                                              (click to download)

                                              Source Code




Sunday, April 29, 12

More Related Content

KEY
Building Multilanguage (i18n) Flex Applications
PDF
The Flash to HTML5 Opportunity
PDF
Visualize Deep Links with Flash and Swiz
PDF
Understanding AngularJS HTML5 DataServices
PDF
Java Course 9: Networking and Reflection
PDF
Java 9 Project Jigsaw
ODP
Eclipse Day India 2015 - Java 9
PPTX
Hack java8:java 9
Building Multilanguage (i18n) Flex Applications
The Flash to HTML5 Opportunity
Visualize Deep Links with Flash and Swiz
Understanding AngularJS HTML5 DataServices
Java Course 9: Networking and Reflection
Java 9 Project Jigsaw
Eclipse Day India 2015 - Java 9
Hack java8:java 9

Viewers also liked (18)

PDF
FP Concepts
PPSX
Java9 and the impact on Maven Projects (JFall 2016)
PPT
2016 java9-how-make-qus
PDF
Functional Programming for OO Programmers (part 2)
PDF
Hardcore functional programming
PPTX
Discuss about java 9 with latest features
PPSX
Java 9 and the impact on Maven Projects (Devoxx 2016)
PDF
Java 9 and Project Jigsaw
PDF
Java 9 and Beyond
PDF
Pragmatic functional refactoring with java 8
PDF
Currying in perl
PDF
A new execution model for Nashorn in Java 9
PPSX
Java 9 and the impact on Maven Projects (JavaOne 2016)
PPTX
Java 7, 8 & 9 - Moving the language forward
PDF
Java 9 by Alessio Stalla
PDF
Embracing Reactive Streams with Java 9 and Spring 5
PDF
Java 9 preview
PPTX
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
FP Concepts
Java9 and the impact on Maven Projects (JFall 2016)
2016 java9-how-make-qus
Functional Programming for OO Programmers (part 2)
Hardcore functional programming
Discuss about java 9 with latest features
Java 9 and the impact on Maven Projects (Devoxx 2016)
Java 9 and Project Jigsaw
Java 9 and Beyond
Pragmatic functional refactoring with java 8
Currying in perl
A new execution model for Nashorn in Java 9
Java 9 and the impact on Maven Projects (JavaOne 2016)
Java 7, 8 & 9 - Moving the language forward
Java 9 by Alessio Stalla
Embracing Reactive Streams with Java 9 and Spring 5
Java 9 preview
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Ad

Recently uploaded (20)

PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
A comparative study of natural language inference in Swahili using monolingua...
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
project resource management chapter-09.pdf
PDF
Getting Started with Data Integration: FME Form 101
PPT
Module 1.ppt Iot fundamentals and Architecture
PPTX
Modernising the Digital Integration Hub
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
WOOl fibre morphology and structure.pdf for textiles
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PDF
Architecture types and enterprise applications.pdf
PPTX
The various Industrial Revolutions .pptx
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
observCloud-Native Containerability and monitoring.pptx
A comparative study of natural language inference in Swahili using monolingua...
OMC Textile Division Presentation 2021.pptx
project resource management chapter-09.pdf
Getting Started with Data Integration: FME Form 101
Module 1.ppt Iot fundamentals and Architecture
Modernising the Digital Integration Hub
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
WOOl fibre morphology and structure.pdf for textiles
Final SEM Unit 1 for mit wpu at pune .pptx
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
NewMind AI Weekly Chronicles - August'25-Week II
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Univ-Connecticut-ChatGPT-Presentaion.pdf
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Architecture types and enterprise applications.pdf
The various Industrial Revolutions .pptx
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Group 1 Presentation -Planning and Decision Making .pptx
Ad

Function currying

  • 1. Understanding Function Currying Javascript / AS3 Thomas Burleson Digital Solutions Architect Sunday, April 29, 12
  • 2. Anonymous Functions Closures Function Currying Partial Applications Sunday, April 29, 12
  • 3. Function Currying: Combine function with variables to create new function. Variables are cached [captured] as function arguments Outer variables are accessed via closure scope by inner Function Sunday, April 29, 12
  • 4. But how/why do we use Function Currying Explore existing Javascript code Refactor code (to remove verbosity) Apply DRY concept Concise Code, Easy Maintenance Sunday, April 29, 12
  • 5. Refactoring with DRY Existing Code Anonymous Functions Closures Function Currying Sunday, April 29, 12
  • 7. Not DRY Verbose! Difficult to maintain Sunday, April 29, 12
  • 8. Uses 'function currying' at two (2) levels : onSuccess() forClass() Sunday, April 29, 12
  • 9. Video Tutorial (click to run) (click to download) Source Code Sunday, April 29, 12