Because in this case, defmacro is used as a template in nim.
    
    
    $ sbcl
    This is SBCL 1.5.5, an implementation of ANSI Common Lisp.
    More information about SBCL is available at <http://www.sbcl.org/>.
    
    SBCL is free software, provided as is, with absolutely no warranty.
    It is mostly in the public domain; some portions are provided under
    BSD-style licenses.  See the CREDITS and COPYING files in the
    distribution for more information.
    * (defmacro itr(ixx c1xx c2xx &rest body)
      `(loop for ,ixx from ,c1xx to ,c2xx do
             (format t "~a- " ,ixx) ,@body))
    
    (itr i 0 3 (format t "Hello, world~%")
             (format t "End~%"))ITR
    *
    0- Hello, world
    End
    1- Hello, world
    End
    2- Hello, world
    End
    3- Hello, world
    End
    NIL
    * $
    $ ed tm.nim
    tm.nim: No such file or directory
    a
    template itr(ixx,c1xx,c2xx,body:untyped):untyped =
      for ixx in c1xx..c2xx:
        write stdout,ixx,"- "
        body
    itr i,0,3:
      echo "Hello, world"
      echo "End"
    .
    w
    157
    q
    $ nim c -r tm.nim
    Hint: used config file '/usr/home/jin/src/Nim_devel/config/nim.cfg' [Conf]
    Hint: used config file '/usr/home/jin/src/Nim_devel/config/config.nims' 
[Conf]
    Hint: system [Processing]
    Hint: widestrs [Processing]
    Hint: io [Processing]
    Hint: tm [Processing]
    CC: stdlib_io.nim
    CC: stdlib_system.nim
    CC: tm.nim
    Hint:  [Link]
    Hint: operation successful (21814 lines compiled; 1.067 sec total; 
24.379MiB peakmem; Debug Build) [SuccessX]
    Hint: /usr/home/jin/tmp/tm  [Exec]
    0- Hello, world
    End
    1- Hello, world
    End
    2- Hello, world
    End
    3- Hello, world
    End
    
    
    Run

Reply via email to