Skip to content

Instantly share code, notes, and snippets.

View guicho271828's full-sized avatar
🤣
Lemonodor fame is but a hack away!

Masataro Asai guicho271828

🤣
Lemonodor fame is but a hack away!
View GitHub Profile
@guicho271828
guicho271828 / codeiq.lisp
Last active December 22, 2015 08:59
print Hello World without using any literals
; run with /usr/local/bin/sbcl --no-sysinit --no-userinit --script codeiq.lisp
(defun read-and-print-until-eof (stream char)
(declare (ignore char))
(let ((c (read-char stream nil nil)))
(if c
(progn (write-char c)
(read-and-print-until-eof stream char))
(sb-ext:exit))))
@guicho271828
guicho271828 / file0.lisp
Created December 26, 2013 17:55
年賀状の宛名をtex + lispで作る ref: http://qiita.com/guicho271828/items/650143cf4ea6e1ff7676
(ql:quickload :alexandria)
(ql:quickload :inferior-shell)
(ql:quickload :cl-csv)
(ql:quickload :osicat)
(in-package :cl-user)
(use-package :alexandria)
(use-package :inferior-shell)
(use-package :cl-csv)
(use-package :osicat) ;; 2 conflict
@guicho271828
guicho271828 / compare-cl-cl21.lisp
Last active August 29, 2015 13:56
Automated Package-Diff Script
(mapc #'asdf:load-system '(:iterate :cl21 :alexandria :trivial-cltl2))
(in-package :cl-user)
(defpackage :package-diff
(:use :cl :iterate :alexandria))
(in-package :package-diff)
(defun package-symbols-intersection (package1 package2)
@guicho271828
guicho271828 / with-local-package.lisp
Created February 10, 2014 11:34
with-local-package
(in-package :cl-user)
(defpackage :a
(:use :cl))
(in-package :a)
(defun print-square (x)

This file is Automatically generated by tools/compare-cl-21.lisp on SBCL 1.1.14 at 2014/2/11 14:3 '2 .

Added/Removed symbols

symbol status Imported/excluded from type
alist-hash-table added alexandria.0.dev function
compose added alexandria.0.dev function
(defmacro name lambda-list &body body)
(macrolet bindigs &body body)
(eval form)
(compile name definition)
(macroexpand form &optional env)
(macroexpand-1 form &optional env)
*macroexpand-hook*
@guicho271828
guicho271828 / non-recursive-struggling-macroexpansion.lisp
Last active August 29, 2015 13:56
non-recursive-struggling-macroexpansion.lisp
(require :cl21)
(in-package :cl21-user)
;; C は何らかの、処理系独特の最適化が行われる
;; 関数の例だと考えてください
(defun C-fun (x)
(print (* 10 x)))
@guicho271828
guicho271828 / file0.lisp
Created March 5, 2014 04:27
使えるマクロ: シェル引数を変数にバインド ref: http://qiita.com/guicho271828/items/c050fd5c6375c8e502c3
(defmacro with-boolean-options (bindings before after &body body)
(assert (typep before 'symbol))
(assert (typep after 'symbol))
`(let ((,after ,before))
(let ,(mapcar
(lambda (bind)
(ematch bind
((list (and var (type symbol))
(and str (type string)))
`(,var
(defun make-image (&optional repl)
(print (bt:all-threads))
(lparallel:end-kernel :wait t)
(sb-ext:gc :full t)
(if repl
(sb-ext:save-lisp-and-die "repl-image"
:toplevel
(lambda ()
(in-package :pddl.component-planner-test)
(sb-impl::toplevel-init))
@guicho271828
guicho271828 / X.lisp
Last active August 29, 2015 14:02
sketch
;; X.lisp
;; outfile のはじめに現在時間を付け加えるだけのスクリプト
(defparameter now (get-universal-time))
;; <- 一回だけ評価されるようにしたい。すべてのファイルで同じようにしたい。
;; ファイルごとに複数回評価されると、ファイルごとに追加される時間が異なってしまう。
(tagbody
start