written by mizchi at 小物エンジニアの会.
記述能力の高い Clojure.
よくあるプログラミングの演習問題を Clojure で解いてみます.
<?php | |
/* | |
* SimpleTestのmockサンプル | |
* SimpleTest version 1.0.1 | |
*/ |
# Simple: | |
# a --> b | |
# --> c --> d | |
# --> d | |
graph1 = { | |
"a": ["b", "c", "d"], | |
"b": [], | |
"c": ["d"], | |
"d": [] | |
} |
$ hive -S -e ‘select * from tbl_a limit 100′ > hive_result.txt |
(* 完全数: 自分自身を除く約数の和がその数自身になる *) | |
(* n以下の整数一覧を並べたリスト *) | |
(* enumerate: int -> int list *) | |
let rec enumerate n = if n <= 0 then [] else n :: enumerate (n-1) | |
(* n 以下の完全数をリストで返す *) | |
(* perfect : int -> int list *) | |
let perfect n = | |
let perfectp n = |
import java.io.IOException; | |
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.LinkedList; | |
import java.util.List; | |
import java.util.Map; | |
public class LZ77 { | |
public static void compress1(CharSequence src, Appendable out, int windowSize) | |
throws IOException{ |
If you have installed the standalone Command Line Tools for XCode on your Mac (i.e. without having XCode.app installed), some of these tools can get a bit confused due to a couple of oversights on Apple's part in finalising the setup.
Note: all commands below will need to be run from an Administrator account, or by an account with appropriate permission in /etc/sudoers.
Sometime when compiling against the preinstalled Frameworks (e.g. Ruby or Python), various tools will inexplicable fail to find header files that are quite clearly there. This is caused by the fact that no XCode has been selected for the command-line tools. Wait, I hear you cry, I don't have XCode installed! Indeed, but you nonetheless need to select one, and point it somewhere where the command line tools exist, like so