unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6488: put `cl-floor', `cl-ceiling', `cl-truncate', `cl-round', and `cl-mod'  side-effect-free
@ 2010-06-21 22:36 MON KEY
  2011-07-13 23:30 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: MON KEY @ 2010-06-21 22:36 UTC (permalink / raw)
  To: 6488

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\





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#6488: put `cl-floor', `cl-ceiling', `cl-truncate', `cl-round', and `cl-mod'  side-effect-free
  2010-06-21 22:36 bug#6488: put `cl-floor', `cl-ceiling', `cl-truncate', `cl-round', and `cl-mod' side-effect-free MON KEY
@ 2011-07-13 23:30 ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-13 23:30 UTC (permalink / raw)
  To: MON KEY; +Cc: 6488

MON KEY <monkey@sandpframing.com> writes:

> 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:

I don't think this is worth doing.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-13 23:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-21 22:36 bug#6488: put `cl-floor', `cl-ceiling', `cl-truncate', `cl-round', and `cl-mod' side-effect-free MON KEY
2011-07-13 23:30 ` Lars Magne Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).