Skip to content

Instantly share code, notes, and snippets.

View voronoipotato's full-sized avatar

Alan Ball voronoipotato

  • NC
View GitHub Profile
#r "WindowsBase"
#r "PresentationCore"
#r "PresentationFramework"
open System.Windows
open System.Windows.Controls
type Action =
| Increment
@voronoipotato
voronoipotato / Memoize.fs
Created April 2, 2018 14:11
Decent Memoize function in F#
let memoize f =
let cache = ref Map.empty
fun x ->
match (!cache).TryFind(x) with
| Some res -> res
| None ->
let res = f x
cache := (!cache).Add(x,res)
res
// Learn more about F# at http://fsharp.org
open Microsoft.ML
open Microsoft.ML.Runtime.Api
open Microsoft.ML.Trainers
open Microsoft.ML.Transforms
open System
//The first four properties are inputs, the label is what you are predicting which is set in training
type IrisData() =
[<Column("0")>] [<DefaultValue>]
@voronoipotato
voronoipotato / generate_series.sql
Created July 26, 2018 21:54 — forked from sebastianwebber/generate_series.sql
SQL Server generate_series
-- http://blog.jooq.org/2013/11/19/how-to-create-a-range-from-1-to-10-in-sql/
IF EXISTS (SELECT *
FROM dbo.sysobjects
WHERE id = object_id (N'[dbo].[generate_series]')
AND OBJECTPROPERTY(id, N'IsTableFunction') = 1)
DROP FUNCTION [dbo].[generate_series]
GO
CREATE FUNCTION [dbo].[generate_series] ( @p_start INT, @p_end INT)
open System.IO
open System.Text.RegularExpressions
//__SOURCE_DIRECTORY__ is a keyword that represents the working directory in the commandline
let sourceDirectory = __SOURCE_DIRECTORY__
let fileNames = Directory.GetFiles sourceDirectory
printf "%s" sourceDirectory
//Source http://matthewrayfield.com/articles/animating-urls-with-javascript-and-emojis/#%F0%9F%95%9B
var f = ['🌑', '🌒', '🌓', '🌔', '🌕', '🌖', '🌗', '🌘'];
function loop() {
location.hash = f[Math.floor((Date.now()/100)%f.length)];
setTimeout(loop, 50);
}
loop();

Note: This documentation is the specification of version 4.1 of the F# language, released in 2015-16.

Note: thi does not yet incorporate the RFCs for F# 4.1, see

https://github.com/fsharp/fslang-design/tree/master/FSharp-4.1

https://github.com/fsharp/fslang-design/tree/master/FSharp-4.1b

Discrepancies may exist between this specification and the 4.1 implementation. Some of these are noted as comments in this document. If you find further discrepancies please contact us and we will gladly address the issue in future releases of this specification. The F# team is always grateful for feedback on this specification, and on both the design and implementation of F#. You can submit feedback by opening issues, comments and pull requests at [https://github.com