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
0
110
Logic Programming
A quick exploration on Logic Programming... with Ruby and Ruby-Prolog
Mario Alberto Chávez
October 14, 2014
Tweet
Share
More Decks by Mario Alberto Chávez
See All by Mario Alberto Chávez
Ruby Internals V3
mario_chavez
0
49
Beyond the Rails Way
mario_chavez
1
93
Elm, una mejor manera de hacer frontend
mario_chavez
0
220
Rediscovering ActiveRecord
mario_chavez
2
330
Intro to Elixir
mario_chavez
0
160
From Ruby to Elixir: Developing Web Applications
mario_chavez
0
410
Pitch para Startups
mario_chavez
1
130
Understanding KPIs
mario_chavez
1
92
El nuevo comercio electrónico
mario_chavez
0
69
Other Decks in Programming
See All in Programming
Web フロントエンドエンジニアに開かれる AI Agent プロダクト開発 - Vercel AI SDK を観察して AI Agent と仲良くなろう! #FEC余熱NIGHT
izumin5210
3
520
iOSエンジニア向けの英語学習アプリを作る!
yukawashouhei
0
190
ソフトウェア設計の実践的な考え方
masuda220
PRO
4
580
GraphQL×Railsアプリのデータベース負荷分散 - 月間3,000万人利用サービスを無停止で
koxya
1
1.3k
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
220
チームの境界をブチ抜いていけ
tokai235
0
170
「ちょっと古いから」って避けてた技術書、今だからこそ読もう
mottyzzz
10
6.6k
あなたとKaigi on Rails / Kaigi on Rails + You
shimoju
0
130
オープンソースソフトウェアへの解像度🔬
utam0k
15
2.7k
CSC509 Lecture 05
javiergs
PRO
0
300
私達はmodernize packageに夢を見るか feat. go/analysis, go/ast / Go Conference 2025
kaorumuta
2
550
2分台で1500examples完走!爆速CIを支える環境構築術 - Kaigi on Rails 2025
falcon8823
3
3.6k
Featured
See All Featured
Fireside Chat
paigeccino
40
3.7k
Build your cross-platform service in a week with App Engine
jlugia
232
18k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
30
2.9k
Building a Scalable Design System with Sketch
lauravandoore
463
33k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Why Our Code Smells
bkeepers
PRO
339
57k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.7k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
The Invisible Side of Design
smashingmag
302
51k
Become a Pro
speakerdeck
PRO
29
5.5k
Java REST API Framework Comparison - PWX 2021
mraible
33
8.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