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
[user] | |
name = jnm2 | |
email = [email protected] | |
[core] | |
pager = cat | |
autocrlf = true | |
editor = 'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin | |
[fetch] | |
prune = true | |
[alias] |
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
public static class Extended { | |
public static IObservable<TSource> Amb<TSource>(this IObservable<IObservable<TSource>> source) { | |
return Observable.Create<TSource>(o => { | |
int first = -1; | |
return source.TakeWhile(_ => first == -1) | |
.Select((el, c) => el | |
.DoFirst(1, _ => Interlocked.CompareExchange(ref first, c, -1)) | |
.TakeWhile(_ => first == c)) | |
.Merge().Subscribe(o); |
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
(defn fold_ [f initial [head & the-rest :as arr]] | |
(cond | |
(empty? arr) initial | |
:else (recur f (f initial head) the-rest))) | |
(defn map_ [f arr] | |
(let [applyF (fn [previous current] (conj previous (f current)))] | |
(fold_ applyF [] arr))) | |
(defn filter_ [predicate arr] |