newLISP Fan Club

Forum => Anything else we might add? => Topic started by: Dmi on July 15, 2005, 12:08:58 PM

Title: post-increment proposal
Post by: Dmi on July 15, 2005, 12:08:58 PM
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