2014-01-01から1年間の記事一覧
>(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…
間違った宛先のメールを受け取ったとき I received the following e-mail from you last night, and believe that you made an error in the address. I am afraid your e-mail mistakenly got sent to the wrong address. My name is not ... ミーティング…
局所変数x、yを定義する。そのためのlet。 定義した局所変数の値を変更する。そのためのset!。使用例は以下の通り。 (define (example) (let ((x 0) (y 0)) ... (set! x (+ x amount)) (set! y (+ y amount)) ...
ListViewにアイテムを追加したり、選択したアイテム行を削除する方法。 簡単なサンプルコードを下に示す。ここでは、Addボタンを押すと決まった文字列を追加する。アイテム行を選択してRemoveボタンを押すと行を削除する。行が選択されていなければ何もしな…
何も指定しないとデフォルトロケーションということで、左上寄りに表示される。 画面中央に表示する場合の設定 class MainForm(Form): def __init__(self): self.InitializeComponent() def InitializeComponent(self): self.SuspendLayout() # # MainForm #…
以前に、GUIからPDFファイルを開きたい - 理想のユーザ・インターフェイスを求めてを検討したが、コマンドラインから実行できる任意のプログラムを、同じようにGUIボタンを押したときに実行できるようにする。 やりかたはPDFファイルを開いたときとほぼ同じ…
画面上にWebBrowserのFormを配置する。そのサンプルを下に示す。 url_fileに、URLを指定する。サンプルのようにローカルに置いたHTMLファイルのファイルパスを指定しても問題なく表示される。 import System.Drawing import System.Windows.Forms from Syste…
IronPythonのコードを、Command Line Python Compiler (pyc.py)でコンパイルして実行形式ファイルを作成する。 実行例。 > ipy.exe pyc.py /main:main.py /target:winexe Input Files: Output: main Target: WindowApplication Platform: ILOnly Machine: I3…
(define pi (* 2 (asin 1)))
(string-length c) : 文字列cの長さを返す > (define cc "test") cc > (string-length cc) 4 (symbol->string a) : シンボルを文字列に変換する
> (remove "*.jpg")
> (if (string=? aa "AA") (if (string=? bb "BB") (display cc) ) ) >
if文で使える。 > (define aa "Hello") > (define bb " World!") > > (define (test) (display aa)(display bb) ) test > (test) Hello World! >
let : 局所変数を定義 set! : 代入 map : リストに対して手続きを作用させた結果を返す cdr : 対の右側を取り出す memq : 記号がリストに含まれていないなら#f car : 対の左側を取り出す
ファイル存在確認 (file-exist? "AAA") ---"AAA"というファイルが存在するか? #tか#fを返す。 文字列が含まれているか (substring? "aa" some-string) --- 文字列some-stringの中に"aa"が含まれているか? #tか#fを返す。 否定 (not #t) --- #fを返す。 (no…