SlideShare a Scribd company logo
Cross-platform Native
Development in F#
David Y. Kay
?
Cross platform native development in f#
Cross platform native development in f#
ALGOL Lisp
ISWIM
ML
F# Syntax Overview
(Several examples are from: F# For Fun and Profit)
Basic Values
// ======== "Variables" (but not really) ==========
// The "let" keyword defines an (immutable) value
let myInt = 5
let myFloat = 3.14
let myString = "hello" //note that no types needed
// ======== Lists ============
let twoToFive = [2;3;4;5] // Square brackets create a list with
// semicolon delimiters.
let oneToFive = 1 :: twoToFive // :: creates list with new 1st element
// The result is [1;2;3;4;5]
let zeroToFive = [0;1] @ twoToFive // @ concats two lists
Functions
let square x = x * x // Note that no parens are used.
square 3 // Now run the function. Again, no parens.
let add x y = x + y // don't use add (x,y)! It means something
// completely different.
add 2 3 // Now run the function.
// to define a multiline function, just use indents. No semicolons needed.
let evens list =
let isEven x = x%2 = 0 // Define "isEven" as an inner ("nested") function
List.filter isEven list // FP’s classic filter a la “map/filter/reduce”
evens oneToFive // Now run the function
Pattern Matching
let simplePatternMatch =
let x = "a"
match x with
| "a" -> printfn "x is a"
| "b" -> printfn "x is b"
| _ -> printfn "x is something else" // underscore matches anything
let validValue = Some(99)
let invalidValue = None
let optionPatternMatch input =
match input with
| Some i -> printfn "input is an int=%d" i
| None -> printfn "input is missing"
Data Types - I
// Tuple types are pairs, triples, etc. Tuples use commas.
let twoTuple = 1,2
let threeTuple = "a",2,true
// Record types have named fields. Semicolons are separators.
type Person = {First:string; Last:string}
let person1 = {First="john"; Last="Doe"}
Data Types - II
// Union types have choices. Vertical bars are separators.
type Temp =
| DegreesC of float
| DegreesF of float
let temp = DegreesF 98.6
// Types can be combined recursively in complex ways.
// E.g. here is a union type that contains a list of the same type:
type Employee =
| Worker of Person
| Manager of Employee list
let jdoe = {First="John";Last="Doe"}
let worker = Worker jdoe
Classes
type LoginWindowViewModel(overseer: Overseer.Overseer) =
inherit ViewModelBase()
let mutable username = ""
let mutable password = ""
member this.Username
with get () = username
and set (value) =
username <- value
member this.Password
with get () = password
and set (value) =
password <- value
member this.LoginCommand = ViewModelHelpers.createCommand (fun o ->
overseer.login (username, password))
(fun _ -> true)
Interop
// Mostly very great:
deviceContext.SoundPlayer.MessageReceived()
// Some issues, including null-safety:
let x: int option = Some 4
Cross-platform Development
(Powered by Xamarin)
Xamarin
MVVM
Cross platform native development in f#
Cross platform native development in f#
Device-specific Services
Cross platform native development in f#
Thanks!
Contact
www.davidykay.com/newsletter/
davidykay@gmail.com

More Related Content

PPTX
Scala 5 Concepts and Pitfals
PPTX
Data types in php
PPTX
Unit2 control statements
PPTX
PHP Basics
PDF
basic of desicion control statement in python
PPTX
Input processing and output in Python
PDF
Swift 3.0 の新しい機能(のうちの9つ)
PPT
Java Script Introduction
Scala 5 Concepts and Pitfals
Data types in php
Unit2 control statements
PHP Basics
basic of desicion control statement in python
Input processing and output in Python
Swift 3.0 の新しい機能(のうちの9つ)
Java Script Introduction

What's hot (18)

PDF
Chapter27 polymorphism-virtual-function-abstract-class
PDF
Python lecture 8
PDF
How to get help in R?
PDF
types, types, types
PPT
C# programming
PDF
OO-like C Programming: Struct Inheritance and Virtual Function
PPTX
Introduction to Python Programming
PPTX
Perl slid
PPT
JAVA Variables and Operators
PDF
Core csharp and net quick reference
PPTX
Php & my sql
PDF
Python programming : Control statements
PPT
Perl Intro 7 Subroutines
PPSX
DITEC - Programming with Java
PPT
Php variables
PPTX
F# Console class
PPTX
C# overview part 1
PDF
An Introduction to Object-Oriented Programming (DrupalCamp Leuven 2015)
Chapter27 polymorphism-virtual-function-abstract-class
Python lecture 8
How to get help in R?
types, types, types
C# programming
OO-like C Programming: Struct Inheritance and Virtual Function
Introduction to Python Programming
Perl slid
JAVA Variables and Operators
Core csharp and net quick reference
Php & my sql
Python programming : Control statements
Perl Intro 7 Subroutines
DITEC - Programming with Java
Php variables
F# Console class
C# overview part 1
An Introduction to Object-Oriented Programming (DrupalCamp Leuven 2015)
Ad

Similar to Cross platform native development in f# (20)

PDF
F# and Reactive Programming for iOS
PPTX
F# intro
PPTX
Functional programming with FSharp
PPTX
F sharp _vs2010_beta2
PDF
Functional programming with F#
PPTX
Intro to F#
PPTX
.Net (F # ) Records, lists
ODP
F# 101
PPTX
Sharper tools with F#
PDF
Functional Programming in F#
PPTX
Qcon2011 functions rockpresentation_f_sharp
PPTX
Qcon2011 functions rockpresentation_f_sharp
PPT
F# and the DLR
PDF
Swift Programming Language
PDF
An introduction to functional programming with Swift
PDF
Madrid F# Meetup: Introduction to F#
PPT
Developing iOS apps with Swift
PDF
Workshop Swift
PPT
F# Eye for the C# Guy
PDF
NSCoder Swift - An Introduction to Swift
F# and Reactive Programming for iOS
F# intro
Functional programming with FSharp
F sharp _vs2010_beta2
Functional programming with F#
Intro to F#
.Net (F # ) Records, lists
F# 101
Sharper tools with F#
Functional Programming in F#
Qcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharp
F# and the DLR
Swift Programming Language
An introduction to functional programming with Swift
Madrid F# Meetup: Introduction to F#
Developing iOS apps with Swift
Workshop Swift
F# Eye for the C# Guy
NSCoder Swift - An Introduction to Swift
Ad

More from David Kay (6)

PDF
How to Start a Med Device Startup From Your Garage - Vancouver Edition
PDF
Drag and Drop UI Development with React Native
PDF
Front-end God Mode with Reagent and Figwheel
PDF
Intro to Apache Storm
PDF
App architecture101
PDF
Slaying Bugs with Gradle and Jenkins
How to Start a Med Device Startup From Your Garage - Vancouver Edition
Drag and Drop UI Development with React Native
Front-end God Mode with Reagent and Figwheel
Intro to Apache Storm
App architecture101
Slaying Bugs with Gradle and Jenkins

Recently uploaded (20)

PPTX
Big Data Technologies - Introduction.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPT
Teaching material agriculture food technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Approach and Philosophy of On baking technology
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Modernizing your data center with Dell and AMD
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Network Security Unit 5.pdf for BCA BBA.
Big Data Technologies - Introduction.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Mobile App Security Testing_ A Comprehensive Guide.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Teaching material agriculture food technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Approach and Philosophy of On baking technology
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
The AUB Centre for AI in Media Proposal.docx
20250228 LYD VKU AI Blended-Learning.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Modernizing your data center with Dell and AMD
Dropbox Q2 2025 Financial Results & Investor Presentation
Per capita expenditure prediction using model stacking based on satellite ima...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Unlocking AI with Model Context Protocol (MCP)
Network Security Unit 5.pdf for BCA BBA.

Cross platform native development in f#

  • 2. ?
  • 6. F# Syntax Overview (Several examples are from: F# For Fun and Profit)
  • 7. Basic Values // ======== "Variables" (but not really) ========== // The "let" keyword defines an (immutable) value let myInt = 5 let myFloat = 3.14 let myString = "hello" //note that no types needed // ======== Lists ============ let twoToFive = [2;3;4;5] // Square brackets create a list with // semicolon delimiters. let oneToFive = 1 :: twoToFive // :: creates list with new 1st element // The result is [1;2;3;4;5] let zeroToFive = [0;1] @ twoToFive // @ concats two lists
  • 8. Functions let square x = x * x // Note that no parens are used. square 3 // Now run the function. Again, no parens. let add x y = x + y // don't use add (x,y)! It means something // completely different. add 2 3 // Now run the function. // to define a multiline function, just use indents. No semicolons needed. let evens list = let isEven x = x%2 = 0 // Define "isEven" as an inner ("nested") function List.filter isEven list // FP’s classic filter a la “map/filter/reduce” evens oneToFive // Now run the function
  • 9. Pattern Matching let simplePatternMatch = let x = "a" match x with | "a" -> printfn "x is a" | "b" -> printfn "x is b" | _ -> printfn "x is something else" // underscore matches anything let validValue = Some(99) let invalidValue = None let optionPatternMatch input = match input with | Some i -> printfn "input is an int=%d" i | None -> printfn "input is missing"
  • 10. Data Types - I // Tuple types are pairs, triples, etc. Tuples use commas. let twoTuple = 1,2 let threeTuple = "a",2,true // Record types have named fields. Semicolons are separators. type Person = {First:string; Last:string} let person1 = {First="john"; Last="Doe"}
  • 11. Data Types - II // Union types have choices. Vertical bars are separators. type Temp = | DegreesC of float | DegreesF of float let temp = DegreesF 98.6 // Types can be combined recursively in complex ways. // E.g. here is a union type that contains a list of the same type: type Employee = | Worker of Person | Manager of Employee list let jdoe = {First="John";Last="Doe"} let worker = Worker jdoe
  • 12. Classes type LoginWindowViewModel(overseer: Overseer.Overseer) = inherit ViewModelBase() let mutable username = "" let mutable password = "" member this.Username with get () = username and set (value) = username <- value member this.Password with get () = password and set (value) = password <- value member this.LoginCommand = ViewModelHelpers.createCommand (fun o -> overseer.login (username, password)) (fun _ -> true)
  • 13. Interop // Mostly very great: deviceContext.SoundPlayer.MessageReceived() // Some issues, including null-safety: let x: int option = Some 4
  • 16. MVVM