This file contains hidden or 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
open System.Net.Http | |
open System.Net.Http.Formatting | |
open Newtonsoft; | |
// Learn more about F# at http://fsharp.net | |
// See the 'F# Tutorial' project for more help. | |
[<CLIMutable>] | |
type Movie = { | |
ID : int; | |
Name : string } |
This file contains hidden or 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
open System.Text.RegularExpressions; | |
let buildList args = | |
Regex.Matches(args, "(\d\,\s?\d)") | |
|> Seq.cast<Match> | |
|> Seq.map (fun m -> m.Value.Replace(" ", "").Split([|','|])) | |
|> Seq.toList | |
let findDuplicatePointer list = | |
let rec findCycleRec (oldList:list<array<string>>) (newList:list<array<string>>) = |
This file contains hidden or 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
open System | |
let getLyrics (input : string) (matchString : string) = | |
input.Split([|matchString|], StringSplitOptions.RemoveEmptyEntries) | |
|> Array.reduce (fun acc item -> sprintf "%s %s" acc item) | |
[<EntryPoint>] | |
let main argv = | |
printfn "%A" (getLyrics "WUBWUBWUBIWUBAMWUBWUBXWUBWUBWUB" "WUB") | |
0 // return an integer exit code |
This file contains hidden or 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
let findDuplicateLetter list = | |
let rec findDuplicate list item = | |
match list with | |
| [] -> "No duplicates were found" | |
| x::xs when item = x -> x | |
| x::xs -> findDuplicate xs x | |
findDuplicate (List.sort list) "" | |
[<EntryPoint>] | |
let main argv = |
This file contains hidden or 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
open System | |
open System.Net | |
open Microsoft.FSharp.Control.WebExtensions | |
// ********************************* | |
// Pipes vs. Composition | |
// ********************************* | |
// Pipe operator | |
let sum = |
This file contains hidden or 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
module SuaveLogging.SuaveExample | |
open System | |
open System.IO | |
open System.Net | |
open Suave | |
open Suave.Filters | |
open Suave.Successful | |
open Suave.Logging |
This file contains hidden or 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
type Result<'a> = | |
| Success of 'a | |
| Failure of string | |
let parseInt x = | |
try | |
System.Int32.Parse(x) |> Success | |
with ex -> ex.Message |> Failure | |
parseInt "hello" |
This file contains hidden or 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
(* | |
I think I understand apply! | |
Apply is a function that takes an elevated multi parameter functions and partially applies it for you. | |
*) | |
//For example: | |
// usage: printfn "%s" <| sayGood "morning" "Clément" | |
let sayGood = sprintf "Good %s %s" // string -> string -> string |
This file contains hidden or 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
// ts2fable 0.5.2 | |
module rec Firebase | |
open System | |
open Fable.Core | |
open Fable.Import.JS | |
type [<AllowNullLiteral>] IExports = | |
abstract EmailAuthProvider: EmailAuthProviderStatic | |
abstract EmailAuthProvider_Instance: EmailAuthProvider_InstanceStatic |
This file contains hidden or 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
let now () = System.DateTime.Now | |
let someOtherWork times = async { | |
let rec inner' times current = async { | |
if times = current then | |
printfn "someOtherWork FINISHED" | |
else | |
do! Async.Sleep 1000 | |
let next = current + 1 | |
printfn "someOtherWork step %d @ %s" next (now() |> string) |
OlderNewer