Human Problem Solving

http://mirror.us-midwest-1.nexcess.net/gnu/emacs/windows/emacs-27/

http://www.sbcl.org/platform-table.html

https://www.quicklisp.org/beta/

To get started with the Quicklisp beta, 
download and load https://beta.quicklisp.org/quicklisp.lisp


C:\Users\maart>cd c:\home

c:\home>sbcl --load quicklisp.lisp

 ==== quicklisp quickstart 2015-01-28 loaded ====

    To continue with installation, evaluate: 

0] (quicklisp-quickstart:install)


 ==== quicklisp installed ====

    To load a system, use: (ql:quickload "system-name")

    To find systems, use: (ql:system-apropos "term")

    To load Quicklisp every time you start Lisp, use: (ql:add-to-init-file)

    For more information, see http://www.quicklisp.org/beta/

NIL
0] (ql:add-to-init-file)




I will append the following lines to #P"C:/home/.sbclrc":

  ;;; The following lines added by ql:add-to-init-file:
  #-quicklisp
  (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
                                         (user-homedir-pathname))))
    (when (probe-file quicklisp-init)
      (load quicklisp-init)))

Press Enter to continue.

0] (ql:quickload "quicklisp-slime-helper")


To use, add this to your ~/.emacs:

  (load (expand-file-name "~/quicklisp/slime-helper.el"))
  ;; Replace "sbcl" with the path to your implementation
  (setq inferior-lisp-program "sbcl")


("quicklisp-slime-helper")
0]


PS C:\Users\maart\2020-IT> Get-Content C:\home\.emacs
(load (expand-file-name "~/quicklisp/slime-helper.el"))
;; Replace "sbcl" with the path to your implementation
(setq inferior-lisp-program "sbcl")

Alternative Installation from Linux (Widnows-Subsystem)


1.     Open PowerShell as Administrator and run:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

2.     Restart your computer when prompted.



Installation on Fedora

[maarten@localhost ~]$ wget https://beta.quicklisp.org/quicklisp.lisp
--2020-10-15 14:47:55--  https://beta.quicklisp.org/quicklisp.lisp
Resolving beta.quicklisp.org (beta.quicklisp.org)... 13.225.78.17, 13.225.78.33, 13.225.78.81, ...
Connecting to beta.quicklisp.org (beta.quicklisp.org)|13.225.78.17|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 57144 (56K) [text/plain]
Saving to: ‘quicklisp.lisp’

quicklisp.lisp      100%[===================>]  55.80K  --.-KB/s    in 0.06s   

2020-10-15 14:47:57 (869 KB/s) - ‘quicklisp.lisp’ saved [57144/57144]

[maarten@localhost ~]$ sbcl --load quicklisp.lisp
This is SBCL 1.4.6-1.fc28, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.

  ==== quicklisp quickstart 2015-01-28 loaded ====

    To continue with installation, evaluate: (quicklisp-quickstart:install)

    For installation options, evaluate: (quicklisp-quickstart:help)

* (quicklisp-quickstart:install)

; Fetching #<URL "http://beta.quicklisp.org/client/quicklisp.sexp">
; 0.82KB
==================================================
838 bytes in 0.00 seconds (0.00KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/client/2020-01-04/quicklisp.tar">
; 250.00KB
==================================================
256,000 bytes in 0.18 seconds (1404.49KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/client/2015-09-24/setup.lisp">
; 4.94KB
==================================================
5,054 bytes in 0.00 seconds (4935.55KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/asdf/2.26/asdf.lisp">
; 194.07KB
==================================================
198,729 bytes in 0.16 seconds (1228.30KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/dist/quicklisp.txt">
; 0.40KB
==================================================
408 bytes in 0.00 seconds (398.44KB/sec)
Installing dist "quicklisp" version "2020-09-25".
; Fetching #<URL "http://beta.quicklisp.org/dist/quicklisp/2020-09-25/releases.txt">
; 465.71KB
==================================================
476,886 bytes in 0.25 seconds (1826.31KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/dist/quicklisp/2020-09-25/systems.txt">
; 339.84KB
==================================================
347,992 bytes in 0.21 seconds (1626.01KB/sec)

  ==== quicklisp installed ====

    To load a system, use: (ql:quickload "system-name")

    To find systems, use: (ql:system-apropos "term")

    To load Quicklisp every time you start Lisp, use: (ql:add-to-init-file)

    For more information, see http://www.quicklisp.org/beta/

NIL
* (ql:add-to-init-file)
I will append the following lines to #P"/home/maarten/.sbclrc":

  ;;; The following lines added by ql:add-to-init-file:
  #-quicklisp
  (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
                                         (user-homedir-pathname))))
    (when (probe-file quicklisp-init)
      (load quicklisp-init)))

Press Enter to continue.


#P"/home/maarten/.sbclrc"
* (ql:quickload "quicklisp-slime-helper")
To load "quicklisp-slime-helper":
  Load 1 ASDF system:
    asdf
  Install 3 Quicklisp releases:
    alexandria quicklisp-slime-helper slime
; Fetching #<URL "http://beta.quicklisp.org/archive/slime/2020-09-25/slime-v2.26.tgz">
; 802.88KB
==================================================
822,146 bytes in 0.38 seconds (2141.01KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/alexandria/2020-09-25/alexandria-20200925-git.tgz">
; 53.45KB
==================================================
54,730 bytes in 0.07 seconds (752.78KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/quicklisp-slime-helper/2015-07-09/quicklisp-slime-helper-20150709-git.tgz">
; 2.16KB
==================================================
2,211 bytes in 0.00 seconds (0.00KB/sec)
; Loading "quicklisp-slime-helper"
[package swank-loader]............................
[package swank/backend]..........................
[package swank/rpc]...............................
[package swank/match].............................
[package swank-mop]..............................
[package swank]..................................
[package swank/source-path-parser]................
[package swank/source-file-cache].................
[package swank/sbcl].............................
[package swank/gray]..............................
.........
; compiling file "/home/maarten/quicklisp/dists/quicklisp/software/slime-v2.26/contrib/swank-util.lisp" (written 15 OCT 2020 02:50:13 PM):
.

; /home/maarten/.slime/fasl/2.26/sbcl-1.4.6-1.fc28-linux-x86-64/contrib/swank-util.fasl written
; compilation finished in 0:00:00.024
; compiling file "/home/maarten/quicklisp/dists/quicklisp/software/slime-v2.26/contrib/swank-repl.lisp" (written 15 OCT 2020 02:50:13 PM):
.......................................
[package swank-repl]..

; /home/maarten/.slime/fasl/2.26/sbcl-1.4.6-1.fc28-linux-x86-64/contrib/swank-repl.fasl written
; compilation finished in 0:00:00.083
; compiling file "/home/maarten/quicklisp/dists/quicklisp/software/slime-v2.26/contrib/swank-c-p-c.lisp" (written 15 OCT 2020 02:50:13 PM):
.

; /home/maarten/.slime/fasl/2.26/sbcl-1.4.6-1.fc28-linux-x86-64/contrib/swank-c-p-c.fasl written
; compilation finished in 0:00:00.062
; compiling file "/home/maarten/quicklisp/dists/quicklisp/software/slime-v2.26/contrib/swank-arglists.lisp" (written 15 OCT 2020 02:50:13 PM):
................

; /home/maarten/.slime/fasl/2.26/sbcl-1.4.6-1.fc28-linux-x86-64/contrib/swank-arglists.fasl written
; compilation finished in 0:00:00.712
; compiling file "/home/maarten/quicklisp/dists/quicklisp/software/slime-v2.26/contrib/swank-fuzzy.lisp" (written 15 OCT 2020 02:50:13 PM):
...

; /home/maarten/.slime/fasl/2.26/sbcl-1.4.6-1.fc28-linux-x86-64/contrib/swank-fuzzy.fasl written
; compilation finished in 0:00:00.145
; compiling file "/home/maarten/quicklisp/dists/quicklisp/software/slime-v2.26/contrib/swank-fancy-inspector.lisp" (written 15 OCT 2020 02:50:13 PM):
........

; /home/maarten/.slime/fasl/2.26/sbcl-1.4.6-1.fc28-linux-x86-64/contrib/swank-fancy-inspector.fasl written
; compilation finished in 0:00:00.322
; compiling file "/home/maarten/quicklisp/dists/quicklisp/software/slime-v2.26/contrib/swank-presentations.lisp" (written 15 OCT 2020 02:50:13 PM):
.

; /home/maarten/.slime/fasl/2.26/sbcl-1.4.6-1.fc28-linux-x86-64/contrib/swank-presentations.fasl written
; compilation finished in 0:00:00.051
; compiling file "/home/maarten/quicklisp/dists/quicklisp/software/slime-v2.26/contrib/swank-presentation-streams.lisp" (written 15 OCT 2020 02:50:13 PM):
.

; /home/maarten/.slime/fasl/2.26/sbcl-1.4.6-1.fc28-linux-x86-64/contrib/swank-presentation-streams.fasl written
; compilation finished in 0:00:00.048
; compiling file "/home/maarten/quicklisp/dists/quicklisp/software/slime-v2.26/contrib/swank-asdf.lisp" (written 15 OCT 2020 02:50:13 PM):
....

; /home/maarten/.slime/fasl/2.26/sbcl-1.4.6-1.fc28-linux-x86-64/contrib/swank-asdf.fasl written
; compilation finished in 0:00:00.166
; compiling file "/home/maarten/quicklisp/dists/quicklisp/software/slime-v2.26/contrib/swank-package-fu.lisp" (written 15 OCT 2020 02:50:13 PM):
.

; /home/maarten/.slime/fasl/2.26/sbcl-1.4.6-1.fc28-linux-x86-64/contrib/swank-package-fu.fasl written
; compilation finished in 0:00:00.011
; compiling file "/home/maarten/quicklisp/dists/quicklisp/software/slime-v2.26/contrib/swank-hyperdoc.lisp" (written 15 OCT 2020 02:50:13 PM):

; /home/maarten/.slime/fasl/2.26/sbcl-1.4.6-1.fc28-linux-x86-64/contrib/swank-hyperdoc.fasl written
; compilation finished in 0:00:00.003
; compiling file "/home/maarten/quicklisp/dists/quicklisp/software/slime-v2.26/contrib/swank-sbcl-exts.lisp" (written 15 OCT 2020 02:50:13 PM):

; /home/maarten/.slime/fasl/2.26/sbcl-1.4.6-1.fc28-linux-x86-64/contrib/swank-sbcl-exts.fasl written
; compilation finished in 0:00:00.022
; compiling file "/home/maarten/quicklisp/dists/quicklisp/software/slime-v2.26/contrib/swank-mrepl.lisp" (written 15 OCT 2020 02:50:13 PM):
.........................................
[package swank-api]..............................
[package swank-mrepl].

; /home/maarten/.slime/fasl/2.26/sbcl-1.4.6-1.fc28-linux-x86-64/contrib/swank-mrepl.fasl written
; compilation finished in 0:00:00.044
; compiling file "/home/maarten/quicklisp/dists/quicklisp/software/slime-v2.26/contrib/swank-trace-dialog.lisp" (written 15 OCT 2020 02:50:13 PM):
...........................
[package swank-trace-dialog]..

; /home/maarten/.slime/fasl/2.26/sbcl-1.4.6-1.fc28-linux-x86-64/contrib/swank-trace-dialog.fasl written
; compilation finished in 0:00:00.056
; compiling file "/home/maarten/quicklisp/dists/quicklisp/software/slime-v2.26/contrib/swank-macrostep.lisp" (written 15 OCT 2020 02:50:13 PM):
....................
[package swank-macrostep].

; /home/maarten/.slime/fasl/2.26/sbcl-1.4.6-1.fc28-linux-x86-64/contrib/swank-macrostep.fasl written
; compilation finished in 0:00:00.051
; compiling file "/home/maarten/quicklisp/dists/quicklisp/software/slime-v2.26/contrib/swank-quicklisp.lisp" (written 15 OCT 2020 02:50:13 PM):

; /home/maarten/.slime/fasl/2.26/sbcl-1.4.6-1.fc28-linux-x86-64/contrib/swank-quicklisp.fasl written
; compilation finished in 0:00:00.004
........................
[package alexandria]..............................
[package alexandria-2]...........................
[package quicklisp-slime-helper]
slime-helper.el installed in "/home/maarten/quicklisp/slime-helper.el"

To use, add this to your ~/.emacs:

  (load (expand-file-name "~/quicklisp/slime-helper.el"))
  ;; Replace "sbcl" with the path to your implementation
  (setq inferior-lisp-program "sbcl")


("quicklisp-slime-helper")
*   


One variant of the Fermat test that cannot be fooled is called the Miller-Rabin test (Miller 1976; Rabin 1980). This starts from an alternate form of Fermat’s Little Theorem, which states that if n is a prime number and a is any positive integer less than n, then a raised to the (n − 1)-st power is congruent to 1 modulo n. To test the primality of a number n by the Miller-Rabin test, we pick a random number a and raise a to the (n − 1)-st power modulo n using the expmod procedure. However, whenever we perform the squaring step in expmod, we check to see if we have discovered a “nontrivial square root of 1 modulo n,” that is, a number not equal to 1 or n−1 whose square is equal to 1 modulo n. It is possible to prove that if such a nontrivial square root of 1 exists, then n is not prime. It is also possible to prove that if n is an odd number that is not prime, then, for at least half the numbers a, computing a to n − 1 this way will reveal a nontrivial square root of 1 modulo n. (This is why the Miller-Rabin test cannot be fooled.) Modify the expmod procedure to signal if it discovers a nontrivial square root of 1, and use this to implement the Miller-Rabin test with a procedure analogous to fermat-test. Check your procedure by testing various known primes and non-primes. Hint: One convenient way to make expmod signal is to have it return 0.

math