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
;;; .elと入力した時、\\.elとして扱われるようにしたい。 | |
(defun insert-result (s) | |
(insert (format "\n;;result:%s" s))) | |
(defun glob-to-regexp (str) | |
(loop for (pat . rep) in '(("\\." . "\\\\.") ("\\*" . ".*")) | |
do (setq str (replace-regexp-in-string pat rep str)) | |
finally return str)) |
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
(use '[clojure.contrib.combinatorics :only (cartesian-product )]) | |
;;●◆■▲★×4=★▲■◆● | |
(let [coll-to-num | |
(fn [coll] | |
(reduce #(+ (* %1 10) %2) 0 coll))] | |
(for [nums (apply cartesian-product (repeat 5 (range 0 10))) | |
:when (= (* 4 (coll-to-num nums)) | |
(coll-to-num (reverse nums)))] | |
nums)) |
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
(defn overlap [coll] | |
(->> coll | |
(reduce (fn [m x] | |
(assoc m x (+ 1 (get m x 0)))) | |
{}) | |
(filter (fn [[_ i]] (> i 1))) | |
(map first))) | |
(map (fn [x] x) (overlap [3 1 4 1 5 9 2 6 5 3 5 8 9])) |
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
;; draw pixels | |
(add-load-path "../") | |
(use gl.processing) | |
(use graphics.imlib2) | |
(use util.match) | |
(define *image-file* "a.jpg") | |
(define (load) | |
(let1 img (load-image *image-file*) |
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
(define-module myutil.tree | |
(use gauche.experimental.ref) | |
(use util.match) | |
(use srfi-1) | |
(use gauche.experimental.lamb) | |
(export-all)) | |
(select-module myutil.tree) | |
;;; primitive-procedure |
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
(define (read-until p reader) | |
(let loop ((result '())) | |
(let1 e (reader) | |
(cond [(p e) (reverse result)] | |
[else (loop (cons e result))])))) | |
(define (read-sentence) | |
(display ":-) ") | |
(read-until (cut eq? <> '@) read)) ;;gaucheは'.を受け付けない |
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
(define-cise-stmt RESULT_NEW_LIST | |
[(_ "base" i size loop-body) | |
`(let* ((__start::ScmObj SCM_NIL) | |
(__last::ScmObj SCM_NIL) | |
(__size::int ,size)) | |
(dotimes (,i __size) | |
,loop-body) | |
(result __start))] | |
[(_ :index i :size size ('let* binding . body)) | |
`(RESULT_NEW_LIST "base" ,i ,size |
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
mkdir ~/.fonts/afm | |
cd ~/.fonts/afm | |
mkfontdir | |
mkfontscale | |
mkafmmap `locate -r "\\.afm$"` | |
fc-cache -f -v |
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
;; /** \file | |
;; * Regression test for bug #1987563 (reported by GenPFault) : | |
;; * | |
;; * glcEnable(GLC_KERNING_QSO) does not enable kerning. | |
;; * Microsoft Word 2003 and the official Freetype tutorial kerning algorithm | |
;; * both produced the correct kerning which is different from the kerning | |
;; * obtained with QuesoGLC. | |
;; * Actually, the combination of GLC_GL_OBJECTS and KERNING induces the bug. | |
;; */ |
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
;;; redefine draw function then update display automatically | |
(extend gl.processing) | |
(use gauche.threads) | |
(define gen-timer-id | |
(let1 i 0 | |
(^ () (inc! i) i))) | |
(define (timer$ function) |
OlderNewer