This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "../../packages/FSharp.Data/lib/net40/FSharp.Data.dll" | |
#r "System.Xml.Linq.dll" | |
open FSharp.Data | |
let base_url = "http://fsharp.github.io" | |
type HTML = HtmlProvider<"http://fsharp.github.io/FSharp.Data/index.html"> | |
let html = HTML.GetSample() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pipe(data, ...) | |
local n = select("#", ...) | |
if n == 0 then | |
return data | |
else | |
local funs = {...} | |
local f = table.remove(funs, 1) | |
return pipe(f(data), unpack(funs)) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Defining some Maybe values... | |
-- These could just as well have been database lookups or something else | |
x : Maybe Nat | |
x = Just 42 | |
y : Maybe String | |
y = Just "hello idris" | |
z : Maybe Nat | |
z = Just 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Attempting to implement my own Maybe monad using the Option type naming from F# | |
data Option x = None | |
| Some x | |
Monad Option where | |
(>>=) = ?stuff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Attempting to implement my own Maybe monad using the Option type naming from F# | |
data Option x = None | |
| Some x | |
Applicative Option where | |
pure = ?stuff1 | |
(<*>) = ?stuff2 | |
Monad Option where | |
(>>=) = ?stuff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Attempting to implement my own Maybe monad using the Option type naming from F# | |
data Option x = None | |
| Some x | |
Functor Option where | |
map = ?stuff3 | |
Applicative Option where | |
pure = ?stuff1 | |
(<*>) = ?stuff2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Attempting to implement my own Maybe monad using the Option type naming from F# | |
data Option x = None | |
| Some x | |
Functor Option where | |
map f None = None | |
map f (Some x) = Some (f x) | |
Applicative Option where | |
pure = ?stuff1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Attempting to implement my own Maybe monad using the Option type naming from F# | |
data Option x = None | |
| Some x | |
Functor Option where | |
map f None = None | |
map f (Some x) = Some (f x) | |
Applicative Option where | |
pure x = Some x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Attempting to implement my own Maybe monad using the Option type naming from F# | |
data Option x = None | |
| Some x | |
Functor Option where | |
map f None = None | |
map f (Some x) = Some (f x) | |
Applicative Option where | |
pure x = Some x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test om ipython virker... | |
print("hello world") | |
# lav en liste af værdier mellem 1 og 10 | |
list(range(1, 10)) | |
# lav en anonym funktion | |
min_funktion = lambda x: x + 3 | |
# kald den anonyme funktion |
OlderNewer