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
[ plaster@cymbal:~ ] | |
% sudo apt-get build-dep dash | |
[sudo] plaster のパスワード: | |
パッケージリストを読み込んでいます... 完了 | |
パッケージリストを読み込んでいます... 完了 | |
依存関係ツリーを作成しています | |
状態情報を読み取っています... 完了 | |
アップグレード: 0 個、新規インストール: 0 個、削除: 0 個、保留: 0 個。 | |
[ plaster@cymbal:~ ] | |
% fakeroot |
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
factorize :: Integer -> [ Integer ] | |
factorize n = factorize' n $ takeWhile (\x -> x * x <= n) [ 2 .. n ] where | |
factorize' n [] = case n of | |
1 -> [] | |
_ -> [n] | |
factorize' n ds@(d:ds') = case n `mod` d of | |
0 -> d : factorize' (n `div` d) ds | |
_ -> factorize' n ds' | |
main = interact $ show . factorize . read |
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
-- 4回readしたいけどこれで正しいか?もしくはもっとシンプルな書き方があるか? | |
parse :: String -> (Int, Int, Int, Int) | |
parse s = (c1, p1, c2, p2) where | |
[(c1, s')] = readsPrec 10 s | |
[(p1, s'')] = readsPrec 10 s' | |
[(c2, s''')] = readsPrec 10 s'' | |
[(p2, s'''')] = readsPrec 10 s''' |
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
a :: Int | |
b :: Int | |
c :: Int | |
c = a + b | |
a = 5 | |
b = 7 | |
main = print c |
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
use utf8; | |
use strict; | |
use IO::File; | |
use IPC::Open2; | |
my $ifh0 = IO::Handle->new; | |
my $ifh1 = IO::File->new_tmpfile; | |
my $ofh0 = IO::Handle->new; | |
my $pid0 = open2($ifh0, $ofh0, qw(cat -n)); |
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
use utf8; | |
use strict; | |
use IO::File; | |
use IPC::Open2; | |
my $ofh = IO::File->new_tmpfile; | |
for (my $i = 1; $i < 20; ++$i) { | |
print $ofh ('x' x $i), "\n"; | |
} |
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
#!/usr/bin/env gosh | |
(for-each (.$ display ucs->char length) | |
'#0=(#1=(#0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0# . | |
#2=(#0##0##0##0##0##0##0##0##0##0##0# . | |
#3=(#0# . #4=(#0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0# . #0#)))) | |
#5=(#0# . #6=(#0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0##0# . #1#)) | |
#7=(#0##0##0##0##0##0##0# . #5#) | |
#7##8=(#0##0##0# . #7#) | |
#2##4##9=(#0##0##0##0##0# . #10=(#0##0##0# . #8#)) #8##10##7##6##3#)) |
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
type FizzBuzz = Either Int String | |
hit :: String -> FizzBuzz -> FizzBuzz | |
hit s (Left _) = Right s | |
hit s (Right s') = Right $ s ++ s' | |
fizz :: [ FizzBuzz -> FizzBuzz ] | |
fizz = cycle [ id, id, hit "fizz" ] | |
buzz :: [ FizzBuzz -> FizzBuzz ] | |
buzz = cycle [ id, id, id, id, hit "buzz" ] | |
fizzbuzz :: [ FizzBuzz -> FizzBuzz ] |
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
% gosh -V | |
Gauche scheme shell, version 0.9.3 [utf-8,pthreads], x86_64-unknown-linux-gnu | |
% gosh precomp -e -P -o even--odd even-odd.scm |
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
--- a/src/mzscheme/src/bool.c Sat Jun 01 00:04:45 2013 +0900 | |
+++ b/src/mzscheme/src/bool.c Sat Jun 01 00:12:44 2013 +0900 | |
@@ -124,6 +124,9 @@ | |
return SAME_OBJ(obj1, obj2); | |
} | |
+#ifdef MZ_XFORM | |
+START_XFORM_SKIP; | |
+#endif | |
XFORM_NONGCING static MZ_INLINE int double_eqv(double a, double b) |