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
[<RequireQualifiedAccess>] | |
module Hanoi = | |
open System.Collections.Generic | |
[<Struct>] | |
type Kind = Tower1 | Tower2 | Tower3 | |
type Commands = seq<Kind * Kind> | |
let solve n: Commands = |
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
(* | |
MIT License | |
Copyright (c) 2023 wraikny | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
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
#r "nuget: FSharp.Quotations.Evaluator" | |
open FSharp.Quotations | |
open FSharp.Quotations.Evaluator | |
let makeSequential (xs: #seq<Expr<unit>>): Expr<unit -> unit> = | |
let body = | |
(<@ () @>) | |
|> Seq.foldBack(fun x s -> <@ %x; %s @>) xs |
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
module DCont = | |
type DCont<'k, 'a> = ('k -> 'a) | |
let inline shift (f: ('b -> 'c) -> 'a): DCont<('b -> 'c), 'a> = f | |
type DContBuilder() = | |
member inline __.ReturnFrom(m): DCont<'k, 'a> = m | |
member inline __.Return(x): DCont<'a -> 'b, 'b> = fun k -> k x | |
member inline __.Bind(x: DCont<'b -> 'c, 'a>, f: 'b -> DCont<'k, 'c>): DCont<'k, 'a> = | |
(fun k -> x (fun g -> (f g) k)) |
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
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
// --- Utils --- | |
const float PI = 3.14159265; | |
vec2 fromRad(float rad) { | |
return vec2( | |
cos(rad), sin(rad) |
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
#!/bin/sh | |
CURRENTFILEPATH=$0 | |
cd ${CURRENTFILEPATH%/*} | |
FILENAME='hoge.exe' | |
MESSAGE_FAILLAUNCH="Failed to command: mono ./$FILENAME" | |
MESSAGE_FILE_NOTFOUND="Game File $FILENAME is not found." |
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
type Model = | |
{ | |
count : int | |
log : int list | |
} | |
// Input Kind | |
type Msg = Add of int | Undo | |
// define function |
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.Collections; | |
using System.Linq; | |
using System.Collections.Generic; | |
using UnityEngine; | |
#if UNITY_EDITOR | |
using UnityEditor; | |
using UnityEditor.SceneManagement; //!< 追加 | |
#endif | |
// 参考: https://qiita.com/sango/items/4b9035c3e75d497f91ef#_reference-00718cd16d3962c60da9 |
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
extern crate colored; | |
extern crate failure; | |
use std::{io, fmt}; | |
use colored::*; | |
fn read_line() -> Result<String, io::Error> { | |
let mut result = String::new(); | |
io::stdin().read_line(&mut result)?; | |
Ok(result) | |
} |