Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
News Feed in 38 lines of code using Cascalog (nathanmarz.com)
15 points by nathanmarz on May 8, 2010 | hide | past | favorite | 3 comments



Without understanding the language, I get the impression that the author prizes a low line count over readability.


"Without understanding the language"

Certainly any language is unreadable without understanding it. I don't pretend to make any comments on the readability of Chinese because I don't understand it.

Most people aren't familiar with logic programming, which is a different way of thinking about programming. It's not a huge leap to make, and I've tried to ease the process with tons of examples in the introductory tutorials.

Once you understand the basic concepts, Cascalog is much more readable than any of the alternatives. Here's the query for all people that are 25 and male.

(?<- (stdout) [?p] (age ?p 25) (gender ?p "m"))

It reads as "Find all ?p where ?p's age is 25 and ?p's gender is "m". That's a lot better than specifying a query in terms of explicit joins and filters.


In case you're wondering what cascalog is (like I was):

http://nathanmarz.com/blog/introducing-cascalog/

"A Clojure-based query language for Hadoop"




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: