Permalink
Browse files

export all match forms; added alist->hash

  • Loading branch information...
1 parent 6dd8b17 commit fc465d150bebcec997fce1822603f7d9bbb9eb14 @vegashacker committed Jan 5, 2009
Showing with 7 additions and 2 deletions.
  1. +7 −2 util.scm
View
@@ -80,6 +80,7 @@
hash-filter-map
hash-hash-map
hash-find
+ alist->hash
bucketed-hash-add!
fold ;(iterative-style)
fold-right ;(recursive-style)
@@ -136,8 +137,7 @@
show
prn
- match-lambda
- match
+ (all-from-out scheme/match)
xexpr->string ; XXX implement yourself!
@@ -233,6 +233,11 @@
(hash-set! ht `key val) ...
ht))))
+(define (alist->hash alist)
+ (let ((ht (make-hash)))
+ (for-each (match-lambda ((list-rest k v) (hash-set! ht k v))) alist)
+ ht))
+
(define (vector-for-each fn . vs)
(let ((len (vector-length (first vs))))
(let lp ((i 0))

0 comments on commit fc465d1

Please sign in to comment.