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
var pipeline = Pipeline | |
.Empty<int>() | |
.Next(next => value => { Console.WriteLine(value); next(value); }) | |
.Next(next => value => { Console.WriteLine(value+1); next(value); }) | |
.Build(); | |
pipeline(1); | |
public static class Pipeline | |
{ |
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
namespace Application | |
{ | |
public static class YComb<T,R> | |
{ | |
delegate Func<T,R> Y(Lambda x); | |
delegate Func<T, R> Rec(Rec rec); | |
public delegate Func<T,R> Lambda(Func<T,R> rec); |
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; | |
namespace TailRecursive | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var f = SyncTailCall<int,int> | |
.As((me, item) => |
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; | |
namespace RecAgain | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var factorial = YComb.Fix<int, int>(f => val => val > 1 ? val * f(val - 1) : 1); | |
var factorial2 = YComb.FixStack<int, int>(f => (acc, val) => val > 1 ? f(acc * val, val - 1) : acc, 1); |
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
//npm install mongodb | |
//npm install edge | |
//npm install edge-sql | |
//npm install rx | |
//npm install wellknown | |
//Set the connection string as an environment variable (your connection string may be different): | |
//with powershell: $env:EDGE_SQL_CONNECTION_STRING="Data Source=localhost;Initial Catalog=Db;Integrated Security=True" | |
//and finally | |
//node geo-sql-to-mongo.js |
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
open System.Collections.Generic | |
printfn "\nfib recursive" | |
let rec fib n = if n > 1 then fib(n-1) + fib(n-2) else n | |
[1..10] |> Seq.iter(fun n -> | |
printfn "fib(%d)= %d" n (fib(n))) | |
printfn "\nlambda fib -> rec y comb" | |
let lambdafib fib n = if n > 1 then fib(n-1) + fib(n-2) else n |
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
(* Copyright © 2014 G Roberts. All Rights Reserved *) | |
namespace MiniForum.Model | |
open System | |
open System.Threading.Tasks | |
open MiniForum | |
open MiniForum.Model | |
open Fredis |
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
1. FOR XML RAW('Customer'), ROOT('Customers') | |
-> rows are node xml elements with <Customer ColumnName="ColumnValue" /> | |
-> columns are attributes | |
-> root is customers | |
2. FOR XML ROW('Customer'), ROOT('Customers'), ELEMENTS | |
-> columns are xml elements | |
3. FOR XML ROW('Customer'), ROOT('Customers'), ELEMENTS XSINIL |
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
WITH RunningTotals AS | |
( | |
SELECT custid, orderid, orderdate, val, | |
SUM(val) OVER(PARTITION BY custid | |
ORDER BY orderdate, orderid | |
ROWS BETWEEN UNBOUNDED PRECEDING | |
AND CURRENT ROW) AS runningtotal | |
FROM Sales.OrderValues | |
) | |
SELECT * |
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
SELECT orderid, orderdate, custid, empid | |
FROM Sales.Orders | |
ORDER BY orderdate DESC, orderid DESC | |
OFFSET 50 ROWS FETCH NEXT 25 ROWS ONLY; |
NewerOlder