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
64
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
420
Pitch para Startups
mario_chavez
1
140
Understanding KPIs
mario_chavez
1
110
El nuevo comercio electrónico
mario_chavez
0
85
Other Decks in Programming
See All in Programming
tRPCの概要と少しだけパフォーマンス
misoton665
2
220
AI時代のエンジニアリングの原則 / Engineering Principles in the AI Era
haru860
0
490
Back to the roots of date
jinroq
0
260
Kubernetes上でAgentを動かすための最新動向と押さえるべき概念まとめ
sotamaki0421
3
540
CDK Deployのための ”反響定位”
watany
4
790
UIの境界線をデザインする | React Tokyo #15 メイントーク
sasagar
2
370
ハンズオンで学ぶクラウドネイティブ
tatsukiminami
0
130
Cache-moi si tu peux : patterns et pièges du cache en production - Devoxx France 2026 - Conférence
slecache
0
270
t *testing.T は どこからやってくるの?
otakakot
1
690
ハーネスエンジニアリングにどう向き合うか 〜ルールファイルを超えて開発プロセスを設計する〜 / How to approach harness engineering
rkaga
24
14k
アーキテクチャモダナイゼーションとは何か
nwiizo
19
5.3k
〜バイブコーディングを超えて〜 チームで実験し続けたAI駆動開発
tigertora7571
0
120
Featured
See All Featured
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2k
Music & Morning Musume
bryan
47
7.2k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
64
55k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
120
30 Presentation Tips
portentint
PRO
1
280
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
250
We Are The Robots
honzajavorek
0
220
Designing Experiences People Love
moore
143
24k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
210
Crafting Experiences
bethany
1
120
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