learnprolognow / lpn Goto Github PK
View Code? Open in Web Editor NEWLearn Prolog Now LaTeX sources
License: Other
Learn Prolog Now LaTeX sources
License: Other
Following my question on SWI Prolog Discourse, i would find it useful to update chapter 6.2 with reverse/4 and the comparison with reverse/3 as it is a good way to improve coding with a better understanding of how it works under the hood.
"Learn Prolog Now" is linked to index.php
, but this file does not exist. I think it should be linked to /
or /lpnpage.php?pageid=top
.
When I try running examples frpm exercise 2.2 in chapter 2.3, there's a problem with magic('McGonagall').
, because it gets imported into swish with reverse quotes (` instead of ') and the result is:
Cannot run query due to a syntax error (check query window)
From a fresh clone with no changes:
~/lpn $ scripts/_run
~/lpn ~/lpn
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=latex)
restricted \write18 enabled.
entering extended mode
(./lpn.tex
LaTeX2e <2020-02-02> patch level 2
L3 programming layer <2020-02-14>
(/usr/share/texlive/texmf-dist/tex/latex/base/book.cls
Document Class: book 2019/12/20 v1.4l Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/bk10.clo)) (./kcp.sty)
(./kcp-texts.sty
kpathsea: Running mktextfm cmss11
mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input cmss11
This is METAFONT, Version 2.7182818 (TeX Live 2019/Debian) (preloaded base=mf)
kpathsea: Running mktexmf cmss11
mf: /home/prophet/.texlive2019/texmf-var/fonts/source/public/sauter/cmss11.mf: successfully generated.
(/home/prophet/.texlive2019/texmf-var/fonts/source/public/sauter/cmss11.mf
(/usr/share/texlive/texmf-dist/fonts/source/public/sauter/b-cmss.mf
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/cmbase.mf)
(/usr/share/texlive/texmf-dist/fonts/source/public/sauter/c-cmss.mf)
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/roman.mf
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romanu.mf [65] [66]
[67] [68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78] [79] [80] [81]
[82] [83] [84] [85] [86] [87] [88] [89] [90])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romanl.mf [97] [98]
[99] [100] [101] [102] [103] [104] [105] [106] [107] [108] [109] [110] [111]
[112] [113] [114] [115] [116] [117] [118] [119] [120] [121] [122])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/greeku.mf [0] [1]
[2] [3] [4] [5] [6] [7] [8] [9] [10])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romand.mf [48] [49]
[50] [51] [52] [53] [54] [55] [56] [57])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romanp.mf [36] [38]
[63] [62]) (/usr/share/texlive/texmf-dist/fonts/source/public/cm/romspl.mf
[16] [17] [25] [26] [27] [28])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romspu.mf [29] [30]
[31]) (/usr/share/texlive/texmf-dist/fonts/source/public/cm/punct.mf [33]
[60] [35] [37] [39] [40] [41] [42] [43] [44] [46] [47] [58] [59] [61] [64]
[91] [93] [96]) (/usr/share/texlive/texmf-dist/fonts/source/public/cm/accent.mf
[18] [19] [20] [21] [22] [23] [24] [32] [94] [95] [125] [126] [127])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romlig.mf [11] [12]
[13] [14] [15]) (/usr/share/texlive/texmf-dist/fonts/source/public/cm/comlig.mf
[34] [45] [92] [123] [124]) ) ) )
Font metrics written on cmss11.tfm.
Output written on cmss11.600gf (128 characters, 23740 bytes).
Transcript written on cmss11.log.
mktextfm: /home/prophet/.texlive2019/texmf-var/fonts/tfm/public/sauter/cmss11.tfm: successfully generated.
kpathsea: Running mktextfm cmss14
mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input cmss14
This is METAFONT, Version 2.7182818 (TeX Live 2019/Debian) (preloaded base=mf)
kpathsea: Running mktexmf cmss14
mf: /home/prophet/.texlive2019/texmf-var/fonts/source/public/sauter/cmss14.mf: successfully generated.
(/home/prophet/.texlive2019/texmf-var/fonts/source/public/sauter/cmss14.mf
(/usr/share/texlive/texmf-dist/fonts/source/public/sauter/b-cmss.mf
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/cmbase.mf)
(/usr/share/texlive/texmf-dist/fonts/source/public/sauter/c-cmss.mf)
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/roman.mf
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romanu.mf [65] [66]
[67] [68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78] [79] [80] [81]
[82] [83] [84] [85] [86] [87] [88] [89] [90])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romanl.mf [97] [98]
[99] [100] [101] [102] [103] [104] [105] [106] [107] [108] [109] [110] [111]
[112] [113] [114] [115] [116] [117] [118] [119] [120] [121] [122])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/greeku.mf [0] [1]
[2] [3] [4] [5] [6] [7] [8] [9] [10])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romand.mf [48] [49]
[50] [51] [52] [53] [54] [55] [56] [57])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romanp.mf [36] [38]
[63] [62]) (/usr/share/texlive/texmf-dist/fonts/source/public/cm/romspl.mf
[16] [17] [25] [26] [27] [28])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romspu.mf [29] [30]
[31]) (/usr/share/texlive/texmf-dist/fonts/source/public/cm/punct.mf [33]
[60] [35] [37] [39] [40] [41] [42] [43] [44] [46] [47] [58] [59] [61] [64]
[91] [93] [96]) (/usr/share/texlive/texmf-dist/fonts/source/public/cm/accent.mf
[18] [19] [20] [21] [22] [23] [24] [32] [94] [95] [125] [126] [127])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romlig.mf [11] [12]
[13] [14] [15]) (/usr/share/texlive/texmf-dist/fonts/source/public/cm/comlig.mf
[34] [45] [92] [123] [124]) ) ) )
Font metrics written on cmss14.tfm.
Output written on cmss14.600gf (128 characters, 30480 bytes).
Transcript written on cmss14.log.
mktextfm: /home/prophet/.texlive2019/texmf-var/fonts/tfm/public/sauter/cmss14.tfm: successfully generated.
kpathsea: Running mktextfm cmss14
mktextfm: /home/prophet/.texlive2019/texmf-var/fonts/tfm/public/sauter/cmss14.tfm already exists.
)
(/usr/share/texlive/texmf-dist/tex/latex/pstricks/pstricks.sty
(/usr/share/texlive/texmf-dist/tex/generic/iftex/iftex.sty)
(/usr/share/texlive/texmf-dist/tex/latex/tools/shellesc.sty)
(/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/dvips.def))
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/pst-xkey.tex
(/usr/share/texlive/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/keyval.tex)))))
(/usr/share/texlive/texmf-dist/tex/generic/pstricks/pstricks.tex
(/usr/share/texlive/texmf-dist/tex/generic/pstricks/pst-fp.tex
`pst-fp' v0.05, 2010/01/17 (hv))
(/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
(/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-lists.t
ex)) (/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.t
ex)) (/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
Loading pgffor.code.tex
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code
.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonomet
ric.code.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.cod
e.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison
.code.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.
tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code
.tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.
tex)
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerari
thmetics.code.tex)))
(/usr/share/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)))
`PSTricks' v2.97 <2019/05/11> (tvz,hv)
(/usr/share/texlive/texmf-dist/tex/generic/pstricks/pstricks.con))
(/usr/share/texlive/texmf-dist/tex/generic/pstricks/pst-fp.tex))
(/usr/share/texlive/texmf-dist/tex/latex/pst-node/pst-node.sty
(/usr/share/texlive/texmf-dist/tex/generic/pst-node/pst-node.tex
v1.42, 2019/03/03))
(/usr/share/texlive/texmf-dist/tex/latex/pst-tree/pst-tree.sty
(/usr/share/texlive/texmf-dist/tex/generic/pst-tree/pst-tree.tex
v1.13, 2017/02/18(tvz,dg,hv)))
(/usr/share/texlive/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)))
(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty)
(/usr/share/texlive/texmf-dist/tex/latex/base/makeidx.sty)
Writing index file lpn.idx
(./LPNmacros.tex)
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-dvips.def)
No file lpn.aux.
(/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1ptm.fd) (./lpn.toc [5]
[6]) [7] (./preface2.tex [8] [9]) [10] (./preface.tex [11]
LaTeX Warning: Reference `L2.EX4' on page xii undefined on input line 69.
) [12] (./introduction.tex [13] [14] [15]) [16] (./chapter1.tex [1]
LaTeX Font Warning: Font shape `OT1/cmtt/m/rm' undefined
(Font) using `OT1/cmtt/m/n' instead on input line 63.
[2] [3] [4] [5] [6] [7]
LaTeX Warning: Reference `CHAPTER10' on page 8 undefined on input line 360.
[8] [9] [10] [11]
LaTeX Warning: Reference `CHAPTER5' on page 12 undefined on input line 604.
LaTeX Warning: Reference `CHAPTER4' on page 12 undefined on input line 619.
[12] [13] [14] [15] [16]
LaTeX Warning: Reference `CHAPTER12' on page 17 undefined on input line 854.
[17] [18] (/usr/share/texlive/texmf-dist/tex/latex/psnfss/ts1ptm.fd)
LaTeX Warning: Reference `L1.EX5' on page 19 undefined on input line 991.
) [19] [20] (./chapter2.tex [21] [22] [23] [24]
LaTeX Warning: Reference `CHAPTER1' on page 25 undefined on input line 227.
[25]
LaTeX Warning: Reference `CHAPTER1' on page 26 undefined on input line 275.
[26] [27] [28] [29]
Underfull \vbox (badness 1838) has occurred while \output is active [30]
[31] [32]
LaTeX Warning: Reference `CHAPTER7' on page 33 undefined on input line 644.
[33] [34]
LaTeX Warning: File `chap2-pspic1.ps' not found on input line 724.
! LaTeX Error: File `chap2-pspic1.ps' not found.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.724 \includegraphics{chap2-pspic1.ps}
?
Learn Prolog now 9.2 introduces the list constructors . and [] and gives some example code :
?- .(a,[]) == [a]. yes
In SWI Prolog 7, this example gives the error
ERROR: Stream user_input:25:1 Syntax error: Unexpected end of clause
After googling, I found the reason: http://www.complang.tuwien.ac.at/ulrich/iso-prolog/SWI7_and_ISO. SWI7 deviates from the Prolog standard a bit as it seems. The workaround in SWI 7 is using [|], such as: ?- [a|[]]==[a].
(please see SWI documentation). Maybe you should add an explanatory message to the LPN mentioned above.
If you navigate to the Chapter 1 page on lpn.swi-prolog.org, then click on 1.1 Some Simple Examples, the page is blank.
If you visit the same link on the learnprolognow.org version of "Learn Prolog Now!" without SWISH it has content: http://www.learnprolognow.org/lpnpage.php?pagetype=html&pageid=lpn-htmlse1
Execrise 2.2 in chapter 2.3 Exercises is missing one fact. I guess it's going to be wizard(harry)
... As it is, I get the following:
procedure `wizard(A)' does not exist
Reachable from:
magic(A)
Hallo Guys
i am new in programming prolog. Now i have a problem to solve the a magic issue. This is the problem which i have to solve
/*Implement the a EA version of the "Magic Square" finder of size N in prolog including a makefile (make test shall test all cases) compressed into a ZIP or tgz file. Test your program from size N= 3 up to 9 (and more if possible) and find 5 new ones, that differ from wikipedia.
I would recommend, that you modify the "8-queens problem" finder or "the simple EA" accordingly.
Your group has to implement the magic square version equal to its group number mod(12).*/
Franklin magic square when it is a doubly even magic square with three further properties
(i) every bent diagonal adds to the magic constant,
(ii) every half row and half column starting at an outside edge adds to half the magic constant, and
(iii) the square is compact.
Thanks
Given the example ?- father(X) = X.
it states that:
Because the left hand term is the variable X , by clause 2 it decides that the terms do unify, and (in accordance with clause 2) instantiates X to the right hand side, namely father(X) .
I think it should say:
Because the right hand term is the variable X , by clause 2 it decides that the terms do unify, and (in accordance with clause 2) instantiates X to the left hand side, namely father(X) .
Left and right seems to be swapped.
Generally speaking, all the PNG renders of the search trees I've seen so far in the online versions are missing bits around the edges. One of the examples is one of the trees in chapter 2.2: http://lpn.swi-prolog.org/html/chap2-pspic5.ps.png
As you can see the frame of the query is missing the top border and the _G5
and _G6
from _G5 = vincent
and _G6 = mia
on the left side of the diagram.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.