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
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
220
AIエージェントのキホンから学ぶ「エージェンティックコーディング」実践入門
masahiro_nishimi
4
310
QAフローを最適化し、品質水準を満たしながらリリースまでの期間を最短化する #RSGT2026
shibayu36
2
4.3k
AI時代のキャリアプラン「技術の引力」からの脱出と「問い」へのいざない / tech-gravity
minodriven
20
6.8k
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
380
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
180
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
450
今こそ知るべき耐量子計算機暗号(PQC)入門 / PQC: What You Need to Know Now
mackey0225
3
370
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
4
250
Package Management Learnings from Homebrew
mikemcquaid
0
210
AI Agent の開発と運用を支える Durable Execution #AgentsInProd
izumin5210
7
2.3k
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
610
Featured
See All Featured
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
120
Testing 201, or: Great Expectations
jmmastey
46
8k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
The Cost Of JavaScript in 2023
addyosmani
55
9.5k
Evolving SEO for Evolving Search Engines
ryanjones
0
120
ラッコキーワード サービス紹介資料
rakko
1
2.2M
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
0
270
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.5k
Building an army of robots
kneath
306
46k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
150
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
62
49k
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