Skip to content

Instantly share code, notes, and snippets.

@devnoo
Created December 3, 2011 13:20
Show Gist options
  • Save devnoo/1427105 to your computer and use it in GitHub Desktop.
Save devnoo/1427105 to your computer and use it in GitHub Desktop.
Seven languages in seven days : Prolog day 1
| ?- book(What, 'Robert C. Martin').
What = 'Clean code' ? a
What = 'The clean coder'
no
book('Clean code', 'Robert C. Martin').
book('The clean coder', 'Robert C. Martin').
book('Seven languages in seven weeks', 'Bruce A. Tate').
book('Seven databases in seven weeks', 'Eric Redmond').
musician('Jimmy Hendrix').
musician('Slash').
musician('Janine Jansen').
musician('Yo-Yo Ma').
musician_instrument('Jimmy Hendrix', 'Guitar').
musician_instrument('Slash', 'Guitar').
musician_instrument('Janine Jansen', 'Violin').
musician_instrument('Yo-Yo Ma', 'Violin').
musician_genre('Jimmy Hendrix', 'funkrock').
musician_genre('Yo-Yo Ma', 'classical').
musician_genre('Slash', 'hardrock').
musician_genre('Janine Jansen', 'classical').
?-
[musicians]
.
compiling /Users/job/projects/prolog/musicians.pl for byte code...
/Users/job/projects/prolog/musicians.pl compiled, 13 lines read - 1629 bytes written, 11 ms
(1 ms) yes
| ?- musician_instrument(Who, 'Guitar').
Who = 'Jimmy Hendrix' ? a
Who = 'Slash'
no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment