Arc Forumnew | comments | leaders | submit | cadaver's commentslogin
2 points by cadaver 6148 days ago | link | parent | on: Odd behavior with some HTML-work

What you need is a doctype:

  (mac blogpage (title . body)
    `(do (prn "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">")
         (tag html
          ...
That should sort out the CSS problems.

-----

2 points by cooldude127 6148 days ago | link

maybe we could use some doctype macros in html.arc

-----

1 point by wfarr 6148 days ago | link

Additionally, I'd like to see the link macro replaced by something that doesn't... uh, conflict with the <link> tag (which is forcing us to use ugly (pr)s right now instead of (tag)).

-----

1 point by cooldude127 6148 days ago | link

what's wrong with this:

  (attribute link type opstring)
  (attribute link href opstring)
  (attribute link rel  opstring)
  (gentag type "text/css" rel "stylesheet" href "styles.css")

-----

1 point by wfarr 6148 days ago | link

While the doctype would sort them out usually, it seems that (defop index.css ...) is serving up the page oddly now, such that the CSS isn't being applied.

-----

2 points by sjs 6148 days ago | link

It's a clever hack but I'm not crazy about the inline CSS and JS in news.arc. I would just serve static files and as a bonus you'll get all the benefits of the CSS and JS modes of your text editor while editing the stuff. Perhaps pg just wanted to keep the arc dir tidy and doesn't actually do that on news.yc.

-----

2 points by wfarr 6148 days ago | link

Thanks.

I'll test it when "anarki" unbreaks for me.

-----

6 points by cadaver 6148 days ago | link | parent | on: A macro for creating infix DSLs

Please note that there is a space between ,@ and body in 'predicate-calculus, which is probably a typo.

-----

3 points by cchooper 6148 days ago | link

Thanks. Luckily, that doesn't seem to break it.

-----

1 point by cadaver 6148 days ago | link | parent | on: Odd behavior with some HTML-work

I've had a look at your index.css and it seems that all the ".tab" rules only work inside a #container.

Wrap your HTML with a <div id="container"> ... </div> and see if that works.

-----

1 point by wfarr 6148 days ago | link

It is already. I'm sorry if I didn't make that clear.

-----

3 points by cadaver 6149 days ago | link | parent | on: Hygienic Macros

To make this work for functions, you need to add ((procedure? s) s) to 'ac. Otherwise with arc2.tar:

  arc> (mac dont-break (a b) `(,list ,a ,b))
  #3(tagged mac #<procedure>)
  arc> (let list nil (dont-break 1 2))
  Error: "Bad object in expression #<procedure: list>"
Macros still remain a problem:

  (mac list-macro parms `(,list ,@parms))
  (mac break (a b) `(,list-macro ,a ,b))
  (break 1 2) => Error

-----

2 points by raymyers 6148 days ago | link

I stand corrected, it worked in Anarki :)

And yeah, it obviously wouldn't work for macros, but macros don't get shadowed by let blocks in the first place.

    (mac list-macro args `(list ,@args))
    (mac dont-break (a b) `(list-macro ,a ,b))
    (let list-macro nil (dont-break 1 2))  =>  (1 2)

-----

1 point by cadaver 6148 days ago | link

Then it is I who shall stand corrected :)

-----

11 points by cadaver 6150 days ago | link | parent | on: Help with a macro

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 6150 days ago | link

Thanks a lot for the help.

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

-----

8 points by cadaver 6150 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 6149 days ago | link

Thanks again!

-----

2 points by cadaver 6150 days ago | link | parent | on: Can Arc run as a script instead of REPL?

It's the scheme way to write multiline comments (possibly other lisps?). It's specified in the R6RS.

-----

1 point by kennytilton 6150 days ago | link

Also Common Lisp, and this reminds me that this is something I missed when working on some Arc code.

-----

2 points by cadaver 6150 days ago | link

#| ... |# works in Arc too. Though whether by design or because mzscheme supports it, I don't know.

-----

1 point by kennytilton 6150 days ago | link

Doh! :)

-----


Have a look at the little "help" next to the "about" box in your profile.

Also, I noticed that some people use a single ' to quote a function name on its own within a sentence (just like in Arc).

-----


It seems too that special end-of-symbol handling in the core, just because some users might possibly want to use intrasymbol-notation characters at the end of function names, does not go well with Arc's design philosophy:

... avoid having a language designed according to arbitrary rules rather than the actual demands of the task ...

http://www.arclanguage.com/item?id=2555

Good philosophy I think.

-----


I don't think intrasymbol notation should necessarily keep one from using special intrasymbol characters at the end of function names, even though currently it does.

By the way:

  arc> (bound 'fill-array!)
  nil
  arc> (def fill-array! parms parms)
  #<procedure: fill-array!>
  arc> (bound 'fill-array!)
  t
  arc> (ssexpand 'fill-array!)
  (fill-array (quote #<eof>))
Although I don't know how you can get at the fill-array! function, defined it is.

-----

2 points by raymyers 6152 days ago | link

Hey look, another thing the interpreter sees as EOF. Other favorites include "\!" and ".a".

-----

1 point by cadaver 6152 days ago | link | parent | on: A macrolet implementation

There was a post a while ago about how you might get first-class macros through lazy compilation: http://arclanguage.com/item?id=842

I'm not exactly sure if this is what you want. I believe there is a difference between macros that are only expanded once (in lazy compilation), and macros that are called each time the macro-expression is encountered. Though the latter case would only make sense if the macro exhibits side-effects, or depends on side-effects, or if the argument list to the macro may change. Not sure whether there is any benefit in that.

-----

More