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
130
0
Share
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
63
Beyond the Rails Way
mario_chavez
1
110
Elm, una mejor manera de hacer frontend
mario_chavez
0
250
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
82
Other Decks in Programming
See All in Programming
AI活用のコスパを最大化する方法
ochtum
0
370
CS教育のDX AIによる育成の効率化
niftycorp
PRO
0
180
Goの型安全性で実現する複数プロダクトの権限管理
ishikawa_pro
2
1.4k
KagglerがMixSeekを触ってみた
morim
0
360
How to stabilize UI tests using XCTest
akkeylab
0
150
モックわからないマン卒業記 ~振る舞いを起点に見直した、フロントエンドテストにおけるモックの使いどころ~
tasukuwatanabe
3
440
「接続」—パフォーマンスチューニングの最後の一手 〜点と点を結ぶ、その一瞬のために〜
kentaroutakeda
5
2.4k
脱 雰囲気実装!AgentCoreを良い感じにWEBアプリケーションに組み込むために
takuyay0ne
3
430
Codex CLIのSubagentsによる並列API実装 / Parallel API Implementation with Codex CLI Subagents
takatty
2
770
Smarter Angular mit Transformers.js & Prompt API
christianliebel
PRO
1
110
RSAが破られる前に知っておきたい 耐量子計算機暗号(PQC)入門 / Intro to PQC: Preparing for the Post-RSA Era
mackey0225
3
110
モダンOBSプラグイン開発
umireon
0
190
Featured
See All Featured
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
350
Testing 201, or: Great Expectations
jmmastey
46
8.1k
How to build a perfect <img>
jonoalderson
1
5.3k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
390
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
250
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
For a Future-Friendly Web
brad_frost
183
10k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.4k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
320
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.6k
How to train your dragon (web standard)
notwaldorf
97
6.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