[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 01/09: Default "meet" operator is meet-error for intmap
From: |
Andy Wingo |
Subject: |
[Guile-commits] 01/09: Default "meet" operator is meet-error for intmap |
Date: |
Wed, 08 Apr 2015 15:21:04 +0000 |
wingo pushed a commit to branch master
in repository guile.
commit 33ab2838de874fe2b9dfae2008c93e550c7ab4af
Author: Andy Wingo <address@hidden>
Date: Thu Mar 26 13:32:46 2015 +0100
Default "meet" operator is meet-error for intmap
* module/language/cps/intmap.scm (meet-error): New helper.
(intmap-add, intmap-union, intmap-intersect): The "meet" argument is
optional and defaults to meet-error.
---
module/language/cps/intmap.scm | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/module/language/cps/intmap.scm b/module/language/cps/intmap.scm
index d6c017a..e3ed5da 100644
--- a/module/language/cps/intmap.scm
+++ b/module/language/cps/intmap.scm
@@ -1,5 +1,5 @@
;;; Functional name maps
-;;; Copyright (C) 2014 Free Software Foundation, Inc.
+;;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
;;;
;;; This library is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU Lesser General Public License as
@@ -102,7 +102,10 @@
;; Shouldn't be reached...
(else empty-intmap)))))
-(define (intmap-add bs i val meet)
+(define (meet-error old new)
+ (error "Multiple differing values and no meet procedure defined" old new))
+
+(define* (intmap-add bs i val #:optional (meet meet-error))
(define (adjoin i shift root)
(cond
((zero? shift)
@@ -209,7 +212,7 @@
(let ((i (visit-node root shift i)))
(and i (+ min i))))))))
-(define (intmap-union a b meet)
+(define* (intmap-union a b #:optional (meet meet-error))
;; Union A and B from index I; the result will be fresh.
(define (union-branches/fresh shift a b i fresh)
(let lp ((i 0))
@@ -288,7 +291,7 @@
((eq? root b-root) b)
(else (make-intmap a-min a-shift root)))))))))
-(define (intmap-intersect a b meet)
+(define* (intmap-intersect a b #:optional (meet meet-error))
;; Intersect A and B from index I; the result will be fresh.
(define (intersect-branches/fresh shift a b i fresh)
(let lp ((i 0))
- [Guile-commits] branch master updated (50fcdfe -> eb9d442), Andy Wingo, 2015/04/08
- [Guile-commits] 01/09: Default "meet" operator is meet-error for intmap,
Andy Wingo <=
- [Guile-commits] 02/09: Add intmap-prev, Andy Wingo, 2015/04/08
- [Guile-commits] 03/09: Add intmap-fold., Andy Wingo, 2015/04/08
- [Guile-commits] 04/09: Add intset-fold, intset-fold2, Andy Wingo, 2015/04/08
- [Guile-commits] 06/09: 32-way branching in intmap.scm, not 16-way, Andy Wingo, 2015/04/08
- [Guile-commits] 07/09: Add "transient" intmap interface, Andy Wingo, 2015/04/08
- [Guile-commits] 08/09: Transient intsets, Andy Wingo, 2015/04/08
- [Guile-commits] 05/09: Intset-next micro-optimizations, Andy Wingo, 2015/04/08
- [Guile-commits] 09/09: Add "cps2" experiment, Andy Wingo, 2015/04/08