Skip to content

Instantly share code, notes, and snippets.

View jeremyabbott's full-sized avatar
🧙‍♂️
F# all day

Jeremy Abbott jeremyabbott

🧙‍♂️
F# all day
View GitHub Profile
module SuaveLogging.SuaveExample
open System
open System.IO
open System.Net
open Suave
open Suave.Filters
open Suave.Successful
open Suave.Logging
open System
open System.Net
open Microsoft.FSharp.Control.WebExtensions
// *********************************
// Pipes vs. Composition
// *********************************
// Pipe operator
let sum =
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 =
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
@jeremyabbott
jeremyabbott / ItsFunctionalBro
Last active August 29, 2015 14:22
Get Loop and Tail lengths from Linked List
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>>) =
@jeremyabbott
jeremyabbott / main.fs
Created December 1, 2014 01:11
F# Deserialize
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 }