Skip to content

Instantly share code, notes, and snippets.

View robertpi's full-sized avatar

Robert Pickering robertpi

View GitHub Profile
@robertpi
robertpi / gist:2964793
Created June 21, 2012 09:18
F# record implementing an interface
namespace MyNamespace
type IMyInterface =
abstract GetValue: unit -> string
type MyRecord =
{ MyField1: int
MyField2: string }
interface IMyInterface with
member x.GetValue() = x.MyField2
// Microsoft (R) .NET Framework IL Disassembler. Version 4.8.3928.0
// Copyright (c) Microsoft Corporation. All rights reserved.
// Metadata version: v4.0.30319
.assembly extern System.Runtime
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
@robertpi
robertpi / solverFoundationSudoku.fs
Created December 12, 2010 11:38
A solves sudoku puzzels using Microsoft Solver Foundation and F#.
open Microsoft.SolverFoundation.Services
open Microsoft.SolverFoundation.Common
open System.Collections.Generic
open Microsoft.SolverFoundation.SfsWrapper
// helper functions for grouping elements of the solution
let flatten (matrix:'a[,]) = matrix |> Seq.cast<'a> |> Seq.toArray
let getColumn c (matrix:_[,]) =
flatten matrix.[*,c..c]
-- Installing: /coreclr/bin/Product/Linux.x64.Debug/bin/libnativelibrary.so
CMake Error at tests/src/readytorun/tests/cmake_install.cmake:42 (file):
file INSTALL cannot copy file
"/coreclr/bin/obj/Linux.x64.Debug/tests/src/readytorun/tests/libnativelibrary.so"
to "/coreclr/bin/Product/Linux.x64.Debug/bin/libnativelibrary.so".
Call Stack (most recent call first):
tests/src/readytorun/cmake_install.cmake:37 (include)
tests/cmake_install.cmake:53 (include)
cmake_install.cmake:43 (include)
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
open System
open System.Data.SqlClient
open System.IO
open System.Text.RegularExpressions
type BlogPost =
{ Id: int
Title: string
Date: DateTime
Text: string }
alert(0);
// this roll why function seems to work on a small 5 x 5 matrix
// but doesn't for bigger 227 x 227 image
// no idea why
let rollArrayY yLength shift (data:'t[]) =
let shift =
if shift > 0 then
shift
else
yLength + shift
let out:'t[] = Array.zeroCreate data.Length