Better HN
topnewbestaskshowjobs
Log inSign up

lispertoascheme

7 karma · joined Dec 22, 2012 (13y ago) · 7 submissions

Submissions

comment 13y ago · link · parent

  cp /usr/bin/grep ack
Find the needles

   ./ack needle haystack
Find the silver needles

   ./ack silver.*needle
Find all needles except lead ones

   ./ack '[^^][^e.][^a.][^d.] needle' haystack
That last one could be tricky if there's other types of needles with names like "ead needle" or "mead needle". But using the haystack he gives us BRE can do the job, easily.

Perl regex may be easy to use but they are inferior from a performance perspective. As someone else said, they're slower than BRE or ERE. Moreover, even if speed is not an issue, you pay a price in the amount of memory you will need compared with line-based utilities like, e.g., sed and awk.

Find the needles

  sed '/needle/!d;/needle/q' haystack
Find the silver needles

  sed '/silver needle/!d;/silver needle/q' haystack
Find all needles except lead ones

  sed '/lead needle/d;/needle/!d/needle/q' haystack
My preference is to use (f)lex if I want a fast "parser" (scanner). Its regex is more than adequate.

comment 13y ago · link · parent

From August of this year, but still nice to see this again.

I don't even need to read the blog post. The title says it all. djb wrote about this in the docs for qmail many years ago.

My idea of a great "user experience":

I switched it on/started it up, it did what it's supposed to do, in a predictable span of time, without asking me questions or requiring me to fiddle with anything.

comment 13y ago · link · parent

The state of programmers trying to avoid coding in the language their system is coded in. C.

comment 13y ago · link · parent

The article focuses on a couple of lawyers. Lawyers are classic parasites. They need to find money-making entities to act as "hosts". When the economy is sinking, there are less healthy hosts for the parasites to target. The few parasites who are lucky enough to find hosts that can act as hosts will be in good stead (the article admits profits have risen at law firms, even if hiring has plummeted). It's strange to think the American Dream (How do you define it? Is it home ownership and progeny?) must be funded through parasitic behavior.

Be a host not a parasite and you will always be able to live the Dream, no matter what direction the economy goes. That's because you create value instead of merely searching out others who are creating it.

comment 13y ago · link · parent

One option is Common Lisp. It has a raw sockets library. The lib ("module") comes with a document that has some examples, including how to make HTTP requests.

6.

Ask HN: Sample Lisp code

2 points · by lispertoascheme · 13y ago · 2 comments