Arc Forumnew | comments | leaders | submitlogin
11 points by cadaver 6116 days ago | link | parent

Since the first parameter to 'div is going to be a list of paramters/values you have to unquotesplice it:

  (mac div (args . body)
    `(tag (div ,@args) ,@body))
               ^^

  arc>(attribute div align opsym)
  #<procedure: opstring>
  arc>(mac div (args . body) `(tag (div ,@args) ,@body))
  #3(tagged mac #<procedure>)
  arc> (div (align 'left) (tag (hr)))
  <div align=left><hr></hr></div>"</"


1 point by wfarr 6116 days ago | link

Thanks a lot for the help.

Is there any particular reason why there's a random trailing "</" ?

-----

8 points by cadaver 6116 days ago | link

The <div ... </div> is written to stdout; it's a side-effect, not the result of the expression. It is the trailing "</" that's the result of the expression, and therefore gets written to stdout after the expression's side-effects.

I don't think 'tag means to return "</" in particular. It's just that 'pr -- which is used to write the closing tag like so: (pr "</" ...) -- returns its first argument and 'tag returns the value that's returnd by 'pr.

-----

1 point by wfarr 6115 days ago | link

Thanks again!

-----