bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6488: put `cl-floor', `cl-ceiling', `cl-truncate', `cl-round', and `


From: MON KEY
Subject: bug#6488: put `cl-floor', `cl-ceiling', `cl-truncate', `cl-round', and `cl-mod' side-effect-free
Date: Mon, 21 Jun 2010 18:36:22 -0400

Following fncns from lisp/emacs-lisp/cl-compat.el

`cl-floor' `cl-ceiling' `cl-truncate' `cl-round' `cl-mod'

are aliased in cl.el as `floor*' `ceiling*' `round*' `truncate*'

The definition of `Values-list' uses cl.el's `values' not
cl-compat.el's `Values'. Does this mean that all of the below is
redundant:

,----
| (defun cl-floor (a &optional b) (Values-list (floor* a b)))
| (defun cl-ceiling (a &optional b) (Values-list (ceiling* a b)))
| (defun cl-round (a &optional b) (Values-list (round* a b)))
| (defun cl-truncate (a &optional b) (Values-list (truncate* a b)))
`----

IOW, are the following not equivalent:

(Values-list (truncate* a b))
 --> (apply 'values (truncate* 17 9))
  --> (apply 'list (truncate* 17 9))
   --> (truncate* 17 9)

Or, am I missing something?

And, if not, and in the off chnace that the byte-compiler would
benefit, would it be reasonable to put the 'side-effect-free property
on `cl-floor', `cl-ceiling', `cl-truncate', `cl-round', `cl-mod' as
they currently don't have it:

(let (gthr-sef)
  (dolist (sefl '(floor*    cl-floor
                  ceiling*  cl-ceiling
                  truncate* cl-truncate
                  round*    cl-round
                  mod*      cl-mod)
                (setq gthr-sef (nreverse gthr-sef)))
    (if (get sefl 'side-effect-free)
        (push `(,sefl . side-effect-free) gthr-sef)
      (push `(,sefl . IS-NOT-side-effect-free) gthr-sef))))

--
/s_P\





reply via email to

[Prev in Thread] Current Thread [Next in Thread]