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
; https://codereview.stackexchange.com/questions/215682/occurrences-frequency-count-exercise-3-ch-3-in-ansi-common-lisp/215711?noredirect=1#comment417480_215711 | |
(defun occurrences (list) | |
(let ((ht (make-hash-table))) | |
(let ((holder nil)) | |
(dolist (x list) | |
(if (not (member x holder :test #'eq)) | |
(progn | |
(push x holder) |
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
;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Author: [email protected]; Coding: latin-1; Base: 10; Readtable: CL -*- | |
; Shakesperian insults by Jerry Maguire | |
; Lisp code: Rainer Joswig, 2018, [email protected] | |
(defparameter *insult-data* | |
#(#("artless" "bawdy" "beslubbering" "bootless" "churlish" "cockered" "clouted" | |
"craven" "currish" "dankish" "dissembling" "droning" "errant" "fawning" | |
"fobbing" "froward" "frothy" "gleeking" "goatish" "gorbellied" | |
"impertinent" "infectious" "jarring" "loggerheaded" "lumpish" "mammering" |
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
; A MICRO-MANUAL FOR LISP - NOT THE WHOLE TRUTH, 1978 | |
; John McCarthy, Artificial Intelligence Laboratory, Stanford University | |
; https://www.ee.ryerson.ca/~elf/pub/misc/micromanualLISP.pdf | |
; https://github.com/jaseemabid/micromanual | |
; for CL : Rainer Joswig, [email protected] | |
; this version runs in a Common Lisp |
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Common Lisp Maze 20030311 by Joe Wingbermuehle | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; https://github.com/joewing/maze/blob/master/maze.lisp | |
; Changes Rainer Joswig, [email protected], 2018 | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Interface: the width and height of the maze. Both must be odd. |
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
; adapted from https://groups.google.com/d/msg/comp.lang.lisp/TsmbsOK32DM/9Q7prvFV9YsJ , Pascal Costanza | |
;;;; checking CLOS slot writes at runtime for the correct type | |
;;; LispWorks | |
(defclass slot-writes-checking-class (standard-class) | |
()) | |
(defmethod validate-superclass |
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
; https://z0ltan.wordpress.com/2018/08/04/simple-expression-evaluator-comparison-between-haskell-rust-and-common-lisp/ | |
; this version: 2018, Rainer Joswig, [email protected] | |
; we create a bunch of structures for the expression types | |
; each structure defines a constructor of the same name | |
; each expression knows the corresponding Lisp function | |
(defstruct (val (:constructor val (e))) e) | |
(defstruct (bop :conc-name) e1 e2 op) |
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
; John McCarthy. Puzzle Solving Program in LISP. Memo 20, Artificial Intelligence Project | |
; http://www.bitsavers.org/pdf/mit/ai/aim/AIM-020.pdf | |
; 1960 | |
; Common Lisp translation: Rainer Joswig, 2016, [email protected] | |
; basically the code is unchanged, but using s-expression syntax in Common Lisp | |
(defparameter pzl | |
'((a1 (a2 a5) 7.5) | |
(a2 (a1 a5 a9 a3) 3.5) |
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
(defun divisors (n &aux (divisors (list 1))) | |
(etypecase n | |
((integer * 1) nil) | |
((integer 2 *) | |
(loop with q and r | |
for i from 2 to (isqrt n) | |
do (setf (values q r) (truncate n i)) | |
when (zerop r) do (push q divisors) and do (push i divisors)) | |
(if (and (second divisors) | |
(= (first divisors) (second divisors))) |
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
<GLS is Guy Steele, RMS is Richard Stallman, DLW is Dan Weinreb, Moon is David Moon, Ed is Ed | |
Schwalenberg, CBF is Charles Frankston, EAK is Earl Killian, ECC is Gene Cicarelli, | |
RMF is Bob Frankston, and JLK is John Kulp.> | |
--- | |
I think all of us have been relying on our memories, which can | |
fail in various ways. Last time around I checked my file folder | |
of notes about Emacs, which has some useful information, but | |
not a lot about who did what. Now I have some more information |
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
; https://github.com/inconvergent/snek/blob/master/utils/spline-script.lisp | |
(defun test-centroids (counts nc ncn) | |
(loop for i from 0 below nc | |
always (multiple-value-bind (val exists) | |
(gethash i counts) | |
(and exists (>= val ncn))))) |