LoginSignup
0
0

More than 5 years have passed since last update.

Erlang学習1

Posted at

インストール

MacOSX 10.10 yosemiteにソースから入れる
http://www.erlang.org/download.html
(OTP 17.5 Source File (64.1 MB)を入れた。)

otp_src_17.5.tar.gzを解凍してリネームしてデスクトップに置く。

yoshida-book% sudo mv Desktop/erlang /usr/local
yoshida-book% cd /usr/local/erlang
yoshida-book% ./configure
yoshida-book% make
yoshida-book% make install

実行

yoshida-book% erl
Erlang/OTP 17 [erts-6.4] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V6.4  (abort with ^G)
1> 42.
42
2> 3.7.

メモ

Erlangにおける符号"="は代入ではなく、パターン照合処理
右辺を評価して左辺と一致するかを調べる
左辺が未束縛変数が場合は右辺と同じにする
共有メモリを持たず単純なメッセージ交換で平行処理を行う
一つの変数に値を何度も代入できるとすると並列処理が複雑になる

数
    整数(Integer)
    浮動小数点数(float)
    100
アトム
    Erlangにおける不変定数
    アトムは小文字英語から始まり、英数字が続く
    atom
タプル
   複数個のデータを一つとしてまとめたい時に使用する型
   {Term1, . . . ,TermN}
リスト
   [Term1, . . . ,TermN]

https://gist.github.com/niiyz/012fe6feb360bacc082f
アトム https://gist.github.com/niiyz/9a0d541249656e257674
リスト https://gist.github.com/niiyz/9cb4b774029a03408dde

参考: http://erlangworld.web.fc2.com/data_types/atom.html

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