sym_num

sym_num

Small Prolog interpreter in Elixir

I am creating a Prolog interpreter to learn Elixir. This is not practical. It is a toy program.

https://github.com/sasagawa888/Prolog

Example: (from PAIP, Peter Norvig)
?- assert(likes(kim,robin)).
true
?- assert(likes(sandy,lee)).
true
?- assert(likes(sandy,kim)).
true
?- assert(likes(robin,cats)).
true
?- assert((likes(sandy,X) :- likes(X,cats))).
true
?- assert((likes(kim,X) :- likes(X,lee),likes(X,kim))).
true
?- assert(likes(X,X)).
true
?- listing.
likes(kim,robin)
likes(sandy,lee)
likes(sandy,kim)
likes(robin,cats)
likes(sandy,X) :- likes(X,cats)
likes(kim,X) :- likes(X,lee)likes(X,kim)
likes(X,X)
true
?- likes(sandy,Who).
Who = lee;
Who = kim;
Who = robin;
Who = sandy;
Who = cats;
Who = sandy;
false
?-halt.
goodbye

First Post!

kip

kip

ex_cldr Core Team

This super exciting (for me). I’ve been re-reading Prolog with the idea of either implementing a Prolog-like DSL, or maybe an interpreter. I’ve only got as far as starting to research how to write a Horne clause theorem solver (really, just started), So this is going to be a great project for me to follow.

Most Liked

patrickdm

patrickdm

Arigato gozaimashita Kenichi-san!
This interpreter inspired me to learn Prolog.
What a wonderful language, what a gift!
Thank you :bowing_man: :slightly_smiling_face:

P.S. for others unknowing and curious like me: The Power of Prolog

rvirding

rvirding

Creator of Erlang

Yes, I haven’t worked on Erlog for a while but it is has not died. It has reached a certain level and I have left it there. It does implement a proper subset of standard prolog but of course it could be extended. The next step could be a rework of the interpreter maybe compiling the code a bit to improve speed.

Doing an elixir front-end to it would be relatively simple as the interface and internal data structures are quite straight forward. It is just that no one has asked for one yet. :smile:

There was a fork where someone else reworked the database to handle large tables but it used ETS and it wasn’t possible to make the database behave exactly as the prolog standard. Which was one of my requirements. There is a simple ETS interface which could be extended with more features.

Last Post!

sym_num

sym_num

I am very honored. Thank you.

Where Next?

Popular in Discussions Top

restack_oslo
Hello, Please pardon me for any faux paux. I am 46 and this is my first time on a forum of any kind. I wanted to to get answers from tho...
New
und0ck3d
Hello everyone! A few days ago I’ve created a topic here about how people were creating CMSs with Elixir and Phoenix. I’ve been studying...
New
pillaiindu
In django there is a cache framework backed by memcached. Rails also puts a lot of emphasis on caching, and even the idea of russian-doll...
New
rms.mrcs
A couple of days ago I was discussing with a friend about different approaches to write microservices. He said that if he was going to w...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
PragTob
Hello everyone, I know we had quite some threads (read through lots of them) about background job processing but it remains a hotly deba...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

Other popular topics Top

JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 55125 245
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement