> (define empty '()) empty> (display empty) () >
与えられた(空でない)リストの最後の要素だけからなるリストを返す手続きを定義する定義例 (define (last-pair items) (if (= (length items) 2) (cdr items) (last-pair (cdr items)) )) 実行例 > (define a (list 23 72 139 32 88)) a> (display a) (23 7…
cdrダウンすることで実現できる (define (list-ref items n) (if (= n 0) (car items) (list-ref (cdr items) (- n 1)) ) )
ちょっと回りくどい (define (length items) (define (length-iter a count) (if (null? a) count (length-iter (cdr a) (+ 1 count)))) (length-iter items 0))
リストをcdrダウンしてカウントする。直感的にわかりづらいが慣れるしかない。 (define (length items) (if (null? items) 0 (+ 1 (length (cdr items))) ) ) 実行例 > (define odds (list 1 3 5 7)) > (length odds) 4
forループの代わりに再帰で書くのがScheme。なかなか慣れない。 (define (show items) (if (not (null? items)) (begin (display (car items)) (show (cdr items)) ) ) ) 実行結果 > (display exp-list) (item:1 item:2)> (show exp-list) item:1item:2#f
I would like to stop by your office to discuss. I would like to ask for a room reservation. I would appreciate receiving your help. I would appreciate getting some feedback from you.
Please be advised that our company address has changed. We would like to advise you that your order has been shipped.
Please inform me of the situation by return e-mail. Please inform me of the details by return e-mail. Please let me know the shipping date. Please notify us if there are any problems.
Unfortunately, I will.. and will be unable to .... (残念ながら...なので、...できない) I regret that I will have to cancel the appointment.
Congratulations on your promotion. Congratulations on a job well done. Please accept my best wishes on your second anniversary. Please accept my sincere appreciation for your cooperation. (ご協力に心から感謝いたします)
Below is the agenda for the next meeting.(以下は次の会議の議題です) I'm writing to remind you that we have a meeting next week. (リマインドです) I'd like to inform you of the details...(詳細に関してお知らせします) I'm attaching the minu…
Here is the agenda for monthly meeting. (月次会議の議題をお送りします) Here is the estimate. (見積りをお送りします) Here is the list of our new products. (新製品のリストをお送りします) Please note that (〜をご確認ください) Please note t…
数字をファイルに書き出す場合の例 > (define port (open-output-file "test.output")) port> (display port) #[port 0x1174bee0] > (define num 10) num > (write num port) ()> (close-output-port port) #f > 唯一の解説ページ:Scheme 入門 9. 入出力
>(for-each (lambda (x) (newline) (display x)) (list 1 2 3 4 5) )1 2 3 4 5 > 上の例のように5つくらいならリストを作れるが、数が増えるとたいへんになる。任意の数に拡張したい。他の書き方はないか?例えば下のように書く。 > (define (func n) (if (>…
(list-ref リスト 番号n):リストのn番目のものを返す (length リスト):リストの長さを返す 実行例 > (define odds (list 1 3 5 7)) odds> (display odds) (1 3 5 7) > (list-ref odds 0) 1> (length odds) 4
2つ以上の式をまとめて1つの式にするにはbegin式が使える。 if文の中で使えば、複数の処理ができるようになる。
mapは引数として手続きとリストをとり、その手続きをリストの各要素に作用させてできた結果のリストを返す。 mapの実行例。 > (map (lambda (x) (* x x)) (list 1 2 3 4) ) (1 4 9 16) > for-eachもmapと同じで、引数として手続きとリストをとる。しかし、結…
ある程度時間のかかる処理を行っている間、メッセージダイアログを表示したい。「今、印刷中です」のようなもの。 MessageBoxを使うと、メッセージ画面にボタンが一緒に表示されてしまう。「OK」「キャンセル」「Yes」「No」等。表示するダイアログは処理の…
リストや記号を評価される式としてではなく、データオブジェクトとして扱いたときには引用符(')をクォートするオブジェクトの前に置く。使用例 > (define a 1) a > (define b 2) b > (list a b) (1 2) > (list 'a 'b) (a b) > (list 'a b) (a 2) >
IronPythonによるGUIで、ファイルを保存するダイアログを開く処理を実装する。 SharpDevelopを使ってコードを書くことを想定する。まず、ボタンを一つ設置する。このボタンを押したときにファイル保存ダイアログが開いてユーザーにフォルダとファイル名の入…
Please look over the attached document.
Please let me know a convenient date for you to do so. Please let me know if it is convenient for you. Please give me a call at your convenience.
Readingの結果がひどいので、次回までに対策を。最後まで解かないうちにタイムアップになったし。この結果を見ると、将来的に900点台までもっていくのは至難のわざ。テスト用の勉強をすることで、何点上がるかを次回は確認する。 次回までに行うこと テレビ…
Please forgive me for writing so late to reply to your message.
I look forward to receiving your reply soon. I hope to hear from you as soon as possible. May I have your reply by September 10, if possible? Please let me have your reply as soon as possible. Please may I have your reply as soon as possib…
ofd = OpenFileDialog() ofd.Filter = "text file (*.txt)|*.txt" #ダイアログに表示するタイトル ofd.Title = "Select text file" #初期指定フォルダ ofd.InitialDirectory = "C:\\" #初期指定ファイル ofd.FileName = "test.txt" ofd.RestoreDirectory = T…
import os os.system("C:/Program Files/myprogram.exe") これで起動しようとすると、 'C:/Program'は、内部コマンドまたは外部コマンド、操作可能なプログラムまたはバッチファイルとして認識されていません。 となるので、代わりに import subprocess subp…
(do ((i 1 (+ i 1))) ((= i 7)) ...(繰り返したい処理) ) 無駄な括弧がある?
-I am very grateful. -Your assistance meant a great deal to me. -It was a pleasure working with you. -Thank you very much for the valuable advice. -Thank you again for taking the time to see me. -I really appreciated your support during th…