Created
April 30, 2010 18:49
-
-
Save cametan001/385607 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
CL-USER> #" " と \. を含みます。"# | |
" \" と \\. を含みます。" | |
CL-USER> |
This file contains hidden or 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
CL-USER> #>END | |
ここには何でも置けますよ: "、\、"#、や ># だって | |
置けちゃう。この文字列の読み込みを終わらせるには...END | |
"ここには何でも置けますよ: \"、\\、\"#、や ># だって | |
置けちゃう。この文字列の読み込みを終わらせるには..." | |
CL-USER> |
This file contains hidden or 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
;;; SHARP-DOUBLE-QUOTE | |
;; Scheme-style | |
(defun |#"-reader| (stream sub-char numarg) | |
(declare (ignore sub-char numarg)) | |
(labels ((iter (chars prev) | |
(let ((curr (read-char stream))) | |
(if (and (char= prev #\") (char= curr #\#)) | |
(reverse chars) | |
(iter (cons prev chars) curr))))) | |
(coerce (iter nil (read-char stream)) 'string))) | |
(set-dispatch-macro-character | |
#\# #\" #'|#"-reader|) |
This file contains hidden or 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
;;; SHARP-GREATER-THAN | |
;; Scheme-style | |
(defun |#>-reader| (stream sub-char numarg) | |
(declare (ignore sub-char numarg)) | |
(labels ((foo (chars curr) | |
(if (char= #\newline curr) | |
(reverse chars) | |
(foo (cons curr chars) (read-char stream)))) | |
(bar (curr pattern pointer output) | |
(if (null pointer) | |
(reverse (nthcdr (length pattern) output)) | |
(bar (read-char stream) pattern | |
(if (char= (car pointer) curr) | |
(cdr pointer) | |
pattern) (cons curr output))))) | |
(let ((pattern (foo nil (read-char stream)))) | |
(coerce (bar (read-char stream) pattern pattern nil) 'string)))) | |
(set-dispatch-macro-character | |
#\# #\> #'|#>-reader|) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment