dimitarvp

dimitarvp

This is mostly aimed at @rvirding but anyone who knows Erlang and Prolog well enough can answer, of course.

Here goes: I’d like to dip my toes in logic programming a bit. I don’t want to become an expert in Prolog the programming language, only the logic programming aspect of it.

Can Erlog (Prolog running in Erlang console) can actually run in IEx as well? If not, what exactly must be done so it can run in an Erlang console? Sorry if it’s a naive and dumb question, I don’t aim to become an expert in Erlang and I am looking for a quick-and-easy way.

Any help is appreciated.

Showing Posts 1 to 10

rvirding

rvirding

Creator of Erlang

Yes, erlog runs without problems in IEx. It is basically just a big library and with some interface modules.

  • The basic interface is in the :erlog module which you can call from programs or from a shell like IEx. The Erlog state is in a structure which you pass around.
  • There is also an Erlog gen_server in the module :erlog_server which you can startup. It manages the state and there is a set of interface functions to access it, basically the same interface as in :erlog.
  • You can also start up a simple prolog-like shell with :erlog_shell.

The interface is standard Erlang but this mainly because no-one has shown any interest in writing one for Elixir. It would not be difficult.

Robert

P.S. Saw your question in the irc but hadn’t got around to answering it.

dimitarvp

dimitarvp OP

Thank you! Does that mean that the Erlang modules you listed are a part of Erlang and don’t have to be installed on top of the vanilla Erlang?

For the record, I use Erlang/OTP 19.2.

EDIT: I can’t see erlog in Erlang’s website docs, that’s why I am asking if it’s a standalone package that needs to be installed extra. Also, how exactly do I exit the erlog_shell?

rvirding

rvirding

Creator of Erlang

No, erlog is a separate system which you will have to down load from github, GitHub - rvirding/erlog: Prolog interpreter in and for Erlang · GitHub , and connect into your application. This can be done with mix (I guess) but I can’t help you there as my knowledge of mix is not great.

dimitarvp

dimitarvp OP

How do I connect a downloaded GIT repo to my app in an Erlang environment? If I know that, I can probably infer how to do it with mix.

rvirding

rvirding

Creator of Erlang

If you are using rebar3 with erlang you can specify it as a dependency and it will be downloaded and put in a suitable place. Pretty much what mix does. If you are not using rebar3 then you need to download it by hand and put it somewhere that erlang can find it, the easiest is by either using the -pa <dir> flag when starting erlang or by setting ERL_LIBS environment variable, code — OTP 29.0.2 (kernel 11.0.2) . With mix you can also give it as a dependency but you need to tell mix that it is erlang which it must compile and not elixir. i don’t know how you do that.

dimitarvp

dimitarvp OP

I’ll figure the mix part out. You helped me a lot, thank you!

rvirding

rvirding

Creator of Erlang

No worries, just ask if have more questions about running it. Seriously.

dimitarvp

dimitarvp OP

Definitely will, just don’t want to spam you with all of it before even having tried. :wink: I’ll be bumping the thread when I get around to actually trying erlog.

rvirding

rvirding

Creator of Erlang

No, there should be no problems using erlog from Elixir. The only issue is that the argument order to the functions in some of the interface modules, e.g. erlog, is in the standard Erlang ordering with the state the last argument and not in the standard Elixir ordering. This will make them a little more difficult to use in pipes.

if there is interest I can fix a set of Elixir modules for erlog.

crova

crova

Couldn’t then/2 help in this case?

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews