changelog shortlog graph tags branches changeset file revisions annotate raw help

Mercurial > demo / examples/clos/fast.lisp

revision 40: 6b652d7d6663
     1.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2+++ b/examples/clos/fast.lisp	Sun Apr 14 20:48:05 2024 -0400
     1.3@@ -0,0 +1,15 @@
     1.4+(in-package :examples/clos/fast)
     1.5+
     1.6+;; (defclass foo (obj/meta/sealed:sealable-class)
     1.7+;;   ((n :initform 0 :type fixnum :accessor foo-n)))
     1.8+
     1.9+;; (defmethod binary-+ ((x foo) (y foo))
    1.10+;;   (+ (foo-n x) (foo-n y)))
    1.11+
    1.12+(defmethod binary-+ ((x fixnum) (y fixnum))
    1.13+  (declare (method-properties inlineable))
    1.14+  (+ x y))
    1.15+
    1.16+(seal-domain #'binary-+ '(t t))
    1.17+(binary-+ 0 0)
    1.18+