Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Lisp macros remind me of dynamically generating SQL statements.

If you've ever built a string in T-SQL or PL/SQL and then exec'd it, you're probably much closer to being productive with macros than you think.

Of course, this is probably because dynamically generating SQL is something that I've done. Other programmers probably have their own mental models that warp into lisp.



Yeah, I think that's a fair way to start thinking about them. But Lisp macros, to extend your example, are more like if you could generate the SQL using SQL. Which sounds like a totally horrible thing actually. :) But with Lisp it makes much more sense because lisp programs are lists. If SQL programs were tables, then it'd be a better fit...


You'd have to stretch the analogy to not only generating SQL with SQL, but extending SQL with SQL, to create constructs that weren't even possible to write in SQL before you extended it.


> If SQL programs were tables, then it'd be a better fit...

Now there's an idea...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: