title: How to increment a variable in Lisp
body: <p>Here's the problem in the code:</p>
  <pre><code>    (foreach n l_pt
          (write-line
              (strcat &quot;sommet&quot; str_sep
                  (itoa (setq (nbs (+1 nbs )))) str_sep
                  (rtos (car n) 2 2) str_sep
                  (rtos (cadr n) 2 2) str_sep
                  (strcat &quot;2&quot;) str_sep
                  (strcat &quot;borne&quot;)
              )
              f_open
          )
      )
      ;;(write-line &quot;&quot; f_open)
  </code></pre>
  <p>I have these kind of files in output:</p>
  <blockquote>
  <p>Sommets;;</p>
  <p>Type;Num;X;Y;Precison;Nature</p>
  <p>sommet;1;1532292.16;3214140.11;2;borne</p>
  <p>sommet;2;1532287.08;3214140.60;2;borne</p>
  <p>sommet;1;1532291.45;3214136.43;2;borne</p>
  <p>sommet;2;1532286.50;3214135.87;2;borne</p>
  <p>sommet;1;1532287.08;3214140.60;2;borne</p>
  </blockquote>
  <p>As you've guessed, the problematic part is the &quot;Num&quot; which is not working as intended, incrementing.</p>
  <p>I've understood that it's this line: &quot;    (itoa (setq (nbs (+1 nbs )))) str_se&quot; not working as intended, but I don't know why. I've tried to switch it to (setq (nbs (+ 1 nbs))), but it doesn't works either.</p>
  <p>Do you have any ideas from where it's coming?</p>
  <p><a href="http://pastebin.com/R34w5hKw" rel="nofollow noreferrer">Complete code</a></p>