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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
dchart: charts from deck markup
ajstarks
3
990
ThorVG Viewer In VS Code
nors
0
770
AI巻き込み型コードレビューのススメ
nealle
1
160
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
710
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
200
CSC307 Lecture 07
javiergs
PRO
0
550
フルサイクルエンジニアリングをAI Agentで全自動化したい 〜構想と現在地〜
kamina_zzz
0
400
「ブロックテーマでは再現できない」は本当か?
inc2734
0
940
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
6k
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
430
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
680
Featured
See All Featured
Producing Creativity
orderedlist
PRO
348
40k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
61
52k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
92
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.6k
Balancing Empowerment & Direction
lara
5
880
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
100
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
640
Fireside Chat
paigeccino
41
3.8k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
117
110k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
180
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
Marketing to machines
jonoalderson
1
4.6k
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