2003-06-01から1ヶ月間の記事一覧

units count

units = [1, 5, 10, 50, 100, 500, 1000, 2000, 5000, 10000] def cnt(units, amount): if len(units) == 1: print "%10d : %d\n" % ( units[0], int(amount / units[0]) ) return amount % units[0] else: return cnt(units[:1], cnt(units[1:], amount)) i…

range

(define (range a b) (if (

(display "Hello world") (newline)

reference

# let num = ref 0;; val num : ref int = 0 # !num;; - : ref int = 0 # num := 10;; - : unit() # !num;; - : ref int = 10

#include using namespace std; int main(void){ cout

class HelloWorld{ public static void main(String[] argv){ System.out.println("Hello world"); } }

Ocaml

let 'a btree = Empty | Node of 'a * 'a btree * 'a btree;; let rec member x btree = match btree with Empty -> false | Node(y, left, right) -> if x = y then true else if x Node(x, Empty, Empty) | Node(y, left, right) -> if x

print_string "Hello world\n";;

#!/usr/bin/python if __name__ == '__main__': print "Hello, world" メイン関数はなくてもいいけど、 もし書くとしたら、以下の記事を参照。 Python main() functions>http://www.artima.com/weblogs/viewpost.jsp?thread=4829

#!/usr/bin/ruby puts "Hello world";

The Zen of Python http://www.artima.com/intv/prodperf.html Hacking and Refactoring http://www.artima.com/weblogs/viewpost.jsp?thread=5342 agile開発とオープンソース・ムーブメントについて。

#!/usr/bin/perl print "Hello world\n";

一日一個 hello world プログラムを、 いろんなプログラミング言語で実装してみる。いつまで続くかなぁ。 #include #include int main(void){ puts("Hello world"); return EXIT_SUCCESS; }