post-increment proposal

Started by Dmi, July 15, 2005, 12:08:58 PM

Previous topic - Next topic

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:
(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
WBR, Dmi