Skip to content

Instantly share code, notes, and snippets.

g000001 g000001

Block or report user

Report or block g000001

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View comment.lisp
#| foo |#
;;; foo
#;(foo
bar
baz)
foo bar baz
#|
View foo.lisp
(let* ((a+b (make-string 10 :initial-element #\_))
(a (make-array 5 :displaced-to a+b :element-type 'character))
(b (make-array 5 :displaced-to a+b :displaced-index-offset 5 :element-type 'character)))
(setf (subseq a 0 2) "ab"
(subseq b 0 2) "cd")
(list a b a+b))
;=> ("ab___" "cd___" "ab___cd___")
@g000001
g000001 / gf-foo.lisp
Created Aug 12, 2017
総称関数を高速化してみよう
View gf-foo.lisp
総称関数を高速化してみよう(総称関数でない)
元ネタ
- http://www.doc.gold.ac.uk/~mas01cr/talks/
- http://www.doc.gold.ac.uk/~mas01cr/talks/2009-05-28%20Milan/string=-specializers.lisp
MOPでコード生成して高速化を図るらしい。
面白そうなので真似してみよう。
@g000001
g000001 / run.lisp
Created Jun 28, 2017
Zebra (Common Prolog & PAIProlog)
View run.lisp
(flet ((run (name)
(with-standard-io-syntax
(format T "~&==== ~S ====~%" name))
(funcall name)))
(run 'paiprolog-zebra::zebra-benchmark)
(run 'clog-zebra::zebra-benchmark)
(run 'clog-zebra::zebra-benchmark/))
@g000001
g000001 / defrunlisp.el
Last active Jan 17, 2017
*inferior-lisp* rename
View defrunlisp.el
(defmacro defrunlisp (name &optional lisp-exe-path)
(let ((sname (symbol-name name)))
`(defun ,(intern (concat "run-" sname)) ()
(interactive)
(run-lisp ,(or lisp-exe-path sname))
(rename-buffer ,(concat "*inferior-" sname "*")))))
(defrunlisp sbcl "sbcl.wrapper")
View time.lisp
;;; 素の状態
(loop :for cnt :from 0
:do (sb-ext:call-with-timing (lambda (&key bytes-consed &allow-other-keys)
(unless (zerop bytes-consed)
(return (print (list bytes-consed cnt)))))
(lambda ()
(let ((a #*10000000000000000000000000000000000000000000000)
(b #*10000000000000000000000000000000000000000000000))
(declare (optimize (speed 3) (safety 0))
(simple-bit-vector a b))
View gist:f7e9909239808aad70a5cf9fa112948e
(define (printfoobar)
(define place (zowie))
(place)
(values))
(define (printfoo)
(define place (zowie))
(values))
(define (zowie)
View lunar.emacs
!~Filename~:! !Moon's -*-TECO-*- Library!
LUNAR
!& Load Airless Environment:! !S This is my init file
It's here so that comments will get compressed.
Argument is a string which is the user name!
!* process job command line !
hk fj 0,0a-3"E -d' !* remove ^C at end if any!
0,-1a-15."E -2d' !* remove crlf at end if any.!
@g000001
g000001 / prolog.teco
Created Nov 5, 2016
Library for PROLOG Editing System by T.Chikayama
View prolog.teco
!* -*-TECO-*- Library for PROLOG Editing System by T.Chikayama!
!~FILENAME~:! !Package for programming in PROLOG!
PROLOG
!& Setup PROLOG Library:! !& Set up environment for editing PROLOG codes.
Make *PROLOG* buffer for later use.!
F[D File◊ !* Save Teco Default Filename. !
1,:I**PROLOG*◊M(M.M &_Find_Buffer◊)"L !* If no *PROLOG* buffer yet,!
View foo.lisp
(defclass symbolic-object-class (standard-class)
())
(defmethod allocate-instance
((class symbolic-object-class) &rest args &key)
(let ((inst (gensym "SYMBOLIC-OBJECT-")))
(setf (get inst :class) class)
(dolist (slot (class-slots class) inst)
(setf (get inst (clos:slot-definition-name slot)) :unbound))))
You can’t perform that action at this time.