Question

I am writing server in erlang but I have already done some code in common lisp ( genetic algorithms ). I am totally new too erlang and I read in book that I can call compiled languages from elrang ( like nif, or port or from shell) but I also found http://lfe.github.io/ , so I need advice what is the best way to call common lisp code or to rewrite in lfe ?

Was it helpful?

Solution

The best way to do it depends on the code you've got and how you need to interact with it.

  • NIF: As fast as a function call, but any problems in the Lisp code have the potential to crash the Erlang VM
  • Shell: Probably the least amount of work for you and well-isolated, but very expensive to invoke. If you're invoking Lisp only a few times a minute, do this one.
  • TCP or other socket: Well-isolated, fast (slower than NIF, though). Having your Lisp code available as a service might be nice in other ways. Requires a bunch of writing.
  • LFE: You have to rewrite your Lisp code. LFE is not Common Lisp, so you can't just recompile.

OTHER TIPS

LFE is a proper lisp but it is not CL. So if you want to use LFE then you will most likely have to modify your program. However, doing this will make the interaction with erlang trivial as LFE is running together with Erlang on the same VM and the interface is transparent.

If you wish to run your program on a CL then the easiest way is to use ports and communicate with the CL through commands to the CL shell and maybe with files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top