Home > Study Note
Study Note Archive
プログラミング Gauche – Chapter 4 and 5
- 2010-01-31 (Sun)
- Gauche | Study Note
さてつまみ食いで読み進めてきた プログラミング Gauche ですが、Emacs にもなれてきたし、最初から順に読み直してみようかと思いました。
Chapter 4
以下の Elisp を .emacs.el に追加しました。gosh は確かに Emacs 内から起動した方が便利な感じがしますね。というか gosh を rlwrap する shellscript を書くべきなんですね。
(setq scheme-program-name "gosh -i")
(autoload 'scheme-mode "cmuscheme" "Major mode for Scheme." t)
(autoload 'run-scheme "cmuscheme" "run an iferior Scheme process." t)
(defun scheme-other-window ()
"Run scheme on other window"
(interactive)
(switch-to-buffer-other-window
(get-buffer-create "*scheme*"))
(run-scheme scheme-program-name))
(define-key global-map "\C-cs" 'scheme-other-window)
Scheme mode 用のキーストロークで僕がメモを取ったのは以下です。普通のカーソル移動の C-a は行ベースで移動しますが、M-C-a では S式ベースで移動します。面白いですね。
C-x C-e |
scheme-send-last-sexp |
Send the previous sexp to the inferior Scheme process. |
C-c C-e |
scheme-send-definition |
Put the end of the buffer at the bottom of the window. |
C-c C-r |
scheme-send-region |
Display start of this batch of interpreter output at top of window. Sets mark to the value of point when this command is run. |
C-c C-l |
scheme-load-file |
Load a Scheme file FILE-NAME into the inferior Scheme process. |
M-C-f |
forward-sexp |
|
M-C-b |
backward-sexp |
|
M-C-a |
beginning-of-defun |
|
M-C-e |
end-of-defun |
|
M-C-d |
down-list |
|
M-C-u |
backward-up-list |
|
M-C-t |
transpose-sexps |
Chapter 5
シェルから直接立ち上がる Scheme を作る場合は以下のようにして、shebang をつけるのと、文字エンコードのヒントを入れておくといいらしい。
#!/usr/local/bin/gosh ;; -*- codeing: utf-8 -*- (define (main args) (print (string-join (cdr args) "\u3042")) 0)
定番の fizzbuzz は以下のようになりました。
(use srfi-1)
(define (fizz-buzz max)
(define (check-num x)
(cond [(zero? (modulo x 15)) 'FizzBuzz]
[(zero? (modulo x 5)) 'Buzz]
[(zero? (modulo x 3)) 'Fizz]
[else x]))
(map check-num (iota max 1)))
- Comments: 0
- Trackbacks: 0
090823: learn
diretory の比較 on Unix
Wordpress をアップデート。いつも忘れてしまう diretory の比較。普段は Changes.app などという Mac OS X の GUI アプリを使ってしまって、いっこうに覚えなかった…
How To Compare Directories in Unix
$ diff --recursive --brief /tmp/dir1 /tmp/dir2
Files /tmp/dir1/dir11/file12 and /tmp/dir2/dir11/file12 differ
Files /tmp/dir1/file1 and /tmp/dir2/file1 differ
Only in /tmp/dir1: file2
Only in /tmp/dir2: file3
これを応用すると、例えば dir1 にだけ存在するファイルは
$ diff --recursive --brief /tmp/dir1 /tmp/dir2 | grep '^Only \/tmp\/dir1'
とすればよいですね。
emacs で major mode を変える
例えば .html なファイルを emacs で開くとほぼおそらく HTML mode で開かれると思います。でも実は内部の JavaScript を編集したいし、js2-mode (JavaScript-IDE) で編集したい。凄い基本ですがしばらく emacs を触ってないで忘れてしまっていました。
M-x js2-mode
でした。
またこれから emacs 勉強記録をつけていきたいと思います。今日はどうやってコピーするのか忘れてましたが (M-w Copy / C-w Cut / C-y Paste) それさえわかれば、それなりに使えrて結構びっくりした。
- Comments: 0
- Trackbacks: 0
Mandarin Podcast listening.
- 2008-07-01 (Tue)
- Mandarin | Study Note
I started to listen to podcast programs for Mandarin Chinese several month ago. I was trying to find on iTunes store amd listened to a few of them. And right now I still listen to Mandarin Chinese Lesson with Serge Melnyk and World Learner Chinese.
World Learner Chinese
They have three styles of lessons. But I only listen to Vocabulary note book, which two people just keep mumbling for like 10 to 20 words with tone. You know, Mandarin is the most well-known Tonal Lanauge. Me as a Japanese, I have a lot of fundamental knowledge of Chinese Characters by naturally. It’s easier for me to read and write than most of Americans, but Tone is still very difficult. I told my friend about how World Learner Chinese do the session a few days ago. It goes like this:
- (Chinese Native Girl’s voice) 怎麼樣
- (English Native Man’s voice) What’s up?
- (Girl’s voice) zěn
- (Man’s voice) Third tone
- (Girl’s voice) me
- (Man’s voice) Neutral tone
- (Girl’s voice) yàng
- (Man’s voice) Fourth tone
For each session, they do around 10 to 20 words and do it for three rounds, around 20 minutes. My friend asked me would it be a bit sleepy? I said no. I need to listen carefully.
Mandarin Chinese Lesson with Serge Melnyk
I really like this. At very beginning, the teacher Melnyk 老師 has kind of characteristic way of speech, and that was a little bit disturbing me. But I like the way he does and the way he prepares. I even started the premium subscription ($60/half years) in order to get Lesson transcript. But I would say this is very helpful. For each lesson transcript, he has both Traditional (繁体字) and Simplified (简体字). And the most importantly, Melnyk 老師 is still doing it.
So, from now on, I tried to write a lesson review, every time I listed to the lesson.
Lessonn 31: How does it taste/smell?
vocabulary
| 英文 | 漢字 | 拼音 |
|---|---|---|
| [noun] taste / smell | 味道 | we4i da4o |
| [measurement word] dish | 道 | da4o |
| [adj] sweet | 甜 | tia2n |
| [adj] salty | 咸 | xia2n |
| [adj] sour | 酸 | sua1n |
| [adj] spicy | 辣 | la4 |
| [adj] bitter | 苦 | ku3 |
| [adj] good smell | 香 | xia1ng |
| [adj] bad smell | 臭 | cho4u |
| [verb] to try | 嚐(一)嚐 | cha2ng (yi4) cha2ng |
| [adj] good taste | 好吃 | hao3 chi1 |
| [colloq] … is bad | 不怎麼樣 | bu2 ze3n me ya4ng |
| [adj] disgusting | 惡心 | e3 xi1n |
| [verb] to smell | 聞一聞 | we4n yi1 we4n |
| [colloq] … extremely | …極了 | ji2 le |
| [noun] flavor | 風味 | fe1ng we4i |
| [noun] chinese food | 中餐 | zho1ng ca1n |
| [noun] western food | 西餐 | xi1 ca1n |
| [noun] special | 特別 | te4 bie2 |
| [noun] favorite | 最愛 | zu4i z4i |
Note
- I just realize that to use measurement word is just another way of expressing gender! Oh well, by looking at Wikipedia::Measure Word, it just says no. But it’s still in the same numeral classifiers. I guess that’s what I wanna say.
- In this lesson transcript: 糖是甜的。鹽是咸的。and 酢很酸。I’m not quite sure here… the former two are saying “A candy is sweet, Salt is salty” with “(Noun)是(Adj)的” structure. The later is, I guess quite commonly used, “(Noun)很(Adj)”. Is is just a colloquial difference? Or is there anything else I don’t know yet?
- 嚐嚐 (cha2ng) and 常常 (cha2ng) is actually the same exact pronunciation…
- 請問(qi1ng we4n) “excuse me” and 親吻(qi1n we3n) “kiss” sound very similar but mean very different.
- 極了(ji2 le) and 死了(si3 le) can be remembered as a pair.
- Comments: 3
- Trackbacks: 0
Mandarin Chinese Lesson
- 2008-07-01 (Tue)
- Mandarin | Study Note
I was reading a book called “7 frameworks for fundamental business mind” (original title: 勝間和代のビジネス頭を創る7つのフレームワーク力) by Kazuyo Katsuma. I will write a review of the book itself soon. It is very interesting and I have to admit that I am very influenced. So I will try to take a note on this blog about what I learn each day. You know, I am learning Mandarin Chinese now. I should have started to take this so thatit could be helpful to other real beginners but anyway. Nothing is too late.
Vocubrary
| 英文 | 漢字 | 拼音 |
|---|---|---|
| shirt | 襯衫 | che4n sha1n |
| sweater | 毛衣 | ma2o yi1 |
| jacket | 夾克 | jia2 ke4 |
| overcoat | 大衣 | da4 yi1 |
| pajamas | 睡衣 | shui4 yi1 |
| sweat shirt | 運動衣 | yu4n do4ng yi1 |
| sneaker | 運動鞋 | yu4n do4ng xie2 |
| men’s suits | 西裝 | xi1 zhua1ng |
| women’s suits | 套裝 | ta4o zhua1ng |
| dress | 洋裝 | ya2ng zhua1ng |
| pants | 褲子 | ku4 zi |
| skirt | 裙子 | qu2n zi |
| jeans | 牛仔褲 | niu2 za3i ku4 |
| swiming suits (most likely female’s) |
泳衣 | yo3ng yi1 |
| swiming pants | 泳褲 | yo3ng ku4 |
| hat | 帽子 | ma4o zi |
| tie | 領帶 | li3ng da4i |
| glasses | 眼鏡 | ya3n ji4ng |
| socks | 襪子 | wa4 zi |
| shoes | 鞋子 | xie2 zi |
| high heel | 高跟鞋 | ga1o ge1n xie2 |
| shoes | 皮鞋 | pi2 xie2 |
| sandals | 涼鞋 | lia2ng xie2 |
| boots | 靴子 | xue1 zi |
| jewelry | 珠寶 | zhu1 ba3o |
| ear ring | 耳環 | e3r hua2n |
| cosmetics | 化妝品 | hua4 zhua1ng pi3n |
| to wear (for mostly clothings) |
穿 | chua1n |
| to wear (for mostly accessories) |
戴 | da4i |
| (measurement for tops and dresses) |
件 | jia4n |
| (measurement for pants, skirts / bottoms) |
條 | tia2o |
| (measurement for shoes) |
雙 | shua1ng |
| (measurement for suits) |
套 | ta4o |
| (measurement for earings) |
對 | dui4 |
| foreigner | 外國人 老外 洋人 |
wa4i guo2 re3n la3o wa2i ya2ng re3n |
| to swim | 游泳 | yo2u yo3ng |
| pant (for suits) | 西裝褲 | xi1 zhua1ng ku4 |
| kahki pant | 卡其褲 | ka3 qi2 ku4 |
| woman | 女性 | nu3 xi4ng |
| to try on | 試穿 | shi4 chua1ng |
| to fit | 合適 | he2 shi4 |
| although | 雖然 | sui1 ra2n |
| if | 要是 | ya4o shi4 |
| if | 如果 | ru4 guo3 |
Grammar
- 雖然他很好,可是我們不合適。
- Although he is nice, but we were not a good match.
- 要是你很忙,我明天在來
- If you are busy, i’ll come again tomorrow.
- Comments: 0
- Trackbacks: 0
Home > Study Note
- Search
- Feeds
- Meta
- Links
- Ads!
-