commit: #'float: if handed a bigfloat, give the same bigfloat back.
13 years, 12 months
Aidan Kehoe
changeset: 5315:2a7b6ddb8063
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Wed Dec 29 23:51:08 2010 +0000
files: src/ChangeLog src/floatfns.c
description:
#'float: if handed a bigfloat, give the same bigfloat back.
2010-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* floatfns.c (Ffloat): If we've been handed a bigfloat here, it's
appropriate to give the same bigfloat back.
diff -r 596011a8bf8f -r 2a7b6ddb8063 src/ChangeLog
--- a/src/ChangeLog Wed Dec 29 23:47:30 2010 +0000
+++ b/src/ChangeLog Wed Dec 29 23:51:08 2010 +0000
@@ -1,3 +1,8 @@
+2010-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * floatfns.c (Ffloat): If we've been handed a bigfloat here, it's
+ appropriate to give the same bigfloat back.
+
2010-11-30 Aidan Kehoe <kehoea(a)parhasard.net>
* fns.c (Ffill):
diff -r 596011a8bf8f -r 2a7b6ddb8063 src/floatfns.c
--- a/src/floatfns.c Wed Dec 29 23:47:30 2010 +0000
+++ b/src/floatfns.c Wed Dec 29 23:51:08 2010 +0000
@@ -788,6 +788,11 @@
if (FLOATP (number)) /* give 'em the same float back */
return number;
+
+ if (BIGFLOATP (number))
+ {
+ return number;
+ }
return Ffloat (wrong_type_argument (Qnumberp, number));
}
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit: = < > <= >=: it's OK to use the compiler macro when first, last args side effect
13 years, 12 months
Aidan Kehoe
changeset: 5314:596011a8bf8f
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Wed Dec 29 23:47:30 2010 +0000
files: lisp/ChangeLog lisp/cl-macs.el
description:
= < > <= >=: it's OK to use the compiler macro when first, last args side effect
2010-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* cl-macs.el (= < > <= >=):
For these functions' compiler macros, the optimisation is safe
even if the first and the last arguments have side effects, since
they're only used the once.
diff -r 5ed261fd2bd9 -r 596011a8bf8f lisp/ChangeLog
--- a/lisp/ChangeLog Wed Dec 29 23:43:10 2010 +0000
+++ b/lisp/ChangeLog Wed Dec 29 23:47:30 2010 +0000
@@ -1,3 +1,10 @@
+2010-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * cl-macs.el (= < > <= >=):
+ For these functions' compiler macros, the optimisation is safe
+ even if the first and the last arguments have side effects, since
+ they're only used the once.
+
2010-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* cl-macs.el (inline-side-effect-free-compiler-macros):
diff -r 5ed261fd2bd9 -r 596011a8bf8f lisp/cl-macs.el
--- a/lisp/cl-macs.el Wed Dec 29 23:43:10 2010 +0000
+++ b/lisp/cl-macs.el Wed Dec 29 23:47:30 2010 +0000
@@ -3752,7 +3752,7 @@
(put function 'cl-compiler-macro
#'(lambda (form &rest arguments)
(if (or (null (nthcdr 3 form))
- (notevery #'cl-safe-expr-p (cdr form)))
+ (notevery #'cl-safe-expr-p (butlast (cdr arguments))))
form
(cons 'and (mapcon
#'(lambda (rest)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit: Unrool a load-time loop at macro expansion time, cl-macs.el
13 years, 12 months
Aidan Kehoe
changeset: 5313:5ed261fd2bd9
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Wed Dec 29 23:43:10 2010 +0000
files: lisp/ChangeLog lisp/cl-macs.el
description:
Unrool a load-time loop at macro expansion time, cl-macs.el
2010-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* cl-macs.el (inline-side-effect-free-compiler-macros):
Unroll a loop here at macro-expansion time, so these compiler
macros are compiled. Use #'eql instead of #'eq in a couple of
places for better style.
diff -r f6471e4ae703 -r 5ed261fd2bd9 lisp/ChangeLog
--- a/lisp/ChangeLog Wed Dec 29 23:38:38 2010 +0000
+++ b/lisp/ChangeLog Wed Dec 29 23:43:10 2010 +0000
@@ -1,3 +1,10 @@
+2010-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * cl-macs.el (inline-side-effect-free-compiler-macros):
+ Unroll a loop here at macro-expansion time, so these compiler
+ macros are compiled. Use #'eql instead of #'eq in a couple of
+ places for better style.
+
2010-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* cl-extra.el (notany, notevery): Avoid some dynamic scope
diff -r f6471e4ae703 -r 5ed261fd2bd9 lisp/cl-macs.el
--- a/lisp/cl-macs.el Wed Dec 29 23:38:38 2010 +0000
+++ b/lisp/cl-macs.el Wed Dec 29 23:43:10 2010 +0000
@@ -3762,22 +3762,28 @@
(cdr form)))))))
'(= < > <= >=))
-(mapc
- #'(lambda (y)
- (put (car y) 'side-effect-free t)
- (put (car y) 'byte-compile 'cl-byte-compile-compiler-macro)
- (put (car y) 'cl-compiler-macro
- (list 'lambda '(w x)
- (if (symbolp (cadr y))
- (list 'list (list 'quote (cadr y))
- (list 'list (list 'quote (caddr y)) 'x))
- (cons 'list (cdr y))))))
- '((first 'car x) (second 'cadr x) (third 'caddr x) (fourth 'cadddr x)
+;; XEmacs; unroll this loop at macro-expansion time, so the compiler macros
+;; are byte-compiled.
+(macrolet
+ ((inline-side-effect-free-compiler-macros (&rest details)
+ (cons
+ 'progn
+ (loop
+ for (function . details) in details
+ nconc `((put ',function 'side-effect-free t)
+ (define-compiler-macro ,function (&whole form x)
+ ,(if (symbolp (car details))
+ (reduce #'(lambda (object1 object2)
+ `(list ',object1 ,object2))
+ details :from-end t :initial-value 'x)
+ (cons 'list details))))))))
+ (inline-side-effect-free-compiler-macros
+ (first 'car x) (second 'cadr x) (third 'caddr x) (fourth 'cadddr x)
(fifth 'nth 4 x) (sixth 'nth 5 x) (seventh 'nth 6 x)
(eighth 'nth 7 x) (ninth 'nth 8 x) (tenth 'nth 9 x)
(rest 'cdr x) (plusp '> x 0) (minusp '< x 0)
- (oddp 'eq (list 'logand x 1) 1)
- (evenp 'eq (list 'logand x 1) 0)
+ (oddp 'eql (list 'logand x 1) 1)
+ (evenp 'eql (list 'logand x 1) 0)
(caar car car) (cadr car cdr) (cdar cdr car) (cddr cdr cdr)
(caaar car caar) (caadr car cadr) (cadar car cdar)
(caddr car cddr) (cdaar cdr caar) (cdadr cdr cadr)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit: Avoid some dynamic scope stupidity in interpreted code, #'notany, #'notevery.
13 years, 12 months
Aidan Kehoe
changeset: 5312:f6471e4ae703
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Wed Dec 29 23:38:38 2010 +0000
files: lisp/ChangeLog lisp/cl-extra.el
description:
Avoid some dynamic scope stupidity in interpreted code, #'notany, #'notevery.
2010-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* cl-extra.el (notany, notevery): Avoid some dynamic scope
stupidity with local variable names in these functions, when they
weren't prefixed with cl-; go into some more detail in the doc
strings.
diff -r 07d24b1f27a7 -r f6471e4ae703 lisp/ChangeLog
--- a/lisp/ChangeLog Wed Dec 29 23:25:52 2010 +0000
+++ b/lisp/ChangeLog Wed Dec 29 23:38:38 2010 +0000
@@ -1,3 +1,10 @@
+2010-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * cl-extra.el (notany, notevery): Avoid some dynamic scope
+ stupidity with local variable names in these functions, when they
+ weren't prefixed with cl-; go into some more detail in the doc
+ strings.
+
2010-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* byte-optimize.el (side-effect-free-fns): #'remove, #'remq are
diff -r 07d24b1f27a7 -r f6471e4ae703 lisp/cl-extra.el
--- a/lisp/cl-extra.el Wed Dec 29 23:25:52 2010 +0000
+++ b/lisp/cl-extra.el Wed Dec 29 23:38:38 2010 +0000
@@ -128,13 +128,23 @@
`(lambda (&rest arguments) ,@(if documentation (list documentation))
(not (apply ',function arguments))))
-(defun notany (cl-pred cl-seq &rest cl-rest)
- "Return true if PREDICATE is false of every element of SEQ or SEQs."
- (not (apply 'some cl-pred cl-seq cl-rest)))
+(defun notany (cl-predicate cl-seq &rest cl-rest)
+ "Return true if PREDICATE is false of every element of SEQUENCE.
-(defun notevery (cl-pred cl-seq &rest cl-rest)
- "Return true if PREDICATE is false of some element of SEQ or SEQs."
- (not (apply 'every cl-pred cl-seq cl-rest)))
+With optional SEQUENCES, call PREDICATE each time with as many arguments as
+there are SEQUENCES (plus one for the element from SEQUENCE).
+
+arguments: (PREDICATE SEQUENCES &rest SEQUENCES)"
+ (not (apply 'some cl-predicate cl-seq cl-rest)))
+
+(defun notevery (cl-predicate cl-seq &rest cl-rest)
+ "Return true if PREDICATE is false of some element of SEQUENCE.
+
+With optional SEQUENCES, call PREDICATE each time with as many arguments as
+there are SEQUENCES (plus one for the element from SEQUENCE).
+
+arguments: (PREDICATE SEQUENCES &rest SEQUENCES)"
+ (not (apply 'every cl-predicate cl-seq cl-rest)))
;;; Support for `loop'.
(defalias 'cl-map-keymap 'map-keymap)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
commit: Mark #'remove, #'remq as free of side-effects.
13 years, 12 months
Aidan Kehoe
changeset: 5311:07d24b1f27a7
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Wed Dec 29 23:25:52 2010 +0000
files: lisp/ChangeLog lisp/byte-optimize.el
description:
Mark #'remove, #'remq as free of side-effects.
2010-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* byte-optimize.el (side-effect-free-fns): #'remove, #'remq are
free of side-effects.
(side-effect-and-error-free-fns):
Drop dot, dot-marker from the list.
diff -r 317ebaee6e4f -r 07d24b1f27a7 lisp/ChangeLog
--- a/lisp/ChangeLog Wed Dec 01 03:35:22 2010 +0900
+++ b/lisp/ChangeLog Wed Dec 29 23:25:52 2010 +0000
@@ -1,3 +1,10 @@
+2010-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * byte-optimize.el (side-effect-free-fns): #'remove, #'remq are
+ free of side-effects.
+ (side-effect-and-error-free-fns):
+ Drop dot, dot-marker from the list.
+
2010-11-17 Aidan Kehoe <kehoea(a)parhasard.net>
* cl-extra.el (coerce):
diff -r 317ebaee6e4f -r 07d24b1f27a7 lisp/byte-optimize.el
--- a/lisp/byte-optimize.el Wed Dec 01 03:35:22 2010 +0900
+++ b/lisp/byte-optimize.el Wed Dec 29 23:25:52 2010 +0000
@@ -1245,7 +1245,7 @@
marker-buffer max member memq min mod
next-window nth nthcdr number-to-string numerator
parse-colon-path plist-get previous-window
- radians-to-degrees rassq regexp-quote reverse round
+ radians-to-degrees rassq rassoc remove remq regexp-quote reverse round
sin sqrt string< string= string-equal string-lessp string-to-char
string-to-int string-to-number substring symbol-plist symbol-value
symbol-name symbol-function symbol
@@ -1271,7 +1271,7 @@
current-buffer
;; XEmacs: extent functions, frame-live-p, various other stuff
devicep device-live-p
- dot dot-marker eobp eolp eq eql equal eventp extentp
+ eobp eolp eq eql equal eventp extentp
extent-live-p fixnump floatingp floatp framep frame-live-p
get-largest-window get-lru-window
hash-table-p
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
Re: [COMMIT] Handle bignum N correctly, #'butlast, #'nbutlast.
14 years
Aidan Kehoe
Ar an triú lá de mí na Nollaig, scríobh Jerry James:
> On Fri, Dec 3, 2010 at 9:46 AM, Samuel Bronson <naesten(a)gmail.com> wrote:
> > So, I guess bignums are guaranteed not to be representable as fixnums,
> > then? That doesn't seem to be very clearly spelled out anywhere in
> > (lispref), though things of that sort are mentioned in passing...
>
> Hmmm, I guess you can blame that on me. I did the initial bignum
> work, although Aidan has improved on that work quite a bit.
The lispref does say it, e.g. in (lispref)The Bignum Extension:
The XEmacs bignum facility implements the Common Lisp notions of
"canonicalization" and "contagion". Canonicalization means that in
exact (integer and ratio) arithmetic, a result of an operation is
always converted to the "smallest" type that can represent it exactly.
and, (lispref)Canonicalization and Contagion:
-- Function: canonicalize-number number
Return the canonical form of NUMBER.
However, if we've done our job properly, this is always a no-op.
That is, if you find a number in un-canonicalized form, please report
it as a bug.
That’s clear enough if you’re used to Common Lisp terminology, which I admit
many people aren’t.
> Anyway, that's the way it has always been in Lisps that have bignums.
> The integer type is partitioned into the fixnum and bignum types.
> Fixnums fit into a fixed amount of space, so that they can be operated
> on efficiently (by a small number of CPU instructions). Bignums are
> unbounded, but operations on them are less efficient.
--
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
-- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches