0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

chabo-dslにCLIのスクリプトを追加した

0
Posted at

chabo-dslを実行するコマンドを追加した。

スクリプトファイルを実行

chabo-dslを記述したファイルを読んで実行する

$ cat script/fb.chabo
【関数定義:フィボナッチ数を計算する関数】
・回数と中間値と答えでフィボナッチを計算するには
 もし回数が1未満の場合は、答えを返す
 以外はフィボナッチを計算する(回数-1,中間値+答え,中間値)。

【実行例:0から30までのフィボナッチ数列】
join(",",map(フィボナッチを計算する($_,1,0),0から30));
$ script/chabo.pl script/fb.chabo
0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811,514229,832040
$

パイプラインでの実行

$ echo '2**3**2'|script/chabo.pl
512

ヒアドキュメントで実行

$ script/chabo.pl <<EOF
> a=2;b=3;
> a**b**a
> EOF
512
$
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?