EDIT: 2012-08-29: I added a section to compare comparison counts with known bounds for general comparison sorts and sorting networks. In an earlier post, I noted how tedious coding unrolled sorts can be. Frankly, thatâs the main reason I stopped at leaf sorts of size three. Recently, Neil Toronto wrote a nice post on the generation of size-specialised merge sorts. The post made me think about that
ããã¹ããã¡ã¤ã«ã®åè¡ããã¤ãåã¨ãã¦èªã¿è¾¼ããã¯ããå®ç¾©ã SBCLçã®ããã«æååãå é¨çã«ã¦ãã³ã¼ãã¨ãã¦è¡¨ç¾ãã¦ããå¦çç³»ã§ã¯ãããã¹ããã¡ã¤ã«ãèªã¿è¾¼ãéããã®ãã¡ã¤ã«ãä¸æ£ãªãã¤ãåãå«ãã§ããã¨èªã¿è¾¼ã¿ã«å¤±æãããã¨ãããã®ã§ããã®å¯¾å¦ã¨ãã¦ã ;;;; ã¨ã©ã¼ã®ä¾ ;;;; sbcl-1.0.40 ;;;; ;; æ®éã®è¡èªã¿è¾¼ã¿ãã¯ããå®ç¾© (defmacro each-file-line ((line filepath) &body body) `(with-open-file (#1=#:in ,filepath) (loop FOR ,line = (read-line #1# nil nil) WHILE ,line DO (progn ,@BODY)))) ;;;; ;; ä¸æ£ãªãã¤ãåãå«ãããã¹ããã¡ã¤ã«ã®ä½æ (with-open-file (out "s
SBCLã®ããã¥ã¢ã«(ver 1.0.37)ã«ãæ¸ãã¦ãããã¨ã ãã© ... ã é常ã¯æ§é ä½ã®ã¤ã³ã¹ã¿ã³ã¹ãä½æããã¨ãã¼ãä¸ã«ãã®ããã®é åãå²ãå½ã¦ãããã ããã«ã¯(ãããã)ãã¼ãå²ãå½ã¦ï¼GCå¦çã®ã³ã¹ããä¼´ãã®ã§ãæ§é ä½ã¨ãã¦ã¾ã¨ãããããããã®åãã£ã¼ã«ããåå¥ã«æ±ã£ãæ¹ããããã©ã¼ãã³ã¹çã«ã¯æå©ã ã£ããããã ;; sbcl-1.0.40 ;; ;; æ§é ä½ã®ã¤ã³ã¹ã¿ã³ã¹ä½æã®ã³ã¹ãã測ãããããã°ã©ã ;; ç¯å²ã表ãæ§é ä½ (defstruct range start end) ;; ç¯å²ãã©ã³ãã ã«è¤æ°çæãããããã®è·é¢ã®åè¨å¤ãæ±ãã ;; 1) æ§é ä½ã使ãå ´å (time (let ((total 0)) (loop REPEAT 1000000 DO (let ((r (make-range :start (random 100) :end (rando
ããªã¤ã«ã®ç¼å£²ã¨ä¸è¯çã ããªã¤ã«ããããè¦ãããããã«ãªãã¾ããããçãç°ã§ãæ³³ãã§ãããã®ãä¸æ¯è³¼å ¥ãã¾ãã ç«æ´¾ãªå¤§ããªå¢¨è¢ãèã¯å·åä¿åã㦠æãããªèº«ã¯å£ç¯ã®ãè±ããéèã¨åããã¦ä¸è¯ã®çããã®ã«ãæ°é®®ãªã«ãã«ãã®èã¯å»ã¿ãé¦ãé«ãé£æ¬²ããããã¾ãã ä¸è¶³ã¯ãã³ãã«ãâ¦
sbcl(1.0.28)ã§ã¯ãå®è¡å¯è½ãã¡ã¤ã«ãä½æãããã¨ãã§ããã > (sb-ext:save-lisp-and-die "å®è¡å¯è½ãã¡ã¤ã«å" :toplevel #'ã¨ã³ããªé¢æ° :executable t) ã¨ã³ããªé¢æ°ã«ã¯(å¿ é å¼æ°ã®æ°ã0åãªã?)ã©ã®ãããªé¢æ°ã§ãæå®å¯è½ãªã®ã ããããããã¯ã»ãããããæå¾ éãã«åãé¢æ°ãä¸ããä½æããã®ã¯ãè¥å¹²æéåã£ããããã ãªã®ã§ãã¨ã³ããªé¢æ°ä½æç¨ã®ãã¯ããä½æããã ããã¾ã§æ±ç¨çã§ã¯ãªãã®ã§ããã®æã ã§æãå ããå¿ è¦ãããã¨ã¯æããããã³ãã¬ã¼ãã¨ãã¦ã¯ååã ã¨æãã 以ä¸ã³ã¼ãï¼ ;; ãã¹ã®ãã¡ã¤ã«åé¨åãåãåºã (defun basename (pathstring) (let ((path (parse-namestring pathstring))) (format nil "~A~@[.~A~]" (pathn
aproposã¨describeãä¸ç·ã«ãããããªé¢æ°ãä½æã ååã¯ãã®ã¾ã¾apropos-descã aproposã使ãã°ãã·ã³ãã«ä¸è¦§ãåå¾ã§ããããããã«(ãã®ã·ã³ãã«ã«ãã¤ã³ããã¦ãã)é¢æ°ãªã©ã®ç°¡åãªæ å ±(å¼æ°ãè¿ãå¤ãããã¥ã¡ã³ã)ãä¸ç·ã«è¡¨ç¤ºãããããã«ããã åºæ¬çã«ã¯ãapropos-listã®çµæã«describeãé©ç¨ããã ãã ããsbclã®æ¨æºã®describeåºåã¯è¥å¹²éãå¤ããããã¨ãããã®ã§ãèªåã«å¿ è¦ãªæ å ±ã ããåºåããããã«ãã¦ãä¸è¦§æ§ãä¸ãã¦ããã ä¾ ;; 第ä¸å¼æ°ã¾ã§ã¯ãaproposé¢æ°ã¨åæ§ ;; "multiple"ãå«ãã·ã³ãã«ãcommon-lispããã±ã¼ã¸ããæ¢ãã¦ããã®ååã¨ç°¡æçãªæ å ±ã表示ããã > (apropos-desc "multiple" :common-lisp t) === multiple-value-bind
alpha-char-pé¢æ°ãèªåã®äºæ³å¤ã®æåãããã®ãçºè¦ã(確èªããã®ã¯ãsbclã¨clisp) ;; äºæ³éã > (alpha-char-p #\a) --> T ;; ããã > (alpha-char-p #\0) --> NIL ;; äºæ³å¤ > (alpha-char-p #\ã) --> T å¥ã«ãã¢ã«ãã¡ããããããaããzã¾ã§ã®æåã ããæãããã§ã¯ãªãã®ã§ãä¸ã®æåã¯é©åãªã®ã ããããä½ã¨ãªãããããé¢æ°ã¯aãz,AãZã®æåã«ã ãtrueãè¿ãå°è±¡ããã£ã(Cã®isalphaã¨ãã®å½±é¿ã?)ã ãCommon LISP 第2çãã«ã¯ãalpha-char-pã®èª¬æã¨ãã¦ãæ¨æºæåï¼standard-char-pã«ãã£ã¦å®ç¾©ããããã®ï¼ã«å¯¾ãã¦ã¯æåAããZã¾ã§ã¨aããzã¾ã§ãã¢ã«ãã¡ãããã§ããã(p.331)ã¨æ¸ããã¦ããã®ã§ã(and (standard-c
æè¿ã®ãã¼ã¸ã§ã³ã®SBCL*1ã§ã¯ãå¦çé度ãæåªå ã«ãã宣è¨ãè¡ã£ã¦é¢æ°ãã³ã³ãã¤ã«ããå ´åã§ããããã©ã«ãã§ã¯ã³ã³ãã¤ã©ãã¼ã*2ã表示ãããªããã¨ããã*3ã ãã®ãããæé©åã確å®ã«è¡ãããå ´åã¯ãã³ã³ãã¤ã©ãã¼ããåºåããããã«æ示çã«å®£è¨ããå¿ è¦ãããã (declare (optimize (debug 0) (safety 0) (speed 3) (compilation-speed 0)) ;; âãããå¿ è¦ (sb-ext:unmuffle-conditions sb-ext:compiler-note)) ã¾ããããã¯ã©ãããdeclaimã§å®£è¨ããå ´åã¯ç¡å¹ã§ãdeclareã使ãå¿ è¦ãããããã ã *1:ä»å試ããã®ã¯1.0.28 *2:æé©åãè¡ãããã«ä¿®æ£ãå¿ è¦ãªç®æãªã©ãæãã¦ããã *3:å¤åcompile-fileé¢æ°ã§ã³ã³ãã¤ã«ãè¡ãå ´åã¯ãããã©ã«
sbcl This manual is part of the SBCL software system. See the README file for more information. This manual is largely derived from the manual for the CMUCL system, which was produced at Carnegie Mellon University and later released into the public domain. This manual is in the public domain and is provided with absolutely no warranty. See the COPYING and CREDITS files for more information.
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}