Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Logic Programming
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Mario Alberto Chávez
October 14, 2014
Programming
150
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
73
Beyond the Rails Way
mario_chavez
1
140
Elm, una mejor manera de hacer frontend
mario_chavez
0
250
Rediscovering ActiveRecord
mario_chavez
2
360
Intro to Elixir
mario_chavez
0
180
From Ruby to Elixir: Developing Web Applications
mario_chavez
0
440
Pitch para Startups
mario_chavez
1
160
Understanding KPIs
mario_chavez
1
130
El nuevo comercio electrónico
mario_chavez
0
94
Other Decks in Programming
See All in Programming
mrbgem 三角測量 開発
ogom
0
170
APNsからLive Activityを開始する話
yumnumm
0
120
Intent as Code
shoppingjaws
6
1.1k
選挙速報を多くのユーザーへ 届ける Live Activities 設計
hamayokokuririn
0
210
Are APIs Still Relevant in the AI Era?
soyuka
0
390
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
270
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
380
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
250
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
5.3k
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
330
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
4.8k
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
470
Featured
See All Featured
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
3
4.3k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Technical Leadership for Architectural Decision Making
baasie
3
590
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
420
Why Our Code Smells
bkeepers
PRO
340
58k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
Odyssey Design
rkendrick25
PRO
2
850
Documentation Writing (for coders)
carmenintech
77
5.6k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
350
Into the Great Unknown - MozCon
thekraken
41
2.7k
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