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 cycle x = Seq.initInfinite (fun _ -> x) |> Seq.concat | |
| let zipWith f xs ys = Seq.zip xs ys |> Seq.map (fun (x,y) -> f x y) | |
| let fizz = seq ["";"";"fizz"] |> cycle | |
| let buzz = seq ["";"";"";"";"buzz"] |> cycle | |
| let bang = seq ["";"";"";"";"";"";"bang"] |> cycle | |
| let boom = seq ["";"";"";"";"";"";"";"";"";"";"boom"] |> cycle | |
| let numbers = seq [1 .. 115] |> Seq.map string | |
| let fizzBuzz3 = zipWith (+) bang boom | |
| |> zipWith (+) buzz |
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 genFB (v: int, s: string) = | |
| fun (n, os) -> | |
| match n%v with | |
| | 0 -> (n, os+s) | |
| | _ -> (n, os) | |
| let getStr (v: int, s: string) = | |
| if (String.length s > 0) then s else sprintf "%i" v | |
| let fizzbuzz max = |
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 fizzbuzz2 rules n = | |
| rules | |
| |> List.choose | |
| (fun (k, s) -> | |
| match n % k with | |
| | 0 -> Some s | |
| | _ -> None ) | |
| |> function | |
| | [] -> sprintf "%d" n | |
| | e -> List.reduce (+) e |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Reactive.Linq; | |
| using System.Text.RegularExpressions; | |
| namespace SplitObservableTest | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) |