Zippers are a design pattern in functional programming languages, such as Haskell, which provides a focus point and methods for navigating around in a functional data structure. It turns out that for any algebraic data type with one parameter, the derivative of the type is a zipper for it.
••• Learn how to safely manage memory with smart pointers! •••
In this presentation you will learn:
▸ the dangers of using raw pointers for dynamic memory
▸ the difference between unique_ptr, shared_ptr, weak_ptr
▸ how to use factories to increase safety and performance
▸ when raw pointers are still needed
Modern Algorithms and Data Structures - 1. Bloom Filters, Merkle TreesLorenzo Alberton
The first part of a series of talks about modern algorithms and data structures, used by nosql databases like HBase and Cassandra. An explanation of Bloom Filters and several derivates, and Merkle Trees.
••• Learn how to safely manage memory with smart pointers! •••
In this presentation you will learn:
▸ the dangers of using raw pointers for dynamic memory
▸ the difference between unique_ptr, shared_ptr, weak_ptr
▸ how to use factories to increase safety and performance
▸ when raw pointers are still needed
Modern Algorithms and Data Structures - 1. Bloom Filters, Merkle TreesLorenzo Alberton
The first part of a series of talks about modern algorithms and data structures, used by nosql databases like HBase and Cassandra. An explanation of Bloom Filters and several derivates, and Merkle Trees.
Heap Sort in Design and Analysis of algorithmssamairaakram
Brief description of Heap Sort and its types.it includes Binary Tree and its types. analysis and algorithm of Heap Sort. comparison b/w Heap,Qucik and Merge Sort.
Nowadays, with so many programming languages in existence, it can be very difficult to choose one that's fit for you. However, as many of them are adopting functional programming (FP) concepts, this common ground can help you to pick up any of them. During this talk you will learn about general FP principles on the example of one of the most extensively developed modern languages - Scala - and see how these principles allow you to write better software.
Heap Sort in Design and Analysis of algorithmssamairaakram
Brief description of Heap Sort and its types.it includes Binary Tree and its types. analysis and algorithm of Heap Sort. comparison b/w Heap,Qucik and Merge Sort.
Nowadays, with so many programming languages in existence, it can be very difficult to choose one that's fit for you. However, as many of them are adopting functional programming (FP) concepts, this common ground can help you to pick up any of them. During this talk you will learn about general FP principles on the example of one of the most extensively developed modern languages - Scala - and see how these principles allow you to write better software.
Function Programming in Scala.
A lot of my examples here comes from the book
Functional programming in Scala By Paul Chiusano and Rúnar Bjarnason, It is a good book, buy it.
This presentation takes you on a functional programming journey, it starts from basic Scala programming language design concepts and leads to a concept of Monads, how some of them designed in Scala and what is the purpose of them
Talk is about simple data structures like queue and Tree and their possible implementation in Scala. It also talks about binary search trees and their traversals.
JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...PROIDEA
Contact
FUNCTIONAL PROGRAMING AND EVENT SOURCING - A PAIR MADE IN HEAVEN - EXTENDED, 2 HOURS LONG BRAINWASH
TL;DR: This is talk is a solid introduction to two (supposedly) different topics: FP & ES. I will cover both the theory and the practice. We will emerage ES+FP application starting from ES+OO one.
While reading blogs or attending conferences, you might have heard about Event Sourcing. But didn't you get this feeling, that while there is a lot of theory out there, it is really hard to see a hands-on example? And even if you find some, those are always orbiting around Object Oriented concepts?
Greg Young once said "When we talk about Event Sourcing, current state is a left-fold of previous behaviours. Nothing new to Functional Programmers". If Functional Programming is such a natural concept for event sourced systems, shouldn't they fit together on a single codebase?
In this talk we will quickly introduce Event Sourcing (but without going into details), we will introduce some functional concepts as well (like State monad). Armoured with that knowledge we will try to transform sample ES application (OO-style, tightly coupled with framework) to frameworkless, FP-style solution).
Talk is targeted for beginner and intermediate audience. Examples will be in Scala but nothing fancy - normal syntax.
This talk is an extended version of a presentation "Event Sourcing & Functional Programming - a pair made in heaven". It is enriched with content of presentations: "Monads - asking the right question" and "It's all been done before - The Hitchhiker's Guide to Time Travel".
Function Programming in Scala.
A lot of my examples here comes from the book
Functional programming in Scala By Paul Chiusano and Rúnar Bjarnason, It is a good book, buy it.
Discusses the algebraic properties of types, different kinds of functions and the information that is preserved or lost, and Category Theory concepts that underpin and unify them.
[Expert Fridays] Александр Чичигин - Как перестать бояться и полюбить COQProvectus
Взглянем на Coq с точки зрения программиста, а не математика, и посмотрим какие в нём есть средства не только для усложнения, но и облегчения написания функционального кода
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
COVID-19 had an unprecedented impact on scientific collaboration. The pandemic and its broad response from the scientific community has forged new relationships among public health practitioners, mathematical modelers, and scientific computing specialists, while revealing critical gaps in exploiting advanced computing systems to support urgent decision making. Informed by our team’s work in applying high-performance computing in support of public health decision makers during the COVID-19 pandemic, we present how Globus technologies are enabling the development of an open science platform for robust epidemic analysis, with the goal of collaborative, secure, distributed, on-demand, and fast time-to-solution analyses to support public health.
Software Engineering, Software Consulting, Tech Lead.
Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Security,
Spring Transaction, Spring MVC,
Log4j, REST/SOAP WEB-SERVICES.
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
Why React Native as a Strategic Advantage for Startup Innovation.pdfayushiqss
Do you know that React Native is being increasingly adopted by startups as well as big companies in the mobile app development industry? Big names like Facebook, Instagram, and Pinterest have already integrated this robust open-source framework.
In fact, according to a report by Statista, the number of React Native developers has been steadily increasing over the years, reaching an estimated 1.9 million by the end of 2024. This means that the demand for this framework in the job market has been growing making it a valuable skill.
But what makes React Native so popular for mobile application development? It offers excellent cross-platform capabilities among other benefits. This way, with React Native, developers can write code once and run it on both iOS and Android devices thus saving time and resources leading to shorter development cycles hence faster time-to-market for your app.
Let’s take the example of a startup, which wanted to release their app on both iOS and Android at once. Through the use of React Native they managed to create an app and bring it into the market within a very short period. This helped them gain an advantage over their competitors because they had access to a large user base who were able to generate revenue quickly for them.
Large Language Models and the End of ProgrammingMatt Welsh
Talk by Matt Welsh at Craft Conference 2024 on the impact that Large Language Models will have on the future of software development. In this talk, I discuss the ways in which LLMs will impact the software industry, from replacing human software developers with AI, to replacing conventional software with models that perform reasoning, computation, and problem-solving.
Advanced Flow Concepts Every Developer Should KnowPeter Caitens
Tim Combridge from Sensible Giraffe and Salesforce Ben presents some important tips that all developers should know when dealing with Flows in Salesforce.
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
CyanicLab, an offshore custom software development company based in Sweden,India, Finland, is your go-to partner for startup development and innovative web design solutions. Our expert team specializes in crafting cutting-edge software tailored to meet the unique needs of startups and established enterprises alike. From conceptualization to execution, we offer comprehensive services including web and mobile app development, UI/UX design, and ongoing software maintenance. Ready to elevate your business? Contact CyanicLab today and let us propel your vision to success with our top-notch IT solutions.
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
Traditional software testing methods are being challenged in retail, where customer expectations and technological advancements continually shape the landscape. Enter generative AI—a transformative subset of artificial intelligence technologies poised to revolutionize software testing.
top nidhi software solution freedownloadvrstrong314
This presentation emphasizes the importance of data security and legal compliance for Nidhi companies in India. It highlights how online Nidhi software solutions, like Vector Nidhi Software, offer advanced features tailored to these needs. Key aspects include encryption, access controls, and audit trails to ensure data security. The software complies with regulatory guidelines from the MCA and RBI and adheres to Nidhi Rules, 2014. With customizable, user-friendly interfaces and real-time features, these Nidhi software solutions enhance efficiency, support growth, and provide exceptional member services. The presentation concludes with contact information for further inquiries.
2. Table of Contents
1 Motivation
2 List Zipper
3 Tree Zippers
4 Algebraic Data Types
5 Type Differentiation
6 Conclusion
3. Motivation
Navigating around in and updating mutable data structures is easy:
• Keep a pointer to your current location in the data structure;
• Update the pointer to move around the data structure;
• Modify the data structure using destructive update via the pointer.
Example (C Array)
char my_array[1024];
char *p = my_array;
// Move right
p++;
// Move left
p--;
// Update focused element
*p = ’A’;
4. Motivation
But what is the equivalent for an immutable data structure? I.e. how do we keep track
of a local focus point within a data structure? E.g. XML document tree, text editor
buffer, window manager stack (e.g. XMonad), AVL tree.
For a list we could use an integer to represent the element we are interested in:
type ListFocus a = (Int, [a])
but this requires traversing from the start of the list every time – an O(n) operation.
For more complex types, this is even less practical.
Instead, we can use a data structure called a zipper.
5. Table of Contents
1 Motivation
2 List Zipper
3 Tree Zippers
4 Algebraic Data Types
5 Type Differentiation
6 Conclusion
6. List Zipper
-- A list zipper is a pair consisting of the front
-- of the list (reversed) and the rear of the list.
type ListZipper a = ([a], [a])
-- Convert a list to a zipper.
-- Start at the front of the list.
fromList :: [a] → ListZipper a
fromList xs = ([], xs)
7. List Zipper
-- Move about in the zipper.
right, left :: ListZipper a → ListZipper a
right (xs, y:ys) = (y:xs, ys)
left (x:xs, ys) = (xs, x:ys)
-- Modify the focused element.
modify :: (a → a) → ListZipper a → ListZipper a
modify f (xs, y:ys) = (xs, (f y):ys)
modify _ zs = zs
-- When we are finished, convert back to a list.
toList :: ListZipper a → [a]
toList ([], ys) = ys
toList zs = toList (left zs)
8. *Main> let z = fromList [’a’, ’b’, ’c’]
*Main> z
("","abc")
a
ctx list
b
c
11. *Main> right $ right $ right z
("cba","")
a
ctx list
b
c
12. List Zipper
Example (XMonad)
XMonad is a tiling window manager for X written in Haskell. The main data structure
for managing workspace and window focus uses nested list zippers.
type StackSet a = ListZipper (Workspace a)
type Workspace a = ListZipper (Window a)
This allows XMonad to keep track of the focused workspace in an ordered list of
workspaces and also keep track of the focused window on each workspace.
(This is a simplification of the actual types used. The zippers that XMonad uses allow
wrapping when you reach the end of the window or workspace list.)
13. Table of Contents
1 Motivation
2 List Zipper
3 Tree Zippers
4 Algebraic Data Types
5 Type Differentiation
6 Conclusion
14. Binary Tree
data Tree a
= Empty
| Node (Tree a) a (Tree a)
deriving Show
type Context a = Either (a, Tree a) (a, Tree a)
type TreeZipper a = ([Context a], Tree a)
fromTree :: Tree a → TreeZipper a
fromTree t = ([], t)
right, left, up :: TreeZipper a → TreeZipper a
right (ctx, Node l a r) = (Right (a, l) : ctx, r)
left (ctx, Node l a r) = (Left (a, r) : ctx, l)
15. Binary Tree
up (Left (a, r) : ctx, l) = (ctx, Node l a r)
up (Right (a, l) : ctx, r) = (ctx, Node l a r)
modify :: (a → a) → TreeZipper a → TreeZipper a
modify f (ctx, Node l a r) = (ctx, Node l (f a) r)
modify f z = z
toTree :: TreeZipper a → Tree a
toTree ([], t) = t
toTree z = toTree (up z)
16. *Main> let t = Node
(Node
(Node Empty ’d’ Empty)
’b’
(Node Empty ’e’ Empty))
’a’
(Node
(Node Empty ’f’ Empty)
’c’
(Node Empty ’g’ Empty))
*Main> fromTree t
a
cb
ed gf
ctx tree
17. *Main> right $ fromTree t
( [Right (’a’,
Node
(Node Empty ’d’ Empty)
’b’
(Node Empty ’e’ Empty))],
Node
(Node Empty ’f’ Empty)
’c’
(Node Empty ’g’ Empty) )
Right
a c
b
ed
gf
ctx tree
18. *Main> left $ right $ fromTree t
( [ Left (’c’, Node Empty ’g’ Empty),
Right (’a’,
Node
(Node Empty ’d’ Empty)
’b’
(Node Empty ’e’ Empty))],
Node Empty ’f’ Empty )
Right
Left
a
c
b
ed
g
f
ctx tree
19. Tree Zippers
Example (XML)
• XPath navigation around an XML document is basically a zipper – you have a
current context and methods to navigate to neighbouring nodes.
• One implementation of this in Haskell is the rose tree zipper from HXT.
data NTree a = NTree a [NTree a] -- A rose tree
data NTCrumb = NTC [NTree a] a [NTree a] -- "Breadcrumb" for context
-- The zipper itself
data NTZipper a = NTZ { ntree :: NTree a, context :: [NTCrumb a] }
-- And using it to represent XML
type XmlTree = NTree XNode
type XmlNavTree = NTZipper XNode
data XNode = XText String | XTag QName [XmlTree] | XAttr QName | · · ·
20. Table of Contents
1 Motivation
2 List Zipper
3 Tree Zippers
4 Algebraic Data Types
5 Type Differentiation
6 Conclusion
21. Algebraic Data Types
Why are the types in languages such as Haskell sometimes referred to as Algebraic
Data Types? One way to see the relationship to algebra is to convert the types to
algebraic expressions which represent the number of values that a type has.
data Void ⇔ 0 The empty type
data () = () ⇔ 1 The unit type
data Either a b = Left a | Right b ⇔ a + b A sum type
type Pair a b = (a, b) ⇔ a.b A product type
Technically, Haskell types form an algebraic structure called a semiring.
Some more examples:
data Bool = False | True ⇔ 2
data Maybe a = Nothing | Just a ⇔ 1 + a
type Func a b = a -> b ⇔ ba An exponential type
Int ⇔ 232 or 264 (implementation dependent)
22. Algebraic Laws
The usual algebraic laws (for semirings) hold, up to type “equivalence”:
0 + a = a ⇔ Either Void a ∼= a
a + b = b + a ⇔ Either a b ∼= Either b a
0.a = 0 ⇔ (Void, a) ∼= Void
1.a = a ⇔ ((), a) ∼= a
a.b = b.a ⇔ (a, b) ∼= (b, a)
a.(b + c) = a.b + a.c ⇔ (a, Either b c) ∼= Either (a,b) (a,c)
(cb)a = cb.a ⇔ a -> b -> c ∼= (a, b) -> c
a2 = a.a ⇔ Bool -> a ∼= (a, a)
23. Algebra of the List Type
data List a = Nil | Cons a (List a)
L(a) = 1 + a.L(a)
= 1 + a.(1 + a.L(a))
= 1 + a + a2(1 + a.L(a))
= 1 + a + a2 + a3 + a4 + · · ·
So a list has either 0 elements or 1 element or 2 elements or . . . (which we already
knew!).
Alternatively, solving for L(a):
L(a) − a.L(a) = 1
(1 − a).L(a) = 1
L(a) =
1
1 − a
It doesn’t seem to make much sense to do subtraction or division on types. But look
at the Taylor series expansion:
1
1 − a
= 1 + a + a2 + a3 + a4 + · · ·
24. Algebra of Tree Types
data Tree a = Empty | Node (Tree a) a (Tree a)
T(a) = 1 + a.T(a)2
a.T(a)2 − T(a) + 1 = 0
T(a) =
1 −
√
1 − 4.a
2.a
= 1 + a + 2a2 + 5a3 + 14a4 + · · ·
via the quadratic formula and Taylor series expansion. But now we are taking square
roots of types!
25. Table of Contents
1 Motivation
2 List Zipper
3 Tree Zippers
4 Algebraic Data Types
5 Type Differentiation
6 Conclusion
26. One-Hole Contexts
Definition
The one-hole context of a parameterised type T(a) is the type of data structures you
get if you remove one distinguished element of type a from a data structure of type
T(a) and somehow mark the hole where the element came from.
Example
type Triple a = (a, a, a)
The one-hole contexts are ( , a, a), (a, , a), and (a, a, ). A type that could
represent this is
data TripleOhc a = Left a a | Mid a a | Right a a
27. One-Hole Contexts
Look at the algebraic types:
type Triple a = (a, a, a) ⇔ a3
type TripleOhc a = Left a a | Mid a a | Right a a ⇔ 3a2
Notice that
3a2
=
d
da
a3
In fact, this this relationship holds for any parameterised type T(a).
Observation
The type of the one-hole context of any parameterized type T(a) is the derivative type
d
da
T(a) or ∂aT(a)
28. Zippers from One-Hole Contexts
Observation
For any parameterized type T(a), the type a.∂aT(a) is a zipper for type T(a).
Example
The type
type TripleZipper a = (a, TripleOhc a)
is a zipper for the type Triple a.
TripleZipper(a) = a.3a2
= 3a3
= 3.Triple(a)
But what about some more interesting types . . . ?
29. List Zipper
L(a) =
1
1 − a
∂aL(a) =
1
(1 − a)2
= L(a)2
ZL(a) = a.∂aL(a) = a.L(a)2
type ListZipper a = (a, [a], [a])
This is slightly different from our original list zipper type ([a], [a]). The
distinguished element is now pulled out of the second list and made explicit. This also
means that the zipper can’t be empty. However, this is still a list zipper and we derived
it using the differential calculus!
30. Tree Zipper
T(a) = 1 + a.T(a)2
∂aT(a) = T(a)2 + 2a.T(a).∂aT(a)
∂aT(a) =
T(a)2
1 − 2a.T(a)
= T(a)2.L(2a.T(a))
ZT (a) = a.∂aT(a)
= a.T(a)2.L(2a.T(a))
type Context a = Either (a, Tree a) (a, Tree a)
type TreeZipper a = (a, Tree a, Tree a, [Context a])
31. Table of Contents
1 Motivation
2 List Zipper
3 Tree Zippers
4 Algebraic Data Types
5 Type Differentiation
6 Conclusion
32. Conclusion
• Zippers are a useful way of navigating and manipulating mutable data structures
in real-world functional programs.
• Algebraic data types really are algebraic.
• Differentiation of types can lead to automatic derivation of zippers.
• Nobody really knows why this works yet — active research.