Page 1 of 1

post-increment proposal

Posted: Fri Jul 15, 2005 7:08 pm
by Dmi
Possible it would be nice to have in native library post-increment versions of (inc) and (dec), which will return value as was before incrementing?
Something like:

Code: Select all

(define (inc-p symb num)
  (let (old (eval symb))
    (if num (inc symb num) (inc symb))
    old))

> (setq i 2)
2
> (inc-p 'i)
2
> i
3