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
120
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
59
Beyond the Rails Way
mario_chavez
1
100
Elm, una mejor manera de hacer frontend
mario_chavez
0
240
Rediscovering ActiveRecord
mario_chavez
2
340
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
79
Other Decks in Programming
See All in Programming
CSC307 Lecture 02
javiergs
PRO
1
770
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
420
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
110
ぼくの開発環境2026
yuzneri
0
170
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
6k
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
140
Fragmented Architectures
denyspoltorak
0
150
AgentCoreとHuman in the Loop
har1101
5
230
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
7.3k
CSC307 Lecture 01
javiergs
PRO
0
690
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
120
AI & Enginnering
codelynx
0
110
Featured
See All Featured
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.4k
Making the Leap to Tech Lead
cromwellryan
135
9.7k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
430
A designer walks into a library…
pauljervisheath
210
24k
Paper Plane (Part 1)
katiecoart
PRO
0
4k
How to make the Groovebox
asonas
2
1.9k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.2k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
440
Art, The Web, and Tiny UX
lynnandtonic
304
21k
The SEO Collaboration Effect
kristinabergwall1
0
350
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