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 Scratch | |
{ | |
public class Program | |
{ | |
public static void Main() | |
{ | |
JankenTest(); | |
} |
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 Scratch | |
{ | |
public class Program | |
{ | |
public static void Main() | |
{ | |
int[] array = new int[] { 0, 1, 2, 3 }; | |
for (int i = 0; i < 24; i++) |
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
;; 2019-10-26 | |
;;;; 関数をカリー化して定義します。 | |
;; (defn-c add [a b] (+ a b)) が | |
;; (def add (fn [a] (fn [b] (+ a b)))) になります。 | |
(defmacro defn-c [fn-name args body] | |
`(def ~fn-name (fn-c ~args ~body))) | |
(defmacro fn-c [[x & xs :as args] body] | |
(if (empty? args) |
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
# -*- mode: python; coding: utf-8-with-signature-dos -*- | |
# JIS配列をUS配列に変換するかどうか | |
change_JIS_to_US = True | |
## nickname: fakeymacs | |
## | |
## Windows の操作を emacs のキーバインドで行うための設定(Keyhac版)ver.20171103_01 | |
## |
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
(defn iterate* [f x] | |
(if (nil? x) nil | |
(cons x (lazy-seq (iterate* f (f x)))))) | |
(defn iter-perm [v] | |
(let [len (count v) | |
left (loop [i (- len 2)] | |
(cond (< i 0) nil | |
(< (v i) (v (inc i))) i | |
:else (recur (dec i))))] |
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
# coding: utf-8 | |
# 2017-02-04 | |
# kinds種類の物がそれぞれlimit個あった時に | |
# その中からn個取ったときの組み合わせの数を求める関数 | |
# 例えば麻雀の萬子は1~9種類の物がそれぞれ4枚あり | |
# その中から8枚取ったときの組み合わせの数は | |
# f(8,9,4) = 11385 | |
# 参考:上限のある重複組合わせ(?) |
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
# coding: utf-8 | |
# swap([0,1,2], 0, 2) | |
# => [2, 1, 0] | |
def swap(v, n, m) | |
v2 = v.dup | |
v2[m] = v[n] | |
v2[n] = v[m] | |
v2 | |
end |
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
#+sbcl | |
(eval-when (:compile-toplevel :execute) | |
(handler-case | |
(progn | |
(sb-ext:assert-version->= 1 2 2) | |
(setq *features* (remove 'old-sbcl *features*))) | |
(error () | |
(pushnew 'old-sbcl *features*)))) | |
(defun flatten (x) |
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
import System.Environment (getArgs) | |
interactWith function inputFile outputFile = do | |
input <- readFile inputFile | |
writeFile outputFile (function input) | |
main = mainWith myFunction | |
where mainWith fn = do | |
args <- getArgs | |
case args of |
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
# coding: utf-8 | |
# irb(main):037:0> (scheme) | |
# (scheme) | |
# ==> (* 2 (call_cc (lambda (cc) (set! old_cc cc) 4))) | |
# 8 | |
# ==> (old_cc 10) | |
# 20 | |
# ==> (+ 1 (old_cc 10)) | |
# 20 |
NewerOlder