Victor has been murdered, and Art, Bob, and Carl are suspects. Art says he did not do it. He says that Bob was the victim's friend but that Carl hated the victim. Bob says he was out of town the day of the murder, and besides he didn't even know the guy. Carl says he is innocent and he saw Art and Bob with the victim just before the murder. Assuming that everyone - except possibly for the murderer - is telling the truth, encode the facts of the case so that you can use the tools of Propositional Logic to convince people that Bob killed Victor.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Library/Ruby/Site/1.8/rubygems.rb:232:in `activate': undefined method `map' for nil:NilClass (NoMethodError) | |
from /Library/Ruby/Site/1.8/rubygems.rb:258:in `activate' | |
from /Library/Ruby/Site/1.8/rubygems.rb:257:in `each' | |
from /Library/Ruby/Site/1.8/rubygems.rb:257:in `activate' | |
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:33:in `require' | |
from /Users/solomon/Documents/programming/portfolio sites/lorrainelubner/vendor/rails/activerecord/lib/active_record.rb:29 | |
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `gem_original_require' | |
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `require' | |
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:267:in `require_frameworks' | |
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:267:in `each' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Class based AVL balanced binary search tree. | |
Based on designs from: | |
https://interactivepython.org/runestone/static/pythonds/Trees/AVLTreeImplementation.html | |
http://www.geeksforgeeks.org/avl-tree-set-2-deletion/ | |
A tree constists of a single AVL_Tree object and | |
many Node objects. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import time | |
""" | |
Utility Functions and decorators for internal use | |
""" | |
def timeit(method): | |
def timed(*args, **kw): | |
ts = time.time() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from itertools import chain | |
""" | |
Conways Game of Life | |
From Jack Diederich's Presentation "Stop Writing Classes" | |
https://www.youtube.com/watch?v=o9pEzgHorH0 | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Peano where | |
import Test.QuickCheck | |
import Data.Monoid | |
-- p = 1 + p | |
data Peano = Zero | Succ Peano deriving Show | |
-------------------- | |
---- Operations ---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad | |
import Control.Monad.Trans | |
import Control.Monad.Trans.State | |
import Safe (readMay) | |
import System.Exit | |
import System.Random | |
------------- | |
--- Types --- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE | |
DeriveGeneric | |
, DeriveDataTypeable | |
, DeriveFunctor | |
, ScopedTypeVariables | |
, StandaloneDeriving | |
, UndecidableInstances #-} | |
module RecursionSchemes where | |
import Data.List |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mainLoop :: Connection -> Socket -> Endpoint -> IO () | |
mainLoop dbConn sock endpoint = do | |
(sock', _) <- accept sock | |
putStrLn "Got connection, handling query" | |
case endpoint of | |
Fingerd -> handleQuery dbConn sock' >> mainLoop dbConn sock Fingerd | |
Controld -> handleControlQuery dbConn sock' >> mainLoop dbConn sock Controld | |
fingerd :: Integer -> IO () | |
fingerd port = do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# Language | |
FlexibleContexts, | |
UndecidableInstances, | |
TypeSynonymInstances, | |
DeriveGeneric, | |
DeriveDataTypeable, | |
DeriveFunctor, | |
StandaloneDeriving, | |
ScopedTypeVariables, | |
TypeFamilies #-} |
OlderNewer