[vi] 開いているファイルのパスを表示する

ViやVimで開いているファイルのパスを知るには、 :ls と入力する。 開いているバッファの一覧とパスが表示される。


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Leave a reply

[NTP] ntpqのreach

NTPのリファレンス実装についてくる ntpq コマンドの -p オプションでは登録した peer の状態が表示される。 remote refid st t when poll reach delay offset jitter ============================================================================== *tok-ntp-ext.asi 17.82.254.14 2 u 576 1024 377 12.519 3.781 2.018 reachに表示されている値は8進数で、1ビットごとにNTPサーバへpollした際の成否を表している。 LSBから順に前回、前々回……と8回前のpollまで成否がわかる。 例えば、前々回のpollが失敗し、それ以外は成功した場合、reachは (11111101)_2 = (375)_8 となる。


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Leave a reply

[Clojure] 合成関数

Clojure で Haskell のドット演算子のように合成関数を得るには clojure.core/comp を用いる。 user=> (filter (comp not nil?) ‘(a nil b nil c nil d)) (a b c d)


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , , | Leave a reply

[Clojure] 空リストか否か

Clojure では nil と空リストは同じではない。 (= nil ‘()) => false よって、再帰の停止条件などでは空リストか否かを返す述語 empty? を使う。 (defn sum [lst] (if (empty? lst) 0 (+ (first lst) (sum (rest lst)))))


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , , | Leave a reply

[csh] 入力中の前後2文字を入れ替える

csh系のシェルでは、Ctrl-t とすると、カーソル位置とその一つ前の文字を入れ替えることができる。 たとえば、 % sl と入力した後で、Ctrl-tを入力すると、 % ls となる。


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , , , , , , | Leave a reply

[Haskell] 『すごいHaskell たのしく学ぼう!』13.6節の演習

『すごいHaskell たのしく学ぼう!』の13.6節ではリストモナドによる非決定性計算を使ってチェスのナイトが3手で指定したマスに到達できるかを計算する関数が紹介された。 ghci> (6, 2) `canReachIn3` (6, 1) True のように始点と終点を指定すると到達の可否がかえってくる。 節尾の演習にどのように到達できるか教えてくれるようにせよとあったので書いてみる。 import Monad type KnightPos = (Int, Int) type KnightTrack = [KnightPos] moveKnight :: KnightTrack -> [KnightTrack] moveKnight ((c, r) : xs) = map addLog $ filter onBoard [(c+2,r-1), (c+2,r+1), Continue reading [Haskell] 『すごいHaskell たのしく学ぼう!』13.6節の演習


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Leave a reply

[Lisp] Common LispとSchemeの関数対応表

Common Lispの関数やマクロと対応する機能を持つSchemeの手続きや構文を表にまとめる. 随時更新. Common Lisp Scheme 備考 atom なし (not (pair? obj))を使う consp pair? dolist for-each 記法は異なる mapcan append-map!  SRFI 1 mapcar map multiple-value-bind receive SRFI 8, library syntax null null? nth list-ref nthcdr list-tail SRFI 1ではdrop progn begin rplaca set-car! Continue reading [Lisp] Common LispとSchemeの関数対応表


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , , , | Leave a reply

[コマンド] rlwrap

GNU Rreadlineライブラリは入力の際の便利な機能を提供するライブラリ。これを使用したプログラムでは、入力の際にシェルのようなEmacsキーバインドでの移動や、履歴の呼び出し、カッコの対応の表示などの機能が使えるようになる。 rlwrapはreadlineを使用していないプログラムでもreadlineが使えるように入力をラップするコマンド。 http://utopia.knoware.nl/~hlub/rlwrap/ から入手できる。FreeBSDではportsにあった。 特にLispのREPLではカッコの対応がすぐわかってうれしい。


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , , , , | Leave a reply

[並行計算][Scheme][Racket] SRFI 18のmutexとcondition variable

RacketはSRFI 18に対応していることになっているが、mutex-lock!やcondition-variable-signal!などどの手続きはrequireしても定義されない。 mutexやcondition variableのような同期機構ではなく、チャネル通信などの機構を使えということなのだと思うが、ロックを使ったほうが素直に実装できる場合もある。 幸いセマフォはあるようなので、セマフォでmutexやcondition variableを次のように書いた。 ;;; mutex (define (make-mutex) (make-semaphore 1)) (define (mutex-lock! m) (semaphore-wait m)) (define (mutex-unlock-primitive! m) (semaphore-post m)) (define (mutex-unlock! m . rest) (let ((condvar (if (null? rest) #f (car rest)))) (mutex-unlock-primitive! m) (when condvar (condition-variable-wait! Continue reading [並行計算][Scheme][Racket] SRFI 18のmutexとcondition variable


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , , , , , , | Leave a reply

[Scheme][Racket] set-car! set-cdr! が使えない

racket コマンドで起動した Racket では set-car! や set-cdr! が定義されていなかった。 調べてみると Racket ではペアへの破壊的な代入を許さないらしい。 代わりに mcons というデータ構造が用意されていてこちらは set-mcar! や set-mcdr! といった手続きで代入ができる。 R5RS に基づいて書かれた Scheme のプログラムを動かすにはペアを扱う手続きを mcons を使うものに定義し直す必要があるが、すでにそれをするパッケージが用意されている。 > (require r5rs) とすると、set-car! や set-cdr! が定義され、cons で作ったペアに再代入できる。 参考: Getting rid of set-car! and set-cdr!


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , , | Leave a reply