#!/usr/local/bin/guile \
-e main -s
!#
;;; $Id: hash.guile,v 1.3 2001/06/29 23:12:37 doug Exp $
;;; http://www.bagley.org/~doug/shootout/
(define (main args)
(use-modules (ice-9 format))
(let* ((n (or (and (= (length args) 2) (string->number (cadr args))) 1))
(last (- n 1))
(c 0)
(x (make-hash-table n)))
(do ((i 1 (+ i 1)))
((> i n))
(hash-set! x (number->string i 16) i))
(do ((i last (- i 1)))
((< i 0))
(if (hash-ref x (number->string i 10))
(set! c (+ c 1))))
(display (format "~D\n" c))))