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
;;; -*- lexical-binding: t; -*- | |
;; 括弧への異常な愛情 (https://www.slideshare.net/m2ym/common-lisp-9838434) | |
;; からの引用 | |
(require 'cl-lib) | |
(defmacro with-cache (key &rest body) | |
(declare (indent 1)) | |
(cl-once-only (key) |
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
#include <stdio.h> | |
//---------------------------------------------------------------- | |
#define INDEX_RSEQ() 4, 3, 2, 1, 0 | |
#define VA_ARGS_SIZE_IMPL(ARG1, ARG2, ARG3, ARG4, N, ...) N | |
#define VA_ARGS_SIZE_AUX(...) VA_ARGS_SIZE_IMPL(__VA_ARGS__) | |
#define VA_ARGS_SIZE(...) VA_ARGS_SIZE_AUX(__VA_ARGS__, INDEX_RSEQ()) | |
#define CONCATENATE_AUX(x, y) x##y | |
#define CONCATENATE(x, y) CONCATENATE_AUX(x, 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
;;; eaw.el --- Fix east asian ambiguous width issue for emacs | |
;; Author: HAMANO Tsukasa <code@cuspy.org> | |
;; URL: https://github.com/hamano/locale-eaw | |
;; Version: 12 | |
;; MIT License | |
;;; Code: | |
(defconst eaw-east-asian-ambiguous | |
[#x00A1 ; (1) Po INVERTED EXCLAMATION MARK |
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
# Use colon separators. | |
xterm-24bit|xterm with 24-bit direct color mode, | |
use=xterm-256color, | |
setb24=\E[48:2:%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%dm, | |
setf24=\E[38:2:%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%dm, | |
# Use semicolon separators. | |
xterm-24bits|xterm with 24-bit direct color mode, | |
use=xterm-256color, | |
setb24=\E[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm, | |
setf24=\E[38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm, |
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
// | |
// C で多値を返す関数の実験コード | |
// | |
// Lisp -> C へのトランスレータを実装する時に多値をどう実装すればいいかを確認する実験コード | |
// | |
// 基本的に values() の呼び出しは values1 が呼ばれる | |
// 多値が必要な時は multiple-value-bind の第2引数で呼ばれた時のみで、 | |
// レキシカルに判断出来るので、この方法で問題無い(はず…) |
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
;;; -*- lexical-binding: t; -*- | |
;; Emacs Lisp で実装する、9つのフィボナッチ関数 | |
;; 内訳は以下の通り | |
;; | |
;; 再帰呼び出し系 | |
;; fib-tail-recursion | |
;; fib-double-recursion | |
;; |
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
;; `vc-git-grep'はインタラクティブに実行するとファイル名等色々聞いてくるので | |
;; Enterだけで実行する為のラッパーコマンド | |
(defun vc-git-grep-quick (regexp &optional files dir) | |
(interactive | |
(progn | |
(grep-compute-defaults) | |
(let ((regexp (grep-read-regexp)) | |
(files (concat "*." (file-name-extension (buffer-file-name)))) | |
(dir ".")) |
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
let array = [...Array(50)].map(_ => Math.floor(Math.random() * 20)); | |
let a = array.filter(function (x, i, self) { | |
return self.indexOf(x) === i; | |
}); | |
let b = Array.from(new Set(array)); | |
console.log(a, b); | |
let loopCount = 1000000; |
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
(let (cs) | |
(dolist (x '(1 2 3 4 5)) | |
(push #'(lambda () x) cs)) | |
(mapcar #'funcall cs)) | |
;;=> (5 4 3 2 1) | |
;; 展開後 (こんな感じになる) | |
(let ((ls '(1 2 3 4 5)) | |
cs) | |
(while ls |
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 xyzzy-dolist ((var listform &optional (resultform ''nil)) &body body) | |
`(do* ((#1=#:tailvar ,listform (cdr #1#)) | |
(,var (car #1#) (car #1#))) | |
((null #1#) ,resultform) | |
,@body)) |
NewerOlder