Welcome to the CHICKEN Scheme pasting service

wrong use of make-hash-table? added by C-Keen on Sat Jul 30 12:18:06 2011


(use filepath posix simple-sha1)

(define (register-img f h)
  (let ((k (sha1sum f)))
    (cond ((hash-table-ref/default h k #f) =>
           (lambda (v)
             (hash-table-set! h k (cons f v))))
          (else (hash-table-set! h k (list f))))
    h))



(define (find-photos dir)
  (printf "Searching for all jpegs in ~a~%" dir)
  (find-files dir
              test: (lambda (f)
                      (let ((ext (filepath:take-extension f)))
                        (unless (equal? ext "")
                          (irregex-search '(w/nocase (: "jp" (? "e") "g"))
                                          ext))))
              action: register-img
              seed: (make-hash-table #:test equal?)))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Name of the egg which implements this service:
Visually impaired? Let me spell it for you (wav file) download WAV