yaotti's diary

Software is Eating the World

2008-04-01から1ヶ月間の記事一覧

emacsで簡単に関数リファレンスを見る

1. http://www.gnu.org/software/libc/manual/ の一番下のTexinfoをダウンロード&解凍(tar -zxvf libc-texti.tar.gz) (libc = Linux C Library) 2. makeinfo libc-texinfo 3. できたファイルを~/infoなどに置き、以下を.emacsに追加 (require 'info) (setq I…

C言語のポインタ

c

ポインタ理解しようとがんばってます。 以下がなぜかエラー(bus error)になる。 #include <stdio.h> main(int argc, char *argv[]) { int a[10]; int *p; a[0] = 1; *p = 1; /* pの指す先に1を指定、なはず */ //p = 1; /* これはアドレスとして1を指定するのでおかし</stdio.h>…

CarbonEmacsアップデート

したら.emacsまわりでエラー。 どうやら元にしたソースがemacs21.5→22になってるらしい。結構違いがありそう。 現在調査中。[追記] 原因は/Application/Emacs.app/以下にelisp置いてたせいだった。 そらだめでしょうということで~/.emacs.d/以下に自分で追加…

SICP読書会&異業種交流会

SICP読書会と異業種交流会に行ってきました。 SICP読書会 読書会は今回が第一回でした。個人的にも初めての勉強会。 主催者のid:snow-bellお疲れさまです。 関西でSICP読書会が開かれるとは。snow-bell++ 今日は13ページぐらいまで。ニュートン法に入るかど…

Gaucheで今日理解したこと

ちょっとしかしてないけど。モジュールニツイテ (use gauche.interactive) (apropos 'module) てやるとわかるんだけど、 (all-modules) (current-module) なんていう関数がある。 それぞれ、 現在存在するすべての名前つきモジュールのリスト コンパイル時の…

Terminal内でCarbonEmacs

mac

nwオプションを付けて起動する。 /Application/Emacs/hogehoge/Emacs -nwこれでpartty.orgでEmacsのコーディングを保存できる。ただ、 Metaキーとしてcmdが使えない。 色が気持ち悪い これはなんとかしないと。

listとquoteの違い

(find (cut eq? '+ <>) (list '+ '- '* '/)) (find (cut eq? '+ <>) '('+ '- '* '/)) この2つ、挙動が違う。 上は+が返ってきて、下は#fが返る。 なんでかなーと思って調べたところ、 gosh>(list 'a 'b) (a b) gosh>'('a 'b) ('a 'b) quoteだと中身は評価さ…

逆ポーランド記法で計算

(define (re-polish args) (let1 operators (list '+ '- '* '/) (define (iter rest-args stack) (cond [(null? rest-args) (car stack)] [(number? (car rest-args)) (iter (cdr rest-args) (append stack (list (car rest-args))))] [(find (cut eq? (car …

K&R読み始めました

c k&r

カーニハン&リッチーのプログラミング言語Cを読み始めた。 プログラミング言語C 第2版 ANSI規格準拠作者: B.W.カーニハン,D.M.リッチー,石田晴久出版社/メーカー: 共立出版発売日: 1989/06/15メディア: 単行本購入: 24人 クリック: 606回この商品を含むブロ…

ProjectEuler

登録してみた。 http://projecteuler.net/index.php とりあえず2問だけ解いた。 使用言語はGauche。 Cとかで書けるようになりたい>< Problem 1 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum…

Emacsで好きなshellを使う

emacsのshell/eshellが合わないという人に。 M-x term→shellのパス打ってreturn これだけ。 "*terminal*"バッファができて、指定したshellで作業できる。 treeコマンドで展開すると普段知らないmodeをいっぱい見つけられておもしろい。

世界のナベアツ的なもの

3の倍数と3が含まれる数のときだけpiyopiyoする。 (use srfi-1) (define (contain-tree? num) (find (cut eq? #\3 <>) (string->list (number->string num)))) (define (nabeatsu n) (map (lambda (x) (if (or (= (modulo x 3) 0) (contain-tree? x)) 'piyop…

ターミナルからtwitterへポストするgaucheスクリプト

かいた。 #!/usr/local/bin/gosh (use rfc.http) (use rfc.base64) (define (main args) (let* ((username (cadr args)) (passwd (caddr args)) (status (cadddr args)) (basic-info (string-append "Basic " (base64-encode-string (string-append username…