[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] Clean versus pure in types.db
From: |
Peter Bex |
Subject: |
[Chicken-hackers] Clean versus pure in types.db |
Date: |
Sun, 11 Mar 2012 18:26:59 +0100 |
User-agent: |
Mutt/1.4.2.3i |
Hi all,
I was looking through types.db and noticed that some procedures
were marked "clean" and others "pure". If I understand correctly,
the difference is that "clean" procedures may still have side-effects
but will not mutate their input arguments (so pure is a more strict
notion which implies everything clean implies, plus more)
If that's correct, why are procedures like "length" and "list-tail"
marked clean but not pure?
(length (#(procedure #:clean #:enforce) length (list) fixnum) ; may loop
((null) '0)
((list) (##core#inline "C_u_i_length" #(1))))
(##sys#length (#(procedure #:clean #:enforce) ##sys#length (list) fixnum)
((null) '0)
((list) (##core#inline "C_u_i_length" #(1))))
(list-tail (forall (a) (#(procedure #:clean #:enforce) list-tail ((list-of a)
fixnum) (list-of a))))
Now, these are special-cased so maybe that's the reason? However,
append, reverse and mem* are not special-cased and AFAICT should be
pure but are all only marked "clean".
Cheers,
Peter
--
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
is especially attractive, not only because it can be economically
and scientifically rewarding, but also because it can be an aesthetic
experience much like composing poetry or music."
-- Donald Knuth
- [Chicken-hackers] Clean versus pure in types.db,
Peter Bex <=