如何在Ubuntu Karmic上安装LFE?

use*_*021 5 lisp erlang lfe

Erlang已经安装:

$dpkg -l|grep erlang
ii  erlang                          1:13.b.3-dfsg-2ubuntu2            Concurrent, real-time, distributed function
ii  erlang-appmon                   1:13.b.3-dfsg-2ubuntu2            Erlang/OTP application monitor
ii  erlang-asn1                     1:13.b.3-dfsg-2ubuntu2            Erlang/OTP modules for ASN.1 support
ii  erlang-base                     1:13.b.3-dfsg-2ubuntu2            Erlang/OTP virtual machine and base applica
ii  erlang-common-test              1:13.b.3-dfsg-2ubuntu2            Erlang/OTP application for automated testin
ii  erlang-debugger                 1:13.b.3-dfsg-2ubuntu2            Erlang/OTP application for debugging and te
ii  erlang-dev                      1:13.b.3-dfsg-2ubuntu2            Erlang/OTP development libraries and header
[... many more]
Run Code Online (Sandbox Code Playgroud)

Erlang似乎有效:

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

Eshell V5.7.4  (abort with ^G)
1> 
Run Code Online (Sandbox Code Playgroud)

我从github下载了lfe并检查了0.5.2:

git clone http://github.com/rvirding/lfe.git
cd lfe
git checkout -b local0.5.2 e207eb2cad

$ configure
configure: command not found

$ make
mkdir -p ebin
erlc -I include -o ebin -W0 -Ddebug +debug_info src/*.erl
#erl -I -pa ebin -noshell -eval -noshell -run edoc file src/leex.erl -run init stop
#erl -I -pa ebin -noshell -eval -noshell -run edoc_run application "'Leex'" '"."' '[no_packages]'
#mv src/*.html doc/
Run Code Online (Sandbox Code Playgroud)

一定是我错过的蠢事:o

$ sudo make install
make: *** No rule to make target `install'.  Stop.

$ erl -noshell -noinput -s lfe_boot start
{"init terminating in do_boot",{undef,[{lfe_boot,start,[]},{init,start_it,1},{init,start_em,1}]}}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
Run Code Online (Sandbox Code Playgroud)

有一个例子我如何创建一个hello world源文件并编译并运行它?

rvi*_*ing 7

不,你没有错过.LFE中的Makefile "不完美",应该被忽略,它将在下一个版本中得到改进.要补偿已编译的所有必需文件,并且.beam文件位于ebin目录中.由于它不是OTP的一部分,我认为它不应该安装在那里.

处理此问题的最简单方法是创建私有erlang库目录并将环境变量ERL_LIBS指向它.然后将整个LFE目录放在那里.当erlang启动时,代码服务器会自动将lfe/ebin目录添加到路径中,然后会自动找到并加载.beam文件.这适用于包含ebin目录的任何包.这也适用于Windows.所以:

  1. 比如说,创建一个libs目录 ~/erlang/lib
  2. 设置环境变量ERL_LIBS, export ERL_LIBS=~/erlang/lib
  3. 把整个LFE目录放在那里

当你启动erlang时,你会/Users/rv/erlang/lib/lfe/ebin在代码路径(code:get_path())中看到(或者你拥有它的任何地方).然后,您还可以直接启动LFE shell

erl -noshell -noinput -s lfe_boot start
Run Code Online (Sandbox Code Playgroud)

将来会有一个lfe和一个lfe.bat这样做.

与erlang一样,任何文本编辑器都可以编辑LFE.对于emacs,有一种LFE模式,它仍然相当基本但有效.您还无法在窗口中运行LFE.不久.包含此内容的最佳方法是将以下内容放在.emacs文件中:

;; LFE mode.
(setq load-path (cons "/Users/rv/erlang/lib/lfe/emacs" load-path))
(require 'lfe-start)
Run Code Online (Sandbox Code Playgroud)

有一些示例文件lfe/examples,都应该工作.在lfe/test/visual我的测试文件中有很多作为示例文件包含在内.从普通的erlang shell编译LFE文件

lfe_comp:file("foo").
l(foo).                 %No autloload here, do this to ensure loading
Run Code Online (Sandbox Code Playgroud)

而从LFE shell做:

(c '"foo")              ;This will autoload
Run Code Online (Sandbox Code Playgroud)

有一堆文档lfe/docs非常准确但user_guide.txt需要扩展.LFE还有一个谷歌小组

http://groups.google.se/group/lisp-flavoured-erlang
Run Code Online (Sandbox Code Playgroud)

其中包含一些有趣的讨论,人们在github LFE wiki中写了很多.

这就是我想的.如果您有更多问题,请与我联系.