Author: sburson Date: Sun Jun 10 21:31:10 2007 New Revision: 13
Modified: trunk/Code/defs.lisp trunk/Code/fset.lisp Log: Fixed a minor bug in the bag printer. Also, added `fset-user' package for convenient experimentation with FSet.
Modified: trunk/Code/defs.lisp ============================================================================== --- trunk/Code/defs.lisp (original) +++ trunk/Code/defs.lisp Sun Jun 10 21:31:10 2007 @@ -63,6 +63,31 @@ #:alist))
+;;; A convenient package for experimenting with FSet. Also serves as an example +;;; of how one might create a package for code to be written using FSet. Note, +;;; though, that for each of the shadowing-imported symbols, it's up to you whether +;;; to import the FSet version or the CL version. It's also up to you, of course, +;;; whether you want to use GMap and New-Let. +;;; You may also wish to do: +;;; (setq *readtable* *fset-readtable*) +(defpackage :fset-user + (:use :cl :fset :gmap :new-let) + (:shadowing-import-from :new-let #:let #:cond) + (:shadowing-import-from :fset + ;; Shadowed type/constructor names + #:set #:map + ;; Shadowed set operations + #:union #:intersection #:set-difference + ;; Shadowed sequence operations + #:first #:last #:subseq #:reverse #:sort #:stable-sort + #:find #:find-if #:find-if-not + #:count #:count-if #:count-if-not + #:position #:position-if #:position-if-not + #:remove #:remove-if #:remove-if-not + #:substitute #:substitute-if #:substitute-if-not + #:some #:every #:notany #:notevery)) + + ;;; The seq implementation tries to use strings for leaf vectors when possible. ;;; In some Lisp implementations, there are two kinds of strings; but in some ;;; of these, the larger form takes as much space as a general vector.
Modified: trunk/Code/fset.lisp ============================================================================== --- trunk/Code/fset.lisp (original) +++ trunk/Code/fset.lisp Sun Jun 10 21:31:10 2007 @@ -1230,7 +1230,7 @@ (count-if #'(lambda (x) (not (funcall pred x))) s :key key)))
(defun print-bag (bag stream level) - (format stream "#{@ ") + (format stream "#{% ") (let ((i 0)) (do-bag (x n bag) (when (> i 0) @@ -1241,13 +1241,13 @@ (incf i) (if (> n 1) (progn - (format stream "#@") + (format stream "#%") (write `(,x ,n) :stream stream :level (and *print-level* (- *print-level* level)))) (write x :stream stream :level (and *print-level* (- *print-level* level))))) (when (> i 0) (format stream " "))) - (format stream "@}")) + (format stream "%}"))
;;; Note that this yields each element potentially multiple times. (GMap needs