Skip to content

Instantly share code, notes, and snippets.

;;;===================================================================
;;; delete-newlines-inside-paragraphs (for DeepL translation, etc)
;;;
(defvar *dnip-mark* "\C-a")
;; only for internal use
(defun dnip-replace-str (from-str to-str)
(goto-char (point-min))
(while (search-forward from-str nil t) (replace-match to-str nil t)))
@nfunato
nfunato / prelude.fth
Last active September 19, 2021 10:18
\ Usage:
\ - In xxx.fth, the first three lines are something like:
\ anew --MODULE-NAME--
\ : SRCFILE s" xxx.fth" ;
\ ' SRCFILE set-srcfile
\ -----------------------------------------------------------------------
\ "ANEW" from Wil Baden's "ToolBelt 2002" at www.wilbaden.com/neil_bawd/,
\ where the index describes the code is sharable
;;; https://github.com/myaosato/clcm/blob/master/src/test/main.lisp on 2002-07-23
;;; another revised version
(defun %test (fn)
(let ((test-cases (decode-json-from-source *spec-json-file*))
(sect-tbl (make-hash-table :test #'equal))
(sect-names '()))
(labels ((json-attr (key tc)
(cdr (or (assoc key tc :test #'eq)
(error "json-attr"))))
;;;===================================================================
;;; override dired-flag-backup-files with
;;; dired-flag-backup-files-and-lisp-fasl-files
(defcustom dired-lisp-fasl-files-regexp
;; SBCL -- .fasl
;; CCL --
;; CLISP --
;; ECL -- .o (and perhaps others)
(concat (regexp-opt
;;;;===================================================================
;;;; L99 problem 27
;;;; as a result, it is similar to one in www.informatimago.com/develop/lisp/l99/
(defun comb (n r xs)
(cond ((or (zerop r) (null xs)) '(()))
((= n r) (list (copy-seq xs)))
(t
(destructuring-bind (kar . kdr) xs

basic key-sequences memo when using Lisp on Macintosh

MAC

  • ctrl-UP invoke mission control
  • ctrl-DOWN back from mission control
  • ctrl-LEFT left screen
  • ctrl-RIGHT right screen

slime/paredit/repl

;;; ULID binary layout (https://github.com/ulid/spec)
;;;
;;; 0 1 2 3
;;; 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
;;; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
;;; | 32_bit_uint_time_high |
;;; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
;;; | 16_bit_uint_time_low | 16_bit_uint_random |
;;; +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
;;; | 32_bit_uint_random |
;;;; -*- Mode: Lisp; Syntax: Common-Lisp -*-
;;;; GEOHASH encoder/decoder written by @nfunato on 2020-04-18
;;;; Copyright (c) 2020 Nobuhiko Funato, released under the MIT license
;;;; TODO: add utility functions, e.g. proximity judgment etc.
;;;; change from gist 20200419 version
(defpackage #:geohash
@nfunato
nfunato / code.lisp
Last active September 28, 2019 00:48
companion code for my local presentation "Code Walkers for Lisp"
;;;;
;;;; companion code for my presentation at a local meeting on 2019-09-28
;;;; (https://kansai-lisp-useres.connpass.com/event/142069/)
;;;;
;;;-------------------------------------------------------------------
;;; prerequisite
#|
(use-package :sb-walker)
;;;
;;; Yet another porting of Dr. Norvig's Sudoku Solver, in Common Lisp
;;;
;;; @nfunato 2017-12-31
;;; Please see the original article (http://norvig.com/sudoku.html) for detail.
;;; Note
;;;
;;; - I intentionally tried to keep the smell of the original code, except