277 karma · joined August 16, 2007
In many cases you could just define plain functions and have a way to denote what parts of the input should be converted to lambdas. I proposed something like this on the Arc forum, but it just got brushed aside. I still think it's a decent idea.
Also, many common macros (e.g. HTML generators) confer a performance advantage by doing computation at compile time, but do not confer any expressive advantage.
But, this is not to say that macros can't increase expressivity. You agree that the creation of new languages (metalinguistic abstraction) is an important tool, right? Think of a macro as a compiler for an arbitrary language or sub-language into Lisp. Lisp's homoiconic syntax just makes such compilers extremely easy to write. The trade-off is that the homoiconic syntax is harder to read (IMO).
If you want an example of a useful macro, here's one I used in a recent program. The interface was a simple command line where commands and their arguments generally corresponded to functions and their arguments. Much of the code looked like this (highly simplified):
(define (add a b) (print (+ a b)))
(new-command 'add add "Adds two integers" (a integer) (b integer))
The program would then display "add" among the list of available commands, along with its description and syntax. When the user typed e.g. "add 1 2" it would validate the input and call add on it.Obviously, there's a lot of duplication above, because the properties of a function (its name, its parameters, etc.) aren't available at runtime; theoretically some reflection system could provide this, but it would be kind of a mess. So I wrote a macro that unified define and new-command, roughly like this:
(define-command add (a integer b integer)
"Adds two integers"
(print (+ a b)))
In short, I designed a domain-specific language to attack my problem, and Lisp made it easier than any other language would have.Also, I'd suggest dropping the rhetoric about Lisp "culture," which you clearly have only a vague understanding of. Have some trust in your fellow humans.
"Be civil. Don't say things you wouldn't say in a face to face conversation.
"When disagreeing, please reply to the argument instead of calling names. E.g. 'That is an idiotic thing to say; 1 + 1 is 2, not 3' can be shortened to '1 + 1 is 2, not 3.'"
public static void main.
(xdef 'cos cos)
etc.In any event, I appreciate your taking the time to substantiate your claims. Doing so helps keep the quality of discussion here high.
Giving something a nasty name isn't enough to prove that it's wrong. You have to actually refute it.
> Did white people steal the "rule the world" gene? Of course not.
Do you remember Biology 101? Populations change over time. Why are other species capable of evolving, but humans not?
I'm not saying that genetics are the explanation for this change, but again, if you're going to deny the possibility you have to actually provide some evidence.
I object to the article's claim that
> the roots of many handicaps actually lie in the stereotypes.... women’s performance on spatial and mathematical tasks is created by ... the stereotype of their spatial and mathematical inferiority
Stereotypes may contribute slightly to group differences, but they are not the primary cause of them.
No, it became popular because it used to be necessary. Math education (at all levels) is designed to teach 'how' rather than 'what' and this made sense when computation was something you had to do on paper. As to why it hasn't adapted, my guess is politics. There are too many people who lack any capacity for abstract reasoning but squeak through math classes by memorizing rules and procedures. These people naturally make a fuss when the rules and procedures are taken away and they start doing poorly.
http://steve.yegge.googlepages.com/when-polymorphism-fails
Note that like many of the alleged deficiencies of OCaml, this was a compromise for performance.
I don't know why OCaml gets so little attention (and such bitter hatred from a few people), but maybe it's because its merits are mundane: it focuses on doing things right, rather than superficial coolness (Python) or lofty idealism (Haskell, Scheme). The result is a language that's very nice to use.
let mylist = [`Int 5; `Char '5']
Technically the elements have the same compile-time type, but the question is, what practical difference does that make? In what cases are variants an inadequate solution?Hash tables in functional-style languages often let you specify a hash function. That means the hash function is a property of the collection, rather than the objects in it. If you prefer a more "object-oriented" design, you can use an object system such as tinyclos to define a generic hash function. But Schemers usually like to avoid such complexity.
Looking at the PLT documentation, I see that its hash tables don't let you specify a hash function. That's definitely a shortcoming, though arguably not a serious one in practice. SRFI 69 gets this right.
Much of the difference is subjective. FreeBSD feels coherently designed, whereas Linux is a patchwork of programs written by different people with different styles and philosophies.
I don't know a lot about Gentoo (most of my experience is with Debian and Slackware) but from what I understand, its purpose is to be as flexible as possible. That's a legitimate goal, but it seems to conflict with ease of use.