• 検索結果がありません。

complang1 exam 2003 02 17

N/A
N/A
Protected

Academic year: 2018

シェア "complang1 exam 2003 02 17"

Copied!
1
0
0

読み込み中.... (全文を見る)

全文

(1)

2003-02-17

2002 年度計算機言語 I 定期試験

1. 次の問いに答えよ。

(a) 次の ML の型を持つ式の例を挙げよ。 i. (int * char) list

ii. int list list list

(b) 次の ML の式はどこが誤っているか。理由も添えて答えよ。 i. if 2 < 3 then 4

ii. [1]::[5, 10]

(c) ML の式 [1,4,3] を次のパターンに照合させたとき、変数 y にはそれぞれ 何が束縛されるか。

i. x::y ii. x::y::z::w

2. 次の関数を ML で実装せよ。

(a) ユークリッドの互除法により二つの整数 a, b(a, b ≥ 0) の最大公約数を 求める再帰関数gcm(a, b)。ユークリッドの互除法とは次のようなアル ゴリズムである。

• b= 0 ならば、gcm(a, b) = a。

• b ≥1 ならば、gcm(a, b) = gcm(b, a mod b)。ただし a mod b は a を b で割った余りである。

(b) n(≥ 0) から 0 までの整数を順に並べたリストを得る再帰関数 count- down(n)。たとえば countdown(3) = [3,2,1,0] となる。

3. n(≥ 0) の 2 進数表現を文字列で得る関数 binary(n) を ML で実装することを 考える。

(a) 補助関数として、n ≥ 1 のときは正しい結果が得られるが、n = 0 のと きは空文字列が得られる関数binary1(n) を実装せよ。

(b) binary1(n) を用いて binary(n) を実装せよ。

参照

関連したドキュメント

SOFO, Computational Techniques for the Summation of Series, Kluwer Publishing Co., New York, 2003.

飼料用米・WCS 用稲・SGS

Mix and apply Serifel in sufficient water volume to ensure uniform dispersion in spray tank and thorough coverage of foliage and shoot tissue... 8 Crop-Specific

Ground Application: Apply in 20 to 100 gallons per acre by conventional ground equipment to ensure thorough coverage of the target crop. Aerial Application: Make applications

Bicep Lite II Magnum alone or in tank mixture with Balance PRO, Banvel, Dual Magnum ® , Dual II Magnum ® , or Princep may be applied early preplant, preplant incorporated,

Always add an appropriate adjuvant to the spray tank (see the Spray Additives section of this label). Apply to actively growing weeds. See Table 1 for a complete list of

Appropriate herbicides may include atrazine, Accent ® , bentazon (e.g. Basagran), Beacon, Moxy (bromoxynil), Exceed, Marksman, or 2,4-D. If the postemergence application includes

For all other diseases, begin Satori Fungicide applications prior to disease development and continue throughout the season every 7 to 14 days following the resistance