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
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
130
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
92
Other Decks in Programming
See All in Programming
AWS DevOps Agentで インシデント対応をAIに任せたい
honmarkhunt
6
2.5k
Swift愛好会100回記念 第1回を振り返る
jollyjoester
0
120
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
4.3k
不幸な GC
chencmd
0
890
AI に Inclusive UI を書かせよう — Design Rules Skill で Compose UI を作り直す
theoriatec2024
1
460
in-process GraphQL のすすめ #ginzajs
izumin5210
4
1.5k
【DroidKaigi 2026】「アクセシビリティを利用するとき、 アクセシビリティもまたこちらを利用している」 〜マルウェアによる攻撃と防衛について〜
halunoyo
0
410
PyConJP2026_wat_Python × Signal Processing: How to Draw Pictures with Sound Using Spectrogram Art
wat
0
670
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
140
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
260
スマート反転とウェブアクセシビリティ
camiha
0
140
PHPプロジェクトの結合バランスを可視化する #php_night
kajitack
0
230
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
Building Adaptive Systems
keathley
44
3.2k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3k
Mobile First: as difficult as doing things right
swwweet
225
10k
How to Think Like a Performance Engineer
csswizardry
28
2.8k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.9k
Amusing Abliteration
ianozsvald
1
290
Context Engineering - Making Every Token Count
addyosmani
9
1.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
870
Technical Leadership for Architectural Decision Making
baasie
3
560
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