Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Logic Programming
Search
Mario Alberto Chávez
October 14, 2014
Programming
160
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
Transcript
13 slides
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
More Decks by Mario Alberto Chávez
See All by Mario Alberto Chávez
Ruby Internals V3
mario_chavez
0
77
Beyond the Rails Way
mario_chavez
1
140
Elm, una mejor manera de hacer frontend
mario_chavez
0
260
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
140
El nuevo comercio electrónico
mario_chavez
0
96
Other Decks in Programming
See All in Programming
将来の標準フォーマッター?ktfmtを深堀る
t45k
0
110
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
290
ローカルLLMの基本と近況 2611 / Local LLM basics and recent situation 2611
kishida
2
450
Enforcing Your Architecture with Unit Tests in the AI Era (Swift Connection X)
steliosf
PRO
1
180
仕様駆動開発入門 (何を作るかを先に決めて渡す) | 目指せ Kiro マスター 05
inariku
PRO
2
160
学びを記事・スライド・Xへ高速展開する― AI-assisted Learning Loopで回すコンテンツ生成術
ochtum
0
210
Materialが消えた日 〜真っ白なFlutterキャンバスにRenderObjectで絵を描く〜
umigishiaoi
0
160
Getting Started with Vibe Coding
miccheng
0
230
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
130
Growing PicoRuby's Ecosystem on ESP32
yuuu
2
140
protojson における文字化けの扱い
kazuki1023
0
430
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
330
Featured
See All Featured
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
990
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
810
Test your architecture with Archunit
thirion
2
2.5k
Docker and Python
trallard
47
4.3k
Claude Code のすすめ
schroneko
67
230k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
830
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.4k
Utilizing Notion as your number one productivity tool
mfonobong
4
640
Documentation Writing (for coders)
carmenintech
77
5.6k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
600
We Are The Robots
honzajavorek
0
440
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
620