Arc Forumnew | comments | leaders | submit | wfarr's commentslogin

Where's the Elisp option? =/

-----


Projects have a way of sorting themselves. Give it time.

-----

2 points by almkglor 6460 days ago | link

Unless it's Lisp, in which case each programmer has his or her own personal version with his or her own personal macros.

-----

9 points by kennytilton 6460 days ago | link

No, it does not work that way, although people who do not understand macros (such as Guido) live in fear of that hobgoblin.

Macros are not used to create unrecognizable languages. They are used when an API has grown to the point where writing the code to use it can be automated. That is probably hard to parse if you fear macros, because you can only fear macros if you do not know how they are used. But the idea is simple.

This little call tends to require this little call before it and this little call after it, or something like that. And this pattern appears often enough, or the Lisp developer recognizes it as the sort of thing that will appear again and again, and they just say, macro time!

They then give the macro a totally comprehensible name derived from the bits of the API being hit and, golly, no confusion.

The other time you see macros is in things like aif. There will only be so many of these, and they will confuse people not at all.

It seems to me some people want macros to be a problem. They never are.

-----

3 points by almkglor 6460 days ago | link

Yes, well. In the office no one wants to touch my code, because it's built from bunches of macros, and no one else here knows how macros work. Oh well. Could be just me, I suppose.

Edit: gets even worse when I use C macros in C code ^^, they even instated a rule that loops should use for(i=0;i<limit;++i) and not my otherwise shorter repeat(i,limit) macro

-----

4 points by kennytilton 6460 days ago | link

"no one else here knows how macros work"

We almost agree. :) I don't know, when they look at your functions do they know what they do? When they see a class name do they understand the class hierarchy? Or do they start browsing? As for repeat(i, limit) being banned, I presume because no one could guess what it does, well, I am looking at bartender's school. The more I learn about software the harder it is to work with some people. :) But I don't blame Dilbert on the C preprocessor.

-----

2 points by almkglor 6460 days ago | link

LOL. I think the problem, partly, is the fact that we're attached to a Japanese company and the Japanese might not have that good a grasp of what "repeat" means (they tend to have a sneering attitude to anything non-Japanese, which means they suffer in the english-language department). I did manage to talk some guys into using repeat, but they got ordered by the Japanese to change it to "for", presumably because the Japanese knew "for", didn't know what "repeat" meant, and couldn't figure out how #define worked.

Edit: Too bad I'm a teetotaler, I'd have gone to bartender school too.

-----

4 points by wfarr 6460 days ago | link | parent | on: Bug in codelines function in code.arc

Your patch is now added to Anarki (http://git.nex-3.com/arc-wiki.git) as of now. =)

-----

1 point by kostas 6460 days ago | link

Thanks. Learning to use git is next on the priority list.

-----

2 points by wfarr 6461 days ago | link | parent | on: Forum Search?

The problem with doing an integrated search at this point is that because the forum uses flat files to store data, there's really no simple, concise way in which to search data. Can it be implemented? Yes, of course. But that isn't to say it'd be easy, nor that it would perform (and scale) well. Just use Google's search as mentioned by eds.

-----

1 point by eds 6461 days ago | link

Would it be possible to delegate searching out to google, just save the user the trouble of typing the extra "site:arclanguage.org"? I know I've seen sites before that used google search for the site's internal search. (Although admittedly, I have no idea how difficult that would be to set up.)

-----

2 points by bogomipz 6458 days ago | link

A form that redirects to google should be easy to implement. Another simple approach, that you can do for yourself, is to add a quick search in Firefox. I have this bound to keyword 'a';

http://www.google.com/search?q=site:arclanguage.org+%s

The problem with using google to search forums, however, is that it doesn't know anything about threads. When I type 'a module' in FF's location bar, I get 121 hits (should be 122 after I post this ;), and I have no idea how many threads that is - not very practical.

-----

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

For clarity's sake, here's my blogpage macro:

  (mac blogpage (title . body)
    `(tag html
       (tag head
          (prn "<link rel=\"stylesheet\" type=\"text/css\" href=\"index.css\">")
          (tag title (pr ,title)))
       (tag body
         (div (id "container")
           (div (id "header")
             (pr blogtitle*))
           (div (id "tabBar")
             (maketab "blog" "Home")
             (maketab "about" "About")
             (maketab "emacs" "Emacs")
             (when (admin user)
               (tab "newpost" "New")))
           (div (id "main")
             (div (id "content") ,@body)
             (div (id "sidebar")
               (link "archive")))
           (div (id "footer") (pr copyright*))))))
Please note that in this case, I renamed my tabs macro to maketab, to avoid conflicts.

-----

2 points by cadaver 6463 days ago | link

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

maybe we could use some doctype macros in html.arc

-----

1 point by wfarr 6463 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 6463 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 6463 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 6463 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 6463 days ago | link

Thanks.

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

-----

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

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

-----

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

Just for the sake of having checked, renaming the macro makes no difference in this case.

-----

1 point by cooldude127 6463 days ago | link

i didn't think so. not really sure then

-----

1 point by wfarr 6465 days ago | link | parent | on: Help with a macro

Thanks a lot for the help.

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

-----

8 points by cadaver 6465 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 6464 days ago | link

Thanks again!

-----

2 points by wfarr 6476 days ago | link | parent | on: Shorter programs, fewer axioms

A couple weeks ago, I made a query about changing the spec to make destructive functions end in ! and functions that return boolean results end in ?. I still think this is a good idea.

(Which corresponds to OP's #4)

-----

8 points by wfarr 6483 days ago | link | parent | on: Poll: What would you change in Arc?

Use of punctuation in all built-in functions, as well as the "coding guidelines" to reflect the function's return value:

(foo? bar) for functions that return boolean values (foo! bar) for functions that modify the value of bar, and return it (foo bar) for functions that don't return boolean values, and don't physically modify the value of (bar) [ie. everything else]

-----

More