Skip to content

Instantly share code, notes, and snippets.

[<CompiledName("Scan")>]
let scan<'T,'State> f (z:'State) (source : seq<'T>) =
checkNonNull "source" source
let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(f)
seq { let zref = ref z
yield !zref
use ie = source.GetEnumerator()
while ie.MoveNext() do
zref := f.Invoke(!zref, ie.Current)
yield !zref }
@pmwhite
pmwhite / KeyWatchTextBox.cs
Created May 20, 2015 19:27
A textbox that fires an event whenever a specified key is pressed.
using System;
using Windows.System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
class KeyWatchTextBox : TextBox
{
public event EventHandler WatchKeyPressed;