1. Functions can be treated like values in Swift: they can be passed as parameters, returned from other functions, and assigned to variables.
2. Higher-order functions allow functions to be used as parameters or return values. Functions passed to higher-order functions require @escaping if they are used after the higher-order function finishes.
3. Functions store behaviors that can be passed around and used later. This enables many useful patterns, like the GAFunction example that chains asynchronous operations.
4. Libraries like RxSwift take advantage of these Swift features to provide generalized reactive programming capabilities.
An introduction to functional programming with goEleanor McHugh
A crash course in functional programming concepts using Go. Heavy on code, light on theory.
You can find the examples at https://github.com/feyeleanor/intro_to_fp_in_go
Moore's Law may be dead, but CPUs acquire more cores every year. If you want to minimize response latency in your application, you need to use every last core - without wasting resources that would destroy performance and throughput. Traditional locks grind threads to a halt and are prone to deadlocks, and although actors provide a saner alternative, they compose poorly and are at best weakly-typed.
In this presentation, created exclusively for Scalar Conf, John reveals a new alternative to the horrors of traditional concurrency, directly comparing it to other leading approaches in Scala. Witness the beauty, simplicity, and power of declarative concurrency, as you discover how functional programming is the most practical solution to solving the tough challenges of concurrency.
ZIO: Powerful and Principled Functional Programming in ScalaWiem Zine Elabidine
This is an introduction of purely functional programming type safe abstractions that provide a variety of features for building asynchronous and concurrent applications data structures built on ZIO.
You'll learn by examples about the power of functional programming to solve the hard problems of software development in a principled, without compromises.
An introduction to functional programming with goEleanor McHugh
A crash course in functional programming concepts using Go. Heavy on code, light on theory.
You can find the examples at https://github.com/feyeleanor/intro_to_fp_in_go
Moore's Law may be dead, but CPUs acquire more cores every year. If you want to minimize response latency in your application, you need to use every last core - without wasting resources that would destroy performance and throughput. Traditional locks grind threads to a halt and are prone to deadlocks, and although actors provide a saner alternative, they compose poorly and are at best weakly-typed.
In this presentation, created exclusively for Scalar Conf, John reveals a new alternative to the horrors of traditional concurrency, directly comparing it to other leading approaches in Scala. Witness the beauty, simplicity, and power of declarative concurrency, as you discover how functional programming is the most practical solution to solving the tough challenges of concurrency.
ZIO: Powerful and Principled Functional Programming in ScalaWiem Zine Elabidine
This is an introduction of purely functional programming type safe abstractions that provide a variety of features for building asynchronous and concurrent applications data structures built on ZIO.
You'll learn by examples about the power of functional programming to solve the hard problems of software development in a principled, without compromises.
This is an introduction to some data structures that are powered by the Scalaz 8 effect system which are a core part of ZIO, https://github.com/scalaz/scalaz-zio
IO, Ref, Promise and Queue are powerful data structures to build asynchronous and concurrent applications using purely functional approach in order to solve the hard problems of software development in a principled way, without compromises.
GoLightly - a customisable virtual machine written in GoEleanor McHugh
A brief overview of the Go programming language and how it might be used to build a simple customisable virtual machine. This is a reduced and updated version of my previous Go virtual machine talks with many code examples.
Introduction to how to test our programs using imperative programming and functional programming with Tagless Final technique and how to make it simpler using ZIO. ZIO provides many features for concurrency and asynchronous programs. This presentation is about how to use ZIO environment to test your application.
This presentation explains the difference between concurrency and parallelism, and how could we make parallel computations and how could we design an API for parallel computation following the structure presented in the Functional Programming in Scala book
This is an introduction to some data structures that are powered by the Scalaz 8 effect system which are a core part of ZIO, https://github.com/scalaz/scalaz-zio
IO, Ref, Promise and Queue are powerful data structures to build asynchronous and concurrent applications using purely functional approach in order to solve the hard problems of software development in a principled way, without compromises.
GoLightly - a customisable virtual machine written in GoEleanor McHugh
A brief overview of the Go programming language and how it might be used to build a simple customisable virtual machine. This is a reduced and updated version of my previous Go virtual machine talks with many code examples.
Introduction to how to test our programs using imperative programming and functional programming with Tagless Final technique and how to make it simpler using ZIO. ZIO provides many features for concurrency and asynchronous programs. This presentation is about how to use ZIO environment to test your application.
This presentation explains the difference between concurrency and parallelism, and how could we make parallel computations and how could we design an API for parallel computation following the structure presented in the Functional Programming in Scala book
Functional programming is becoming more and more popular. It's quite obvious that there are many benefits on using FP elements on server side. How does it look like in JavaScript world? I will focus on functional concepts that can improve our every day work. I won't talk about monads, functors and other mathematical concepts. We'll see how functional style can improve our codebase, make it more readable or simplify complex problems. Samples will be presented in JavaScript, but concepts are general for every programming language.
With my simple implementation I wanted to demonstrate the basic ideas of th IO Monad.
My impl of the IO Monad is just a feasibility study, not production code!
When coding my impl of IO I was very much inspired by cats.effect.IO and monix.eval.Task which I studied at that time. Both are implementions of the IO Monad.
The API of my IO is very similar to the basics of Monix Task. This IO implementation also helped me to understand the IO Monad (of cats-effect) and Monix Task.
Interop with Future is also supported. You can convert IO to a Future. Vice versa you can convert a Future to an IO.
The development of my impl can be followed step by step in the code files in package iomonad.
Stanfy MadCode Meetup #9: Functional Programming 101 with SwiftStanfy
This time Alexander Voronov (@aleks_voronov), iOS Developer at Stanfy talked about Functional Programming 101 with Swift
Key points:
- Why do we need Functional Programming?
- The power of Swift
- Functors, Applicatives and Monads
- Pipes & Railways
- Functional Swift in real life
Links Mentioned:
- Functors, Applicatives and Monads in Pictures: http://adit.io/posts/2013-04-17-funct...
- Railway Oriented Programming: http://fsharpforfunandprofit.com/post...
- Functional Programming in Swift (Objc.io): http://www.objc.io/books/fpinswift/
- Moya: https://github.com/Moya/Moya
- Argo: https://github.com/thoughtbot/Argo
- Swiftz: https://github.com/typelift/Swiftz
- RxSwift: https://github.com/ReactiveX/RxSwift
- ReactiveCocoa-3.0: https://github.com/ReactiveCocoa/Reac...
- Haskell: https://www.haskell.org
- F#: http://fsharp.org
- Erlang: http://www.erlang.org
- Elm: http://elm-lang.org
Watch video from the presentation (rus): https://youtu.be/w6zyGylS4Wk
Join our MadCode group on FB(rus): https://www.facebook.com/MadCodeMeetup/
Find more videos from MadCode Meetups (rus): https://www.youtube.com/playlist?list=PLrplqd3YJvBvUygFkx4Xvx1p3zyiCgB9Q
Functional programming is gaining more and more popularity. I would like to present basics of functional programming, which everyone could use in daily work. I talk about functions, currying & function composition. I present utility functions, which can improve our code readability, make it more reusable and testable.
Functional Programming for OO Programmers (part 2)Calvin Cheng
Code examples demonstrating Functional Programming concepts, with JavaScript and Haskell.
Part 1 can be found here - http://www.slideshare.net/calvinchengx/functional-programming-part01
Source code can be found here - http://github.com/calvinchengx/learnhaskell
Let me know if you spot any errors! Thank you! :-)
hey this is Rupendra choudhary..!! i shared my "c" lang ppt..!!! u just goto that ppt if u r in deep with "c" ..!!! i create after i hv played a much with "c"..(sorry bt ppt is slightly disturbd may be due to unsupportable msppt2010 by slideshare)...find me on rupendrachoudhary1990@gmail.com or https://rupendrachoudhary.wordpress.com
The Strange World of Javascript and all its little Asynchronous BeastsFederico Galassi
Javascript is a wonderland populated by all kinds of exotic beasts. Callbacks, events, promises, functional programming, reactive programming, streams, generators are all part of this incredible asynchronous bestiary. We’re talking of insidious or even ferocious things, a great danger to the unwary programmer. Let’s look at them, learn from them, tame them and finally put them to our own advantage. Let’s stop Javascript from being an unfamiliar place and make it feel much more like home.
Talk I held on 14/05/2014 at JsDay, Verona, Italy. Corrected slides.
http://2014.jsday.it/talk/the-strange-world-of-javascript-and-all-its-little-asynchronous-beasts/
Feedback!
https://joind.in/talk/view/11280
Follow me on Twitter!
https://twitter.com/federicogalassi
FS2 (previously called Scalaz-Stream) is a library that facilitates purely functional API to encode stream processing in a modular and composable manner.
Due to its functional abstraction around "streams" of data, FS2 enables isolating and delaying the side-effects until the streams are fully composed and assembled into its final execution context.
The main objectives of this talk are to get started with FS2, particularly with its functional approach to stream processing, and to dive into details of its semantics.
Similar to 20181020 advanced higher-order function (20)
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Let's dive deeper into the world of ODC! Ricardo Alves (OutSystems) will join us to tell all about the new Data Fabric. After that, Sezen de Bruijn (OutSystems) will get into the details on how to best design a sturdy architecture within ODC.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
3. let n = 42
42 func function(_ i: Int) -> Int {
return i + 42
}
let f = function
type(of: n)
// Int
type(of: f)
// (Int) -> Int
let n: Int = 42 let f: (Int) -> Int = function
let f: (Int) -> Int = { i in
return i + 42
}
Value Function
f(21)21 + n
4. Function
func output(_ i: Int) {
print(i)
}
output(n)
func output(_ i: Int,
_ m: (Int) -> Int)
{
print(m(i))
}
output(21, f)
func getN() -> Int {
let n = 42
return n
}
func getF() -> (Int) -> Int {
let f = { $0 + 42 }
return f
}
Value
12. gaFunction(task: { f in
let url = URL(string: "image download url")!
let image = try! UIImage(data: Data(contentsOf: url))
f(image)
}, execute: { img in
self.imageView.image = img
})
func gaFunction<T>(task: @escaping ((@escaping (T) -> Void) -> Void),
execute: @escaping (T) -> Void)
{
DispatchQueue.main.async {
task(execute)
}
}
General Async Function
13. General Async Function Class
class GAFunction<T> {
private let task: ((@escaping (T) -> Void) -> Void)
init(task: @escaping (@escaping (T) -> Void) -> Void) {
self.task = task
}
func execute(_ f: @escaping (T) -> Void) {
DispatchQueue.main.async {
self.task(f)
}
}
}
14. class GAFunction<T> {
private let task: ((@escaping (T) -> Void) -> Void)
init(task job: @escaping (@escaping (T) -> Void) -> Void) {
task = job
}
func execute(_ f: @escaping (T) -> Void) {
DispatchQueue.main.async {
self.task(f)
}
}
}
GAFunction class
let gaf = GAFunction<UIImage?>(task: { f in
let url = URL(string: "image download url")!
let image = try! UIImage(data: Data(contentsOf: url))
f(image)
})
gaf.execute({ img in
self.imageView.image = img
})
15. Async Value
//42
//41
//40
extension GAFunction {
convenience init(just t: T) {
self.init(task: { f in f(t) })
}
convenience init(from ts: [T]) {
self.init(task: { f in ts.forEach(f) })
}
}
GAFunction(just: 42)
.execute({ i in
print(i)
})
GAFunction(from: [42, 41, 40])
.execute({ i in
print(i)
})
//42
16. Filter
//42
//40
//38
extension GAFunction {
func filter(_ filter: @escaping (T) -> Bool) -> GAFunction<T> {
return GAFunction<T>(task: { f in
self.execute({ t in
if filter(t) {
f(t)
}
})
})
}
}
GAFunction(from: [42, 41, 40, 39, 38])
.filter({ $0 % 2 == 0 })
.execute({ i in
print(i)
})
17. Map
//420
//410
//400
extension GAFunction {
func map<U>(_ mapper: @escaping (T) -> U) -> GAFunction<U> {
return GAFunction<U>(task: { f in
self.execute({ t in
f(mapper(t))
})
})
}
}
GAFunction(from: [42, 41, 40])
.map({ $0 * 10 })
.execute({ i in
print(i)
})
18. FlatMap
extension GAFunction {
public func flatMap<U>(_ mapper: @escaping (T) -> GAFunction<U>)
-> GAFunction<U>
{
return GAFunction<U>(task: { f in
self.execute({ t in
mapper(t).execute({ u in f(u) })
})
})
}
}
GAFunction(from: [42, 41, 40])
.flatMap({ i -> GAFunction<Float> in
GAFunction(just: Float(i) / 3)
})
.execute({ f in
print(f)
})
//14.0
//13.666667
//13.333333
19. All together
GAFunction(just: "image url")
.map({ URL(string: $0) })
.filter({ $0 != nil })
.map({ $0! })
.flatMap(downloadImage)
.execute({ img in
self.imageView.image = img
})
func downloadImage(_ url: URL) -> GAFunction<UIImage?> {
return GAFunction(task: { completion in
if let image = try? UIImage(data: Data(contentsOf: url)) {
completion(image)
} else {
completion(nil)
}
})
}
20. All together
GAFunction(just: "image url")
.map({ URL(string: $0) })
.filter({ $0 != nil })
.map({ $0! })
.flatMap(downloadImage)
.execute({ img in
self.imageView.image = img
})
func downloadImage(_ url: URL) -> GAFunction<UIImage?> {
return GAFunction(task: { completion in
if let image = try? UIImage(data: Data(contentsOf: url)) {
completion(image)
} else {
completion(nil)
}
})
}
21. Summary
1. 함수는 value 처럼
- 변수에 담을 수 있다
- 파라미터로 넘길 수 있다
- 리턴값으로 반환될 수 있다
2. 고차함수(Higher-Order Function)
- 함수가 파라미터로 쓰이거나 반환값으로 사용되는 경우
- 전달된 함수가 본체의 수행이 종료된 후에 사용되는 경우 @escaping을 해줘야 한다.
- optional function 은 @escaping이 기본이다.
3. 함수는 행동을 저장한다
- 저장한 행동은 전달될 수 있다.
- 저장된 행동은 나중에 사용될 수 있다.
4. 이러한 특성들로 여러 재밌는 것들을 만들 수 있다.
- 사례. GAFunction
5. 이미 이러한 성질을 이용해서 범용으로 만들어진 라이브러리가 있다.
- RxSwift 를 쓰자