Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Logic Programming
Search
Mario Alberto Chávez
October 14, 2014
Programming
130
0
Share
Logic Programming
A quick exploration on Logic Programming... with Ruby and Ruby-Prolog
Mario Alberto Chávez
October 14, 2014
More Decks by Mario Alberto Chávez
See All by Mario Alberto Chávez
Ruby Internals V3
mario_chavez
0
65
Beyond the Rails Way
mario_chavez
1
120
Elm, una mejor manera de hacer frontend
mario_chavez
0
250
Rediscovering ActiveRecord
mario_chavez
2
350
Intro to Elixir
mario_chavez
0
170
From Ruby to Elixir: Developing Web Applications
mario_chavez
0
430
Pitch para Startups
mario_chavez
1
150
Understanding KPIs
mario_chavez
1
110
El nuevo comercio electrónico
mario_chavez
0
86
Other Decks in Programming
See All in Programming
Firefoxにコントリビューションして得られた学び
ken7253
2
160
20260514 - build with ai 2026 - build LINE Bot with Gemini CLI
line_developers_tw
PRO
0
430
サプライチェーン攻撃対策「層を重ねて落ちない壁」を10日間で組み上げた話 #TechLeadConf2026
kashewnuts
1
270
【ディップ|26年新卒研修資料】OpenAPI/Swagger REST API研修
dip_tech
PRO
0
150
実用!Hono RPC2026
yodaka
2
310
AIベース静的検査器の偽陽性率を抑える工夫3選
orgachem
PRO
4
460
要はバランスからの卒業 #yumemi_grow
kajitack
0
160
AI時代のエンジニアリングの原則 / Engineering Principles in the AI Era
haru860
0
1.2k
Agentic Elixir
whatyouhide
0
450
AI時代だからこそ「Bloc」を採用する価値があるのかもしれない
takuroabe
0
170
属人化しないコード品質の作り方_2026.04.07.pdf
muraaano
0
350
GitHubCopilotCLIをはじめよう.pdf
htkym
0
330
Featured
See All Featured
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
10k
Mind Mapping
helmedeiros
PRO
1
190
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
Docker and Python
trallard
47
3.8k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
How to make the Groovebox
asonas
2
2.2k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
500
WCS-LA-2024
lcolladotor
0
590
The Cult of Friendly URLs
andyhume
79
6.9k
Transcript
Logic Programming With Ruby Mario Chavez : @mario_chavez
We do love Ruby
Ruby has a story of borrowing features from other languages
Logic Programming with Prolog
Logic Programming • We do not express what a program
should do • We do express data and queries in a specific format
Main Blocks • Facts, assertions about our domain • Rules,
express inferences about our facts • Queries, questions to be answered
Ruby-Prolog https://github.com/preston/ruby-prolog
likes['wallace', 'cheese'].fact ! likes['grommit', 'cheese'].fact! likes['wendolene', 'sheep'].fact! friend[:X, :Y] <<=
[noteq[:X,:Y], likes[:X, :Z], likes[:Y, :Z]] query(friend['wallace', 'grommit']) rp = RubyProlog::Core.new! rp.instance_eval do! end
class Family < RubyProlog::Core! def initialize! super! facts! rules! end!
! def siblings(person)! query sibling[:X, person]! end! ! def parents(child)! query parent[:X, child]! end! ! def children(parent)! query parent[parent, :Y]! end! ! private! def facts! mother["Trude", "Sally"].fact! father["Tom", "Sally"].fact! father["Tom", "Erica"].fact! father["Mike", "Tom"].fact! end! ! def rules! sibling[:X,:Y] <<= [ parent[:Z,:X], parent[:Z,:Y], noteq[:X,:Y] ]! parent[:X,:Y] <<= father[:X,:Y]! parent[:X,:Y] <<= mother[:X,:Y]! end! end! ! s = Family.new! s.siblings 'Sally'!
Not as complete as Prolog But good enough to explore
a different way to solve problems
Be curious
Explore other languages
Gracias Mario Chavez : @mario_chavez