[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Understanding dotimes skipping by 2
From: |
Van L |
Subject: |
Re: Understanding dotimes skipping by 2 |
Date: |
Fri, 28 Sep 2018 19:50:12 +1000 |
> - Note also the use of `(1+ x)' instead of (+ x 1). Though honestly I don't
> know what the difference really is. It's just the idiom I'm used to.
The 1+ syntactic sugar seems to cost performance by needing more lines of code
and it is less general in power to process the argument list if it were to be
extended like (+ x 1 2 3). There is no '(+1 x)' implemented in src/data.c
Could 1+ be an infix plus operator crutch?
┌────
│ 1 DEFUN ("1+", Fadd1, Sadd1, 1, 1, 0,
│ 2 doc: /* Return NUMBER plus one. NUMBER may be a number or a
marker.
│ 3 Markers are converted to integers. */)
│ 4 (register Lisp_Object number)
│ 5 {
│ 6 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (number);
│ 7
│ 8 if (FLOATP (number))
│ 9 return (make_float (1.0 + XFLOAT_DATA (number)));
│ 10
│ 11 XSETINT (number, XINT (number) + 1);
│ 12 return number;
│ 13 }
└────
┌────
│ 1 DEFUN ("+", Fplus, Splus, 0, MANY, 0,
│ 2 doc: /* Return sum of any number of arguments, which are numbers
or markers.
│ 3 usage: (+ &rest NUMBERS-OR-MARKERS) */)
│ 4 (ptrdiff_t nargs, Lisp_Object *args)
│ 5 {
│ 6 return arith_driver (Aadd, nargs, args);
│ 7 }
└────