Add CT331 Programming Paradigms
@ -0,0 +1,34 @@
|
||||
(TeX-add-style-hook
|
||||
"CT331-Assignment-3"
|
||||
(lambda ()
|
||||
(TeX-add-to-alist 'LaTeX-provided-class-options
|
||||
'(("article" "a4paper")))
|
||||
(TeX-add-to-alist 'LaTeX-provided-package-options
|
||||
'(("babel" "english") ("hyperref" "final" "colorlinks=false" "urlcolor=cyan") ("datetime" "yyyymmdd")))
|
||||
(add-to-list 'LaTeX-verbatim-environments-local "minted")
|
||||
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "href")
|
||||
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperimage")
|
||||
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperbaseurl")
|
||||
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "nolinkurl")
|
||||
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "url")
|
||||
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "path")
|
||||
(add-to-list 'LaTeX-verbatim-macros-with-delims-local "path")
|
||||
(TeX-run-style-hooks
|
||||
"latex2e"
|
||||
"article"
|
||||
"art10"
|
||||
"microtype"
|
||||
"babel"
|
||||
"hyperref"
|
||||
"changepage"
|
||||
"fontspec"
|
||||
"minted"
|
||||
"xcolor"
|
||||
"pgfplots"
|
||||
"caption"
|
||||
"datetime"
|
||||
"titlesec")
|
||||
(LaTeX-add-environments
|
||||
"code"))
|
||||
:latex)
|
||||
|
@ -0,0 +1,295 @@
|
||||
%! TeX program = lualatex
|
||||
\documentclass[a4paper]{article}
|
||||
|
||||
% packages
|
||||
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
|
||||
\usepackage[english]{babel} % Language hyphenation and typographical rules
|
||||
\usepackage[final, colorlinks = false, urlcolor = cyan]{hyperref}
|
||||
\usepackage{changepage} % adjust margins on the fly
|
||||
\usepackage{fontspec}
|
||||
|
||||
\usepackage{minted}
|
||||
% \usemintedstyle{algol_nu}
|
||||
\usepackage{xcolor}
|
||||
|
||||
\usepackage{pgfplots}
|
||||
\pgfplotsset{width=\textwidth,compat=1.9}
|
||||
|
||||
\usepackage{caption}
|
||||
\newenvironment{code}{\captionsetup{type=listing}}{}
|
||||
\captionsetup[listing]{skip=0pt}
|
||||
\setlength{\abovecaptionskip}{5pt}
|
||||
\setlength{\belowcaptionskip}{5pt}
|
||||
|
||||
\usepackage[yyyymmdd]{datetime}
|
||||
\renewcommand{\dateseparator}{--}
|
||||
\setmainfont{EB Garamond}
|
||||
\setmonofont[Scale=MatchLowercase]{Deja Vu Sans Mono}
|
||||
|
||||
\usepackage{titlesec}
|
||||
% \titleformat{\section}{\LARGE\bfseries}{}{}{}[\titlerule]
|
||||
% \titleformat{\subsection}{\Large\bfseries}{}{0em}{}
|
||||
% \titlespacing{\subsection}{0em}{-0.7em}{0em}
|
||||
%
|
||||
% \titleformat{\subsubsection}{\large\bfseries}{}{0em}{$\bullet$ }
|
||||
% \titlespacing{\subsubsection}{1em}{-0.7em}{0em}
|
||||
|
||||
% margins
|
||||
\addtolength{\hoffset}{-2.25cm}
|
||||
\addtolength{\textwidth}{4.5cm}
|
||||
\addtolength{\voffset}{-3.25cm}
|
||||
\addtolength{\textheight}{5cm}
|
||||
\setlength{\parskip}{0pt}
|
||||
\setlength{\parindent}{0in}
|
||||
% \setcounter{secnumdepth}{0}
|
||||
|
||||
\begin{document}
|
||||
\hrule \medskip
|
||||
\begin{minipage}{0.295\textwidth}
|
||||
\raggedright
|
||||
\footnotesize
|
||||
Name: Andrew Hayes \\
|
||||
E-mail: \href{mailto://a.hayes18@universityofgalway.ie}{\texttt{a.hayes18@universityofgalway.ie}} \hfill\\
|
||||
ID: 21321503 \hfill
|
||||
\end{minipage}
|
||||
\begin{minipage}{0.4\textwidth}
|
||||
\centering
|
||||
\vspace{0.4em}
|
||||
\Large
|
||||
\textbf{CT331} \\
|
||||
\end{minipage}
|
||||
\begin{minipage}{0.295\textwidth}
|
||||
\raggedleft
|
||||
\today
|
||||
\end{minipage}
|
||||
\medskip\hrule
|
||||
\begin{center}
|
||||
\normalsize
|
||||
Assignment 3: Declarative Programming with Prolog
|
||||
\end{center}
|
||||
\hrule
|
||||
|
||||
\section{Question 1}
|
||||
\subsection{Rule that returns true if a given instructor teaches a given student}
|
||||
\begin{minted}[linenos, breaklines, frame=single]{prolog}
|
||||
teaches(Instructor, Student) :- instructs(Instructor, Course), takes(Student, Course).
|
||||
\end{minted}
|
||||
|
||||
\subsection{Query that uses the \mintinline{prolog}{teaches} rule to show all students instructed by \mintinline{prolog}{bob}}
|
||||
For this, I wasn't sure if the desired answer was a query that returned a student instructed by \mintinline{prolog}{bob}, followed by
|
||||
a couple semi-colons to get every student instructed by \mintinline{prolog}{bob}, or if the desired answer was a single query that
|
||||
returned a list of students taught by \mintinline{prolog}{bob}, so I did both.
|
||||
\begin{minted}[linenos, breaklines, frame=single]{prolog}
|
||||
?- teaches(bob, Student).
|
||||
\end{minted}
|
||||
|
||||
\begin{figure}[H]
|
||||
\includegraphics[width=\textwidth]{./images/q1.2.png}
|
||||
\caption{Using the \mintinline{prolog}{teaches} rule to show all students instructed by \mintinline{prolog}{bob}}
|
||||
\end{figure}
|
||||
|
||||
Alternatively, this could be done using the \mintinline{prolog}{findall()} predicate:
|
||||
\begin{minted}[linenos, breaklines, frame=single]{prolog}
|
||||
?- findall(Student, teaches(bob, Student), Students).
|
||||
\end{minted}
|
||||
|
||||
\begin{figure}[H]
|
||||
\includegraphics[width=\textwidth]{./images/q1_2_findall.png}
|
||||
\caption{Using the \mintinline{prolog}{teaches} rule \& the \mintinline{prolog}{findall} predicate to show all students instructed by \mintinline{prolog}{bob}}
|
||||
\end{figure}
|
||||
|
||||
\subsection{Query that uses the \mintinline{prolog}{teaches} rule to show all instructors that instruct \mintinline{prolog}{mary}}
|
||||
\begin{minted}[linenos, breaklines, frame=single]{prolog}
|
||||
?- teaches(Instructor, mary).
|
||||
\end{minted}
|
||||
|
||||
\begin{figure}[H]
|
||||
\includegraphics[width=\textwidth]{./images/q1_3.png}
|
||||
\caption{Using the \mintinline{prolog}{teaches} rule to show all instructors that instruct \mintinline{prolog}{mary}}
|
||||
\end{figure}
|
||||
|
||||
Alternatively, this could be done using the \mintinline{prolog}{findall()} predicate:
|
||||
\begin{minted}[linenos, breaklines, frame=single]{prolog}
|
||||
?- findall(Instructor, teaches(Instructor, mary), Instructors).
|
||||
\end{minted}
|
||||
|
||||
\begin{figure}[H]
|
||||
\includegraphics[width=\textwidth]{./images/q1_3_findall.png}
|
||||
\caption{Using the \mintinline{prolog}{teaches()} rule \& the \mintinline{prolog}{findall()} predicate to show all instructors that instruct \mintinline{prolog}{mary}}
|
||||
\end{figure}
|
||||
|
||||
\subsection{Result of query \mintinline{prolog}{teaches(ann,joe).}}
|
||||
\begin{figure}[H]
|
||||
\includegraphics[width=\textwidth]{./images/q1_4.png}
|
||||
\caption{Result of query \mintinline{prolog}{teaches(ann,joe).}}
|
||||
\end{figure}
|
||||
|
||||
The result of the query \mintinline{prolog}{teaches(ann,joe).} is \mintinline{prolog}{false.} because \mintinline{prolog}{ann}
|
||||
only instructs \mintinline{prolog}{ct345} and \mintinline{prolog}{joe} only takes \mintinline{prolog}{ct331}, and therefore
|
||||
\mintinline{prolog}{ann} does not teach \mintinline{prolog}{joe} because \mintinline{prolog}{ann} does not teach a course
|
||||
that \mintinline{prolog}{joe} takes.
|
||||
|
||||
\subsection{Rule that returns \mintinline{prolog}{true} if two students take the same course}
|
||||
\begin{minted}[linenos, breaklines, frame=single]{prolog}
|
||||
takesSameCourse(Student1, Student2) :- takes(Student1, Course), takes(Student2, Course).
|
||||
\end{minted}
|
||||
|
||||
\begin{figure}[H]
|
||||
\includegraphics[width=\textwidth]{./images/q1_5.png}
|
||||
\caption{Queries to test \mintinline{prolog}{takesSameCourse()}}
|
||||
\end{figure}
|
||||
|
||||
\begin{minted}[linenos, breaklines, frame=single]{prolog}
|
||||
?- takesSameCourse(tom,mary).
|
||||
?- takesSameCourse(joe,mary).
|
||||
?- takesSameCourse(joe,tom).
|
||||
?- takesSameCourse(bob, mary).
|
||||
\end{minted}
|
||||
|
||||
\section{Question 2}
|
||||
\subsection{Query that displays the head \& tail of a list}
|
||||
\begin{minted}[linenos, breaklines, frame=single]{prolog}
|
||||
?- [Head | Tail] = [1,2,3].
|
||||
\end{minted}
|
||||
|
||||
\begin{figure}[H]
|
||||
\includegraphics[width=\textwidth]{./images/q2_1.png}
|
||||
\caption{Query to display the head \& tail of the list \mintinline{prolog}{[1,2,3]}}
|
||||
\end{figure}
|
||||
|
||||
\subsection{Display the head of a list, the head of the tail of the list, \& the tail of the tail of the list}
|
||||
\begin{minted}[linenos, breaklines, frame=single]{prolog}
|
||||
?- [Head | [HeadOfTail | TailOfTail]] = [1,2,3,4,5].
|
||||
\end{minted}
|
||||
|
||||
\begin{figure}[H]
|
||||
\includegraphics[width=\textwidth]{./images/q2_2.png}
|
||||
\caption{Query to display the head of the list, the head of the tail of the list, \& the tail of the tail of the list \mintinline{prolog}{[1,2,3,4,5]}}
|
||||
\end{figure}
|
||||
|
||||
\subsection{Rule that returns \mintinline{prolog}{true} if a given element is the first element of a given list}
|
||||
\begin{minted}[linenos, breaklines, frame=single]{prolog}
|
||||
contains1(Element, [Element | Tail]).
|
||||
|
||||
?- contains1(1, [1,2,3,4]).
|
||||
?- contains1(3, [1,2,3,4]).
|
||||
?- contains1(1, [2,3,4]).
|
||||
\end{minted}
|
||||
|
||||
\begin{figure}[H]
|
||||
\includegraphics[width=\textwidth]{./images/q2_3.png}
|
||||
\caption{\mintinline{prolog}{contains1()} testing}
|
||||
\end{figure}
|
||||
|
||||
\subsection{Rule that returns \mintinline{prolog}{true} if a given list is the same as the tail of another given list}
|
||||
\begin{minted}[linenos, breaklines, frame=single]{prolog}
|
||||
contains2(Sublist, [Head | Sublist]).
|
||||
|
||||
?- contains2([2,3,4], [1,2,3,4]).
|
||||
?- contains2([2,3,4], [1,2,3,4,5]).
|
||||
\end{minted}
|
||||
|
||||
\begin{figure}[H]
|
||||
\includegraphics[width=\textwidth]{./images/q2_4.png}
|
||||
\caption{\mintinline{prolog}{contains2()} testing}
|
||||
\end{figure}
|
||||
|
||||
\subsection{Query to display the first element of a given list using \mintinline{prolog}{contains1()}}
|
||||
\begin{minted}[linenos, breaklines, frame=single]{prolog}
|
||||
?- contains1(FirstElement, [1,2,3,4,5]).
|
||||
\end{minted}
|
||||
|
||||
\begin{figure}[H]
|
||||
\includegraphics[width=\textwidth]{./images/q2_5.png}
|
||||
\caption{Query to display the first element of a given list using \mintinline{prolog}{contains1()}}
|
||||
\end{figure}
|
||||
|
||||
\section{Determine if a given element is not in a given list}
|
||||
\begin{minted}[linenos, breaklines, frame=single]{prolog}
|
||||
% base case: any element is not in an empty list
|
||||
isNotElementInList(_, []).
|
||||
|
||||
% return true if Element is not the Head of the list and it's not found recursively searching the rest of the list
|
||||
isNotElementInList(Element, [Head | Tail]) :- Element \= Head, isNotElementInList(Element, Tail).
|
||||
|
||||
% testing
|
||||
isNotElementInList(1, []).
|
||||
isNotElementInList(1, [1]).
|
||||
isNotElementInList(1, [2]).
|
||||
isNotElementInList(2, [1, 2, 3]).
|
||||
isNotElementInList(7, [1, 2, 9, 4, 5]).
|
||||
\end{minted}
|
||||
|
||||
\begin{figure}[H]
|
||||
\includegraphics[width=\textwidth]{./images/q3.png}
|
||||
\caption{Testing \mintinline{prolog}{isNotElementInList()}}
|
||||
\end{figure}
|
||||
|
||||
\section{Facts \& rules to merge three lists}
|
||||
\begin{minted}[linenos, breaklines, frame=single]{prolog}
|
||||
% predicate to merge two lists
|
||||
% base case: if the first list is empty, just return the second
|
||||
mergeTwoLists([], List, List).
|
||||
|
||||
% recursive predicate to merge two lists
|
||||
% split the first list into head and tail, and recurse with its tail and the second list until the first list is empty (base case)
|
||||
% then merge the original head of the first list with the resulting tail
|
||||
mergeTwoLists([Head | Tail], List2, [Head | ResultTail]) :- mergeTwoLists(Tail, List2, ResultTail).
|
||||
|
||||
% predicate to merge 3 lists
|
||||
% base case: merging an empty list and two others is the same as merging two lists
|
||||
mergeLists([], List2, List3, Merged) :- mergeTwoLists(List2, List3, Merged).
|
||||
|
||||
% split the first list into head and tail, and recurse with its tail and the other two lists until the first list is empty (base case)
|
||||
mergeLists([Head1 | Tail1], List2, List3, [Head1 | MergedTail]) :- mergeLists(Tail1, List2, List3, MergedTail).
|
||||
|
||||
?- mergeLists([7],[1,2,3],[6,7,8], X).
|
||||
?- mergeLists([2], [1], [0], X).
|
||||
?- mergeLists([1], [], [], X).
|
||||
\end{minted}
|
||||
|
||||
\begin{figure}[H]
|
||||
\includegraphics[width=\textwidth]{./images/q4.png}
|
||||
\caption{Testing \mintinline{prolog}{mergeLists()}}
|
||||
\end{figure}
|
||||
|
||||
\section{Facts \& rules to reverse a given list}
|
||||
\begin{minted}[linenos, breaklines, frame=single]{prolog}
|
||||
% call the helper predicate with the list to be reversed and an empty Accumulator to build up
|
||||
reverseList(List, Reversed) :- reverseListHelper(List, [], Reversed).
|
||||
|
||||
% base case fact: when the list to reverse is empty, the accumulator is the reversed list
|
||||
reverseListHelper([], Accumulator, Accumulator).
|
||||
|
||||
% recurse with the tail after prepending the head to the accumulator
|
||||
reverseListHelper([Head | Tail], Accumulator, Reversed) :- reverseListHelper(Tail, [Head | Accumulator], Reversed).
|
||||
|
||||
?- reverseList([1,2,3], X).
|
||||
?- reverseList([1], X).
|
||||
?- reverseList([], X).
|
||||
\end{minted}
|
||||
|
||||
\begin{figure}[H]
|
||||
\includegraphics[width=\textwidth]{./images/q5.png}
|
||||
\caption{Testing \mintinline{prolog}{reverseList()}}
|
||||
\end{figure}
|
||||
|
||||
\section{Facts \& rules to insert an element into its correct position in a given list}
|
||||
\begin{minted}[linenos, breaklines, frame=single]{prolog}
|
||||
% base fact: if the list is empty, the list to be returned is just the element
|
||||
insertInOrder(Element, [], [Element]).
|
||||
|
||||
% if the element to be inserted is <= the head of the list, insert it at the head of the list
|
||||
insertInOrder(Element, [Head | Tail], [Element, Head | Tail]) :- Element =< Head.
|
||||
|
||||
% if the element to be inserted is greater than the head of the list, recurse with the tail of the list until
|
||||
insertInOrder(Element, [Head | Tail], [Head | NewTail]) :- Element > Head, insertInOrder(Element, Tail, NewTail).
|
||||
\end{minted}
|
||||
|
||||
\begin{figure}[H]
|
||||
\includegraphics[width=\textwidth]{./images/q6.png}
|
||||
\caption{Testing \mintinline{prolog}{insertInOrder()}}
|
||||
\end{figure}
|
||||
|
||||
|
||||
\end{document}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{n+nf}{insertInOrder}\PYG{p}{()}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{n+nf}{reverseList}\PYG{p}{()}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{ct345}
|
||||
\end{Verbatim}
|
@ -0,0 +1,21 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{c+c1}{\PYGZpc{} predicate to merge two lists}
|
||||
\PYG{c+c1}{\PYGZpc{} base case: if the first list is empty, just return the second}
|
||||
\PYG{n+nf}{mergeTwoLists}\PYG{p}{([],} \PYG{n+nv}{List}\PYG{p}{,} \PYG{n+nv}{List}\PYG{p}{).}
|
||||
|
||||
\PYG{c+c1}{\PYGZpc{} recursive predicate to merge two lists}
|
||||
\PYG{c+c1}{\PYGZpc{} split the first list into head and tail, and recurse with its tail and the second list until the first list is empty (base case)}
|
||||
\PYG{c+c1}{\PYGZpc{} then merge the original head of the first list with the resulting tail}
|
||||
\PYG{n+nf}{mergeTwoLists}\PYG{p}{([}\PYG{n+nv}{Head} \PYG{p}{|} \PYG{n+nv}{Tail}\PYG{p}{],} \PYG{n+nv}{List2}\PYG{p}{,} \PYG{p}{[}\PYG{n+nv}{Head} \PYG{p}{|} \PYG{n+nv}{ResultTail}\PYG{p}{])} \PYG{p}{:\PYGZhy{}} \PYG{n+nf}{mergeTwoLists}\PYG{p}{(}\PYG{n+nv}{Tail}\PYG{p}{,} \PYG{n+nv}{List2}\PYG{p}{,} \PYG{n+nv}{ResultTail}\PYG{p}{).}
|
||||
|
||||
\PYG{c+c1}{\PYGZpc{} predicate to merge 3 lists}
|
||||
\PYG{c+c1}{\PYGZpc{} base case: merging an empty list and two others is the same as merging two lists}
|
||||
\PYG{n+nf}{mergeLists}\PYG{p}{([],} \PYG{n+nv}{List2}\PYG{p}{,} \PYG{n+nv}{List3}\PYG{p}{,} \PYG{n+nv}{Merged}\PYG{p}{)} \PYG{p}{:\PYGZhy{}} \PYG{n+nf}{mergeTwoLists}\PYG{p}{(}\PYG{n+nv}{List2}\PYG{p}{,} \PYG{n+nv}{List3}\PYG{p}{,} \PYG{n+nv}{Merged}\PYG{p}{).}
|
||||
|
||||
\PYG{c+c1}{\PYGZpc{} split the first list into head and tail, and recurse with its tail and the other two lists until the first list is empty (base case)}
|
||||
\PYG{n+nf}{mergeLists}\PYG{p}{([}\PYG{n+nv}{Head1} \PYG{p}{|} \PYG{n+nv}{Tail1}\PYG{p}{],} \PYG{n+nv}{List2}\PYG{p}{,} \PYG{n+nv}{List3}\PYG{p}{,} \PYG{p}{[}\PYG{n+nv}{Head1} \PYG{p}{|} \PYG{n+nv}{MergedTail}\PYG{p}{])} \PYG{p}{:\PYGZhy{}} \PYG{n+nf}{mergeLists}\PYG{p}{(}\PYG{n+nv}{Tail1}\PYG{p}{,} \PYG{n+nv}{List2}\PYG{p}{,} \PYG{n+nv}{List3}\PYG{p}{,} \PYG{n+nv}{MergedTail}\PYG{p}{).}
|
||||
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{mergeLists}\PYG{p}{([}\PYG{l+m+mi}{7}\PYG{p}{],[}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{2}\PYG{p}{,}\PYG{l+m+mi}{3}\PYG{p}{],[}\PYG{l+m+mi}{6}\PYG{p}{,}\PYG{l+m+mi}{7}\PYG{p}{,}\PYG{l+m+mi}{8}\PYG{p}{],} \PYG{n+nv}{X}\PYG{p}{).}
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{mergeLists}\PYG{p}{([}\PYG{l+m+mi}{2}\PYG{p}{],} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{],} \PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{],} \PYG{n+nv}{X}\PYG{p}{).}
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{mergeLists}\PYG{p}{([}\PYG{l+m+mi}{1}\PYG{p}{],} \PYG{p}{[],} \PYG{p}{[],} \PYG{n+nv}{X}\PYG{p}{).}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{findall}\PYG{p}{(}\PYG{n+nv}{Student}\PYG{p}{,} \PYG{n+nf}{teaches}\PYG{p}{(}\PYG{l+s+sAtom}{bob}\PYG{p}{,} \PYG{n+nv}{Student}\PYG{p}{),} \PYG{n+nv}{Students}\PYG{p}{).}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{contains1}\PYG{p}{(}\PYG{n+nv}{FirstElement}\PYG{p}{,} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{2}\PYG{p}{,}\PYG{l+m+mi}{3}\PYG{p}{,}\PYG{l+m+mi}{4}\PYG{p}{,}\PYG{l+m+mi}{5}\PYG{p}{]).}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{findall}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{teaches}\PYG{p}{(}\PYG{l+s+sAtom}{bob}\PYG{p}{,} \PYG{n+nv}{Student}\PYG{p}{).}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{2}\PYG{p}{,}\PYG{l+m+mi}{3}\PYG{p}{,}\PYG{l+m+mi}{4}\PYG{p}{,}\PYG{l+m+mi}{5}\PYG{p}{]}
|
||||
\end{Verbatim}
|
@ -0,0 +1,7 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{n+nf}{contains1}\PYG{p}{(}\PYG{n+nv}{Element}\PYG{p}{,} \PYG{p}{[}\PYG{n+nv}{Element} \PYG{p}{|} \PYG{n+nv}{Tail}\PYG{p}{]).}
|
||||
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{contains1}\PYG{p}{(}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{2}\PYG{p}{,}\PYG{l+m+mi}{3}\PYG{p}{,}\PYG{l+m+mi}{4}\PYG{p}{]).}
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{contains1}\PYG{p}{(}\PYG{l+m+mi}{3}\PYG{p}{,} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{2}\PYG{p}{,}\PYG{l+m+mi}{3}\PYG{p}{,}\PYG{l+m+mi}{4}\PYG{p}{]).}
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{contains1}\PYG{p}{(}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{,}\PYG{l+m+mi}{3}\PYG{p}{,}\PYG{l+m+mi}{4}\PYG{p}{]).}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{p}{[}\PYG{n+nv}{Head} \PYG{p}{|} \PYG{p}{[}\PYG{n+nv}{HeadOfTail} \PYG{p}{|} \PYG{n+nv}{TailOfTail}\PYG{p}{]]} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{2}\PYG{p}{,}\PYG{l+m+mi}{3}\PYG{p}{,}\PYG{l+m+mi}{4}\PYG{p}{,}\PYG{l+m+mi}{5}\PYG{p}{].}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{true}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{n+nf}{mergeLists}\PYG{p}{()}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{findall}\PYG{p}{(}\PYG{n+nv}{Instructor}\PYG{p}{,} \PYG{n+nf}{teaches}\PYG{p}{(}\PYG{n+nv}{Instructor}\PYG{p}{,} \PYG{l+s+sAtom}{mary}\PYG{p}{),} \PYG{n+nv}{Instructors}\PYG{p}{).}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{ann}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{n+nf}{teaches}\PYG{p}{(}\PYG{n+nv}{Instructor}\PYG{p}{,} \PYG{n+nv}{Student}\PYG{p}{)} \PYG{p}{:\PYGZhy{}} \PYG{n+nf}{instructs}\PYG{p}{(}\PYG{n+nv}{Instructor}\PYG{p}{,} \PYG{n+nv}{Course}\PYG{p}{),} \PYG{n+nf}{takes}\PYG{p}{(}\PYG{n+nv}{Student}\PYG{p}{,} \PYG{n+nv}{Course}\PYG{p}{).}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{2}\PYG{p}{,}\PYG{l+m+mi}{3}\PYG{p}{]}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{n+nf}{takesSameCourse}\PYG{p}{()}
|
||||
\end{Verbatim}
|
@ -0,0 +1,6 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{n+nf}{contains2}\PYG{p}{(}\PYG{n+nv}{Sublist}\PYG{p}{,} \PYG{p}{[}\PYG{n+nv}{Head} \PYG{p}{|} \PYG{n+nv}{Sublist}\PYG{p}{]).}
|
||||
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{contains2}\PYG{p}{([}\PYG{l+m+mi}{2}\PYG{p}{,}\PYG{l+m+mi}{3}\PYG{p}{,}\PYG{l+m+mi}{4}\PYG{p}{],} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{2}\PYG{p}{,}\PYG{l+m+mi}{3}\PYG{p}{,}\PYG{l+m+mi}{4}\PYG{p}{]).}
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{contains2}\PYG{p}{([}\PYG{l+m+mi}{2}\PYG{p}{,}\PYG{l+m+mi}{3}\PYG{p}{,}\PYG{l+m+mi}{4}\PYG{p}{],} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{2}\PYG{p}{,}\PYG{l+m+mi}{3}\PYG{p}{,}\PYG{l+m+mi}{4}\PYG{p}{,}\PYG{l+m+mi}{5}\PYG{p}{]).}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{mary}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{n+nf}{teaches}\PYG{p}{()}
|
||||
\end{Verbatim}
|
@ -0,0 +1,6 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{takesSameCourse}\PYG{p}{(}\PYG{l+s+sAtom}{tom}\PYG{p}{,}\PYG{l+s+sAtom}{mary}\PYG{p}{).}
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{takesSameCourse}\PYG{p}{(}\PYG{l+s+sAtom}{joe}\PYG{p}{,}\PYG{l+s+sAtom}{mary}\PYG{p}{).}
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{takesSameCourse}\PYG{p}{(}\PYG{l+s+sAtom}{joe}\PYG{p}{,}\PYG{l+s+sAtom}{tom}\PYG{p}{).}
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{takesSameCourse}\PYG{p}{(}\PYG{l+s+sAtom}{bob}\PYG{p}{,} \PYG{l+s+sAtom}{mary}\PYG{p}{).}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{teaches}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{teaches}\PYG{p}{(}\PYG{n+nv}{Instructor}\PYG{p}{,} \PYG{l+s+sAtom}{mary}\PYG{p}{).}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{n+nf}{contains1}\PYG{p}{()}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{n+nf}{contains2}\PYG{p}{()}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{n+nf}{takesSameCourse}\PYG{p}{(}\PYG{n+nv}{Student1}\PYG{p}{,} \PYG{n+nv}{Student2}\PYG{p}{)} \PYG{p}{:\PYGZhy{}} \PYG{n+nf}{takes}\PYG{p}{(}\PYG{n+nv}{Student1}\PYG{p}{,} \PYG{n+nv}{Course}\PYG{p}{),} \PYG{n+nf}{takes}\PYG{p}{(}\PYG{n+nv}{Student2}\PYG{p}{,} \PYG{n+nv}{Course}\PYG{p}{).}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{false}\PYG{p}{.}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{n+nf}{teaches}\PYG{p}{(}\PYG{l+s+sAtom}{ann}\PYG{p}{,}\PYG{l+s+sAtom}{joe}\PYG{p}{).}
|
||||
\end{Verbatim}
|
@ -0,0 +1,14 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{c+c1}{\PYGZpc{} base case: any element is not in an empty list}
|
||||
\PYG{n+nf}{isNotElementInList}\PYG{p}{(}\PYG{k}{\PYGZus{}}\PYG{p}{,} \PYG{p}{[]).}
|
||||
|
||||
\PYG{c+c1}{\PYGZpc{} return true if Element is not the Head of the list and it\PYGZsq{}s not found recursively searching the rest of the list}
|
||||
\PYG{n+nf}{isNotElementInList}\PYG{p}{(}\PYG{n+nv}{Element}\PYG{p}{,} \PYG{p}{[}\PYG{n+nv}{Head} \PYG{p}{|} \PYG{n+nv}{Tail}\PYG{p}{])} \PYG{p}{:\PYGZhy{}} \PYG{n+nv}{Element} \PYG{l+s+sAtom}{\PYGZbs{}=} \PYG{n+nv}{Head}\PYG{p}{,} \PYG{n+nf}{isNotElementInList}\PYG{p}{(}\PYG{n+nv}{Element}\PYG{p}{,} \PYG{n+nv}{Tail}\PYG{p}{).}
|
||||
|
||||
\PYG{c+c1}{\PYGZpc{} testing}
|
||||
\PYG{n+nf}{isNotElementInList}\PYG{p}{(}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{p}{[]).}
|
||||
\PYG{n+nf}{isNotElementInList}\PYG{p}{(}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]).}
|
||||
\PYG{n+nf}{isNotElementInList}\PYG{p}{(}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{p}{[}\PYG{l+m+mi}{2}\PYG{p}{]).}
|
||||
\PYG{n+nf}{isNotElementInList}\PYG{p}{(}\PYG{l+m+mi}{2}\PYG{p}{,} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{]).}
|
||||
\PYG{n+nf}{isNotElementInList}\PYG{p}{(}\PYG{l+m+mi}{7}\PYG{p}{,} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{9}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{,} \PYG{l+m+mi}{5}\PYG{p}{]).}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{joe}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{p}{[}\PYG{n+nv}{Head} \PYG{p}{|} \PYG{n+nv}{Tail}\PYG{p}{]} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{2}\PYG{p}{,}\PYG{l+m+mi}{3}\PYG{p}{].}
|
||||
\end{Verbatim}
|
@ -0,0 +1,14 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{c+c1}{\PYGZpc{} call the helper predicate with the list to be reversed and an empty Accumulator to build up}
|
||||
\PYG{n+nf}{reverseList}\PYG{p}{(}\PYG{n+nv}{List}\PYG{p}{,} \PYG{n+nv}{Reversed}\PYG{p}{)} \PYG{p}{:\PYGZhy{}} \PYG{n+nf}{reverseListHelper}\PYG{p}{(}\PYG{n+nv}{List}\PYG{p}{,} \PYG{p}{[],} \PYG{n+nv}{Reversed}\PYG{p}{).}
|
||||
|
||||
\PYG{c+c1}{\PYGZpc{} base case fact: when the list to reverse is empty, the accumulator is the reversed list}
|
||||
\PYG{n+nf}{reverseListHelper}\PYG{p}{([],} \PYG{n+nv}{Accumulator}\PYG{p}{,} \PYG{n+nv}{Accumulator}\PYG{p}{).}
|
||||
|
||||
\PYG{c+c1}{\PYGZpc{} recurse with the tail after prepending the head to the accumulator}
|
||||
\PYG{n+nf}{reverseListHelper}\PYG{p}{([}\PYG{n+nv}{Head} \PYG{p}{|} \PYG{n+nv}{Tail}\PYG{p}{],} \PYG{n+nv}{Accumulator}\PYG{p}{,} \PYG{n+nv}{Reversed}\PYG{p}{)} \PYG{p}{:\PYGZhy{}} \PYG{n+nf}{reverseListHelper}\PYG{p}{(}\PYG{n+nv}{Tail}\PYG{p}{,} \PYG{p}{[}\PYG{n+nv}{Head} \PYG{p}{|} \PYG{n+nv}{Accumulator}\PYG{p}{],} \PYG{n+nv}{Reversed}\PYG{p}{).}
|
||||
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{reverseList}\PYG{p}{([}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{2}\PYG{p}{,}\PYG{l+m+mi}{3}\PYG{p}{],} \PYG{n+nv}{X}\PYG{p}{).}
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{reverseList}\PYG{p}{([}\PYG{l+m+mi}{1}\PYG{p}{],} \PYG{n+nv}{X}\PYG{p}{).}
|
||||
\PYG{l+s+sAtom}{?\PYGZhy{}} \PYG{n+nf}{reverseList}\PYG{p}{([],} \PYG{n+nv}{X}\PYG{p}{).}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{bob}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{n+nf}{findall}\PYG{p}{()}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{n+nf}{isNotElementInList}\PYG{p}{()}
|
||||
\end{Verbatim}
|
@ -0,0 +1,10 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{c+c1}{\PYGZpc{} base fact: if the list is empty, the list to be returned is just the element}
|
||||
\PYG{n+nf}{insertInOrder}\PYG{p}{(}\PYG{n+nv}{Element}\PYG{p}{,} \PYG{p}{[],} \PYG{p}{[}\PYG{n+nv}{Element}\PYG{p}{]).}
|
||||
|
||||
\PYG{c+c1}{\PYGZpc{} if the element to be inserted is \PYGZlt{}= the head of the list, insert it at the head of the list}
|
||||
\PYG{n+nf}{insertInOrder}\PYG{p}{(}\PYG{n+nv}{Element}\PYG{p}{,} \PYG{p}{[}\PYG{n+nv}{Head} \PYG{p}{|} \PYG{n+nv}{Tail}\PYG{p}{],} \PYG{p}{[}\PYG{n+nv}{Element}\PYG{p}{,} \PYG{n+nv}{Head} \PYG{p}{|} \PYG{n+nv}{Tail}\PYG{p}{])} \PYG{p}{:\PYGZhy{}} \PYG{n+nv}{Element} \PYG{o}{=\PYGZlt{}} \PYG{n+nv}{Head}\PYG{p}{.}
|
||||
|
||||
\PYG{c+c1}{\PYGZpc{} if the element to be inserted is greater than the head of the list, recurse with the tail of the list until}
|
||||
\PYG{n+nf}{insertInOrder}\PYG{p}{(}\PYG{n+nv}{Element}\PYG{p}{,} \PYG{p}{[}\PYG{n+nv}{Head} \PYG{p}{|} \PYG{n+nv}{Tail}\PYG{p}{],} \PYG{p}{[}\PYG{n+nv}{Head} \PYG{p}{|} \PYG{n+nv}{NewTail}\PYG{p}{])} \PYG{p}{:\PYGZhy{}} \PYG{n+nv}{Element} \PYG{o}{\PYGZgt{}} \PYG{n+nv}{Head}\PYG{p}{,} \PYG{n+nf}{insertInOrder}\PYG{p}{(}\PYG{n+nv}{Element}\PYG{p}{,} \PYG{n+nv}{Tail}\PYG{p}{,} \PYG{n+nv}{NewTail}\PYG{p}{).}
|
||||
\end{Verbatim}
|
@ -0,0 +1,3 @@
|
||||
\begin{Verbatim}[commandchars=\\\{\}]
|
||||
\PYG{l+s+sAtom}{ct331}
|
||||
\end{Verbatim}
|
@ -0,0 +1,102 @@
|
||||
|
||||
\makeatletter
|
||||
\def\PYG@reset{\let\PYG@it=\relax \let\PYG@bf=\relax%
|
||||
\let\PYG@ul=\relax \let\PYG@tc=\relax%
|
||||
\let\PYG@bc=\relax \let\PYG@ff=\relax}
|
||||
\def\PYG@tok#1{\csname PYG@tok@#1\endcsname}
|
||||
\def\PYG@toks#1+{\ifx\relax#1\empty\else%
|
||||
\PYG@tok{#1}\expandafter\PYG@toks\fi}
|
||||
\def\PYG@do#1{\PYG@bc{\PYG@tc{\PYG@ul{%
|
||||
\PYG@it{\PYG@bf{\PYG@ff{#1}}}}}}}
|
||||
\def\PYG#1#2{\PYG@reset\PYG@toks#1+\relax+\PYG@do{#2}}
|
||||
|
||||
\@namedef{PYG@tok@w}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}}
|
||||
\@namedef{PYG@tok@c}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
|
||||
\@namedef{PYG@tok@cp}{\def\PYG@tc##1{\textcolor[rgb]{0.61,0.40,0.00}{##1}}}
|
||||
\@namedef{PYG@tok@k}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
||||
\@namedef{PYG@tok@kp}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
||||
\@namedef{PYG@tok@kt}{\def\PYG@tc##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}}
|
||||
\@namedef{PYG@tok@o}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
|
||||
\@namedef{PYG@tok@ow}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
|
||||
\@namedef{PYG@tok@nb}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
||||
\@namedef{PYG@tok@nf}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
|
||||
\@namedef{PYG@tok@nc}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
|
||||
\@namedef{PYG@tok@nn}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
|
||||
\@namedef{PYG@tok@ne}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.80,0.25,0.22}{##1}}}
|
||||
\@namedef{PYG@tok@nv}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
|
||||
\@namedef{PYG@tok@no}{\def\PYG@tc##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}}
|
||||
\@namedef{PYG@tok@nl}{\def\PYG@tc##1{\textcolor[rgb]{0.46,0.46,0.00}{##1}}}
|
||||
\@namedef{PYG@tok@ni}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.44,0.44,0.44}{##1}}}
|
||||
\@namedef{PYG@tok@na}{\def\PYG@tc##1{\textcolor[rgb]{0.41,0.47,0.13}{##1}}}
|
||||
\@namedef{PYG@tok@nt}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
||||
\@namedef{PYG@tok@nd}{\def\PYG@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
|
||||
\@namedef{PYG@tok@s}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
|
||||
\@namedef{PYG@tok@sd}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
|
||||
\@namedef{PYG@tok@si}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.64,0.35,0.47}{##1}}}
|
||||
\@namedef{PYG@tok@se}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.67,0.36,0.12}{##1}}}
|
||||
\@namedef{PYG@tok@sr}{\def\PYG@tc##1{\textcolor[rgb]{0.64,0.35,0.47}{##1}}}
|
||||
\@namedef{PYG@tok@ss}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
|
||||
\@namedef{PYG@tok@sx}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
||||
\@namedef{PYG@tok@m}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
|
||||
\@namedef{PYG@tok@gh}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
|
||||
\@namedef{PYG@tok@gu}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}}
|
||||
\@namedef{PYG@tok@gd}{\def\PYG@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}}
|
||||
\@namedef{PYG@tok@gi}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.52,0.00}{##1}}}
|
||||
\@namedef{PYG@tok@gr}{\def\PYG@tc##1{\textcolor[rgb]{0.89,0.00,0.00}{##1}}}
|
||||
\@namedef{PYG@tok@ge}{\let\PYG@it=\textit}
|
||||
\@namedef{PYG@tok@gs}{\let\PYG@bf=\textbf}
|
||||
\@namedef{PYG@tok@ges}{\let\PYG@bf=\textbf\let\PYG@it=\textit}
|
||||
\@namedef{PYG@tok@gp}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
|
||||
\@namedef{PYG@tok@go}{\def\PYG@tc##1{\textcolor[rgb]{0.44,0.44,0.44}{##1}}}
|
||||
\@namedef{PYG@tok@gt}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}}
|
||||
\@namedef{PYG@tok@err}{\def\PYG@bc##1{{\setlength{\fboxsep}{\string -\fboxrule}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}}}
|
||||
\@namedef{PYG@tok@kc}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
||||
\@namedef{PYG@tok@kd}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
||||
\@namedef{PYG@tok@kn}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
||||
\@namedef{PYG@tok@kr}{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
||||
\@namedef{PYG@tok@bp}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
|
||||
\@namedef{PYG@tok@fm}{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
|
||||
\@namedef{PYG@tok@vc}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
|
||||
\@namedef{PYG@tok@vg}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
|
||||
\@namedef{PYG@tok@vi}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
|
||||
\@namedef{PYG@tok@vm}{\def\PYG@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
|
||||
\@namedef{PYG@tok@sa}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
|
||||
\@namedef{PYG@tok@sb}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
|
||||
\@namedef{PYG@tok@sc}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
|
||||
\@namedef{PYG@tok@dl}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
|
||||
\@namedef{PYG@tok@s2}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
|
||||
\@namedef{PYG@tok@sh}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
|
||||
\@namedef{PYG@tok@s1}{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
|
||||
\@namedef{PYG@tok@mb}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
|
||||
\@namedef{PYG@tok@mf}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
|
||||
\@namedef{PYG@tok@mh}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
|
||||
\@namedef{PYG@tok@mi}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
|
||||
\@namedef{PYG@tok@il}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
|
||||
\@namedef{PYG@tok@mo}{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
|
||||
\@namedef{PYG@tok@ch}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
|
||||
\@namedef{PYG@tok@cm}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
|
||||
\@namedef{PYG@tok@cpf}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
|
||||
\@namedef{PYG@tok@c1}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
|
||||
\@namedef{PYG@tok@cs}{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.24,0.48,0.48}{##1}}}
|
||||
|
||||
\def\PYGZbs{\char`\\}
|
||||
\def\PYGZus{\char`\_}
|
||||
\def\PYGZob{\char`\{}
|
||||
\def\PYGZcb{\char`\}}
|
||||
\def\PYGZca{\char`\^}
|
||||
\def\PYGZam{\char`\&}
|
||||
\def\PYGZlt{\char`\<}
|
||||
\def\PYGZgt{\char`\>}
|
||||
\def\PYGZsh{\char`\#}
|
||||
\def\PYGZpc{\char`\%}
|
||||
\def\PYGZdl{\char`\$}
|
||||
\def\PYGZhy{\char`\-}
|
||||
\def\PYGZsq{\char`\'}
|
||||
\def\PYGZdq{\char`\"}
|
||||
\def\PYGZti{\char`\~}
|
||||
% for compatibility with earlier versions
|
||||
\def\PYGZat{@}
|
||||
\def\PYGZlb{[}
|
||||
\def\PYGZrb{]}
|
||||
\makeatother
|
||||
|
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 14 KiB |