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
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; coding: utf-8 -*- | |
(cl:in-package "CL-USER") | |
(defvar *standard-readtable* (copy-readtable nil)) | |
(defvar *nest-level* 0) |
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; coding: utf-8 -*- | |
#|| | |
Lunar | |
http://users.rcn.com/david-moon/Lunar/data.html#slots | |
The last slot in a datum can be a multi-slot whose value is a special kind of succession that is embedded in the datum rather than being a separate datum. This enables variable-length classes. The value of each member of a multi-slot must be a member of the slot's declared type. | |
The Consistent Slot Order Rule also states that only the last slot in the list can be a multi-slot. Thus no class that contains a multi-slot can have a subclass that adds more slots. |
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; coding: utf-8 -*- | |
(cl:in-package "BCL-USER") | |
(defclass init-once-slot-class (standard-class) | |
()) | |
(defmethod clos:process-a-slot-option | |
((class init-once-slot-class) option value | |
already-processed-options slot) |
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
今回のような場合、マクロでコード生成する(楽をしたい)のであれば関数単位というよりは全体を生成することになるかと思いました。 | |
(defmacro doit () | |
`(progn | |
;; data chunk | |
(write-chars "data" out-stream) | |
(write-32le (* nsmpl nch (/ nbits 8)) out-stream) ; size of data chunk | |
(cond | |
,@(mapcan (lambda (nch) | |
(mapcar (lambda (n) |
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 tarai (x y z) | |
(declare (optimize (speed 3) (debug 0) (safety 0))) | |
(labels ((tarai (x y z) | |
(declare (fixnum x y z)) | |
(the fixnum | |
(if (> x y) | |
(tarai (tarai (1- x) y z) | |
(tarai (1- y) z x) | |
(tarai (1- z) x y)) | |
y)))) |
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; package: destructuring; -*- | |
;;; destructuring-bind.l | |
;; | |
;; Copyright (c) 1980, Massachusetts Institute of Technology | |
;; All rights reserved. | |
;; | |
;; Redistribution and use in source and binary forms, with or without | |
;; modification, are permitted provided that the following conditions are | |
;; met: |
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; coding: utf-8 -*- | |
(ql:quickload 'closer-mop) | |
(defpackage named-instance-class | |
(:use c2cl)) | |
(in-package named-instance-class) |
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
(progn | |
#.(set-macro-character #\[ (lambda (srm chr) | |
(declare (ignore chr)) | |
(read-delimited-list #\] srm T))) | |
[list 0 | |
1 | |
2 | |
#.(progn | |
(set-macro-character #\[ (lambda (srm chr) | |
(declare (ignore chr)) |
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 la MACLISP | |
(DEFUN FACTORS (N) | |
(PROG (FACS SQRTN D) | |
(SETQ FACS () ) | |
(SETQ D 2) | |
(GO L1) | |
L2 (SETQ N (FLOOR N D)) | |
(SETQ FACS (CONS D FACS)) | |
L1 (SETQ SQRTN (ISQRT N)) | |
L (COND ((> D SQRTN) (GO X))) |
NewerOlder