Erlang を試してみる (001)

思いついたので、試してみる事にする。今の生活が、あまりに、めんどくさいので。。

参考にするのは、 @ymotongpoo の訳してくれた、http://ymotongpoo.appspot.com/lyse_ja/index.html
感謝、感謝であります。。

インストール

Mac 10.6.8 にインストールする。
MacBook Air が、ものすごく、働いてしまいました。排気がすげぇ。。^^;

guutara$ sudo port install erlang
Password:
Warning: port definitions are more than two weeks old, consider using selfupdate
--->  Computing dependencies for erlang
--->  Dependencies to be installed: gawk
--->  Fetching archive for gawk
--->  Attempting to fetch gawk-4.0.0_0.darwin_10.x86_64.tbz2 from http://packages.macports.org/gawk
--->  Attempting to fetch gawk-4.0.0_0.darwin_10.x86_64.tbz2.rmd160 from http://packages.macports.org/gawk
--->  Installing gawk @4.0.0_0
--->  Activating gawk @4.0.0_0
--->  Cleaning gawk
--->  Fetching archive for erlang
--->  Attempting to fetch erlang-R14B03_1+ssl.darwin_10.x86_64.tbz2 from http://packages.macports.org/erlang
--->  Fetching erlang
--->  Attempting to fetch otp_src_R14B03.tar.gz from http://distfiles.macports.org/erlang
--->  Attempting to fetch otp_doc_man_R14B03.tar.gz from http://distfiles.macports.org/erlang
--->  Attempting to fetch otp_doc_html_R14B03.tar.gz from http://distfiles.macports.org/erlang
--->  Verifying checksum(s) for erlang
--->  Extracting erlang
--->  Applying patches to erlang
--->  Configuring erlang
--->  Building erlang

げ、ここから、すすまない。。

ということで、

sudo port selfupdate
sudo port upgrade outdated
sudo port clean erlang

をしてから、再挑戦。

guutara$ sudo port install erlang
--->  Computing dependencies for erlang
--->  Fetching archive for erlang
--->  Attempting to fetch erlang-R14B04_1+ssl.darwin_10.x86_64.tbz2 from http://packages.macports.org/erlang
--->  Fetching erlang
--->  Attempting to fetch otp_src_R14B04.tar.gz from http://jog.id.distfiles.macports.org/macports/mpdistfiles/erlang
--->  Attempting to fetch otp_doc_man_R14B04.tar.gz from http://jog.id.distfiles.macports.org/macports/mpdistfiles/erlang
--->  Attempting to fetch otp_doc_html_R14B04.tar.gz from http://jog.id.distfiles.macports.org/macports/mpdistfiles/erlang
--->  Verifying checksum(s) for erlang
--->  Extracting erlang
--->  Applying patches to erlang
--->  Configuring erlang
--->  Building erlang
--->  Staging erlang into destroot
--->  Installing erlang @R14B04_1+ssl
--->  Activating erlang @R14B04_1+ssl
--->  Cleaning erlang

guutara$ erl
Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.5  (abort with ^G)

無事、起動。。

イントロダクション

http://ymotongpoo.appspot.com/lyse_ja/ja/introduction.html

文章の感じが、とても、好感がもてまして、読みやすいっす。
どうやら、悪い所も、書いてくれるらしいので、安心かも。

始めましょう

http://ymotongpoo.appspot.com/lyse_ja/ja/starting_out.html

インストールしていたので、とりあえず、読む前に、立ち上げたら、終わらせられない。

~ guutara$ erl
Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.5  (abort with ^G)
1> quit
1> end

うーん、じゃ、CTL + c とかしたら、ひぃ。

1> 
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
       (v)ersion (k)ill (D)b-tables (d)istribution

kill ?

k


Process Information

--------------------------------------------------
=proc:<0.32.0>
State: Waiting
Spawned as: erlang:apply/2
Spawned by: <0.25.0>
Started: Mon Nov 14 20:57:18 2011
Message queue length: 0
Number of heap fragments: 0
Heap fragment data: 0
Link list: [<0.25.0>, {to,<0.24.0>,#Ref<0.0.0.28>}]
Reductions: 14
Stack+heap: 233
OldHeap: 0
Heap unused: 179
OldHeap unused: 0
Stack dump:
Program counter: 0x0000000000edc690 (io:wait_io_mon_reply/2 + 56)
CP: 0x0000000000000000 (invalid)
arity = 0

0x00000000007d8c10 Return addr 0x0000000000edba48 (io:parse_erl_exprs/3 + 144)
y(0)     #Ref<0.0.0.28>
y(1)     <0.24.0>

0x00000000007d8c28 Return addr 0x00000000020a8c50 (shell:'-get_command/5-fun-0-'/1 + 40)
y(0)     []

0x00000000007d8c38 Return addr 0x00000000005f9208 (<terminate process normally>)
(k)ill (n)ext (r)eturn:

k
1> 

と、ここで、ようやく、読み始めて、ありゃりゃと。

CTL + g ですって。。

1> 
User switch command
 --> h
  c [nn]            - connect to job
  i [nn]            - interrupt job
  k [nn]            - kill job
  j                 - list all jobs
  s [shell]         - start local shell
  r [node [shell]]  - start remote shell
  q        - quit erlang
  ? | h             - this message
 --> q
~ guutara$ 

前途多難かも。。

continue ?

たぶん。。。^^;