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
#load "NativeMethod.fsx" | |
open System | |
open System.IO | |
open System.Text | |
open NativeMethod | |
let nullptr = IntPtr.Zero | |
let write (str:string) handle = |
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
// ---------------------------------------------------------------------------------------------------------- | |
// Problem 1 「3と5の倍数」 | |
// ------------------------------- | |
// | |
// 10未満の自然数のうち, 3 もしくは 5 の倍数になっているものは 3, 5, 6, 9 の4つがあり, これらの合計は 23 になる. | |
// 同じようにして, 1000 未満の 3 か 5 の倍数になっている数字の合計を求めよ. | |
// | |
// ---------------------------------------------------------------------------------------------------------- | |
// 通常の解答 / O(N) |
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
using System; | |
namespace Functional | |
{ | |
public static class Curry | |
{ | |
public static Action curry(Action act) => act; | |
public static Action<T> curry<T>(Action<T> act) => act; | |
public static Func<T1, Action<T2>> curry<T1, T2>(Action<T1, T2> act) => t1 => t2 => act(t1, t2); | |
public static Func<T1, Func<T2, Action<T3>>> curry<T1, T2, T3>(Action<T1, T2, T3> act) => t1 => t2 => t3 => act(t1, t2, t3); |