<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Random Hacks: Why Ruby is an acceptable LISP</title>
    <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Technology and Other Fun Stuff</description>
    <item>
      <title>"Why Ruby is an acceptable LISP" by Charlie Lindahl</title>
      <description>&lt;p&gt;I worked for a number of years on &lt;span class="caps"&gt;LISP&lt;/span&gt; machines at Texas Instruments in the 80s&lt;/p&gt;


	&lt;p&gt;One of my points is : it&amp;#8217;s the environment. Not just the &lt;span class="caps"&gt;IDE&lt;/span&gt;; in &lt;span class="caps"&gt;LISP&lt;/span&gt; and Smalltalk environments &lt;span class="caps"&gt;EVERYTYHING&lt;/span&gt; is written in the language in
question/use (with the exception of machine-specific low-level stuff
required to talk to the OS / machine architecture).&lt;/p&gt;


	&lt;p&gt;What this means (not great for a general business case, but incredible for learning and expressive power) is that I can actually take apart / customize / study the underlying OS and/or tools.&lt;/p&gt;


	&lt;p&gt;So, for example, say you don&amp;#8217;t like the way &lt;span class="caps"&gt;EMACS&lt;/span&gt; works. Go grab the source (a keystroke away in &lt;span class="caps"&gt;LISP&lt;/span&gt; IDEs) and go plowing through it with
 the IDEs/debuggers and rewrite it to your specifications.&lt;/p&gt;


	&lt;p&gt;I learned the Macintosh Toolbox structure by running Lisp on the Mac
and dissecting the window data structures (on the fly / realtime )
without needing to have source code.&lt;/p&gt;


	&lt;p&gt;Once Ruby gets to the point of this kind of power in the environment,
inspection, and debugging it&amp;#8217;ll be amazingly powerful.&lt;/p&gt;


	&lt;p&gt;Quite good now from what I&amp;#8217;ve seen so far.&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;My $.02&lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;Charlie Lindahl
Houston, TX&lt;/code&gt;&lt;/pre&gt;</description>
      <pubDate>Thu, 13 Dec 2007 20:18:46 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:b3a3767a-29c2-46c3-b0cb-b3b05e813cce</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-544</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by Timmy Jose</title>
      <description>&lt;p&gt;For a programmer used to C/C++ and &lt;span class="caps"&gt;JAVA&lt;/span&gt; and having merely studied the rudimentaries of Lisp in college ( as part of A.I ) and having had to content myself by looking at Ruby from the sidelines till now, I found this thread extremely interesting. It was all a bit one-sided though with Lispers outnumbering Rubyists (?) by a huge ratio! In my opinion, the syntax of Lisp seemed to be more in tune with my liking than Ruby&amp;#8217;s. I think I&amp;#8217;ll take the plunge with Lisp and see where Ruby fits in later. Good job on the discussion people!&lt;/p&gt;</description>
      <pubDate>Thu, 18 Jan 2007 06:18:08 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:bd793319-7fd2-4775-a98a-e216481b30ff</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-234</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by A Total Coward</title>
      <description>&lt;p&gt;bill a: your links to LoaL are all 404s. Did this stuff every see any daylight?&lt;/p&gt;</description>
      <pubDate>Wed, 17 Jan 2007 21:50:32 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:c888fe5e-4836-4c03-b8a5-95c184de0558</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-233</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by David A. Wheeler</title>
      <description>&lt;p&gt;One problem with traditional Lisp notation is that it&amp;#8217;s fairly hard to read&amp;#8212;and as programs get bigger, it gets worse.   It&amp;#8217;s especially nasty when you use operators that are traditionally infix operators, e.g., (+ 3 (* 2 3)) may be a regular syntax, but even Graham admits it&amp;#8217;s awkward.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve developed a notation called &amp;#8220;sweet-expressions&amp;#8221; which I think are easier to read.  A sweet-expression readers can read normal s-expressions, but can also accept other formats. It still works with all the macro constructs, etc., of Lispy languages.  More info is here:
&lt;a href="http://www.dwheeler.com/readable/" rel="nofollow"&gt;http://www.dwheeler.com/readable/&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Mon, 15 Jan 2007 01:35:39 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:96c8e399-c532-42e4-a321-9aa6bceb3016</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-229</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by Eric Kidd</title>
      <description>&lt;p&gt;Chris Rathman: &lt;i&gt;I thought I’d mention my pet project to translate the &lt;span class="caps"&gt;SICP&lt;/span&gt; examples into these languages.&lt;/i&gt;&lt;/p&gt;


	&lt;p&gt;Oh, that&amp;#8217;s really cool.  Thanks for the link!&lt;/p&gt;</description>
      <pubDate>Sun, 14 Jan 2007 21:20:26 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:8ae3bb44-aa0d-4377-87e0-73b84223480d</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-228</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by gar37bic</title>
      <description>&lt;p&gt;I also often &amp;#8216;scrape&amp;#8217; (with permission) &lt;span class="caps"&gt;HTML&lt;/span&gt;, SQL, &lt;span class="caps"&gt;CVS&lt;/span&gt;, PDF, &lt;span class="caps"&gt;DOC&lt;/span&gt; and other files off the net, to generate input data for our company&amp;#8217;s data mining operation, for example corporate federal and &lt;span class="caps"&gt;SEC&lt;/span&gt; filings.&lt;/p&gt;


	&lt;p&gt;And right now I&amp;#8217;m scripting OpenOffice to do file format conversions to .DOC &amp;#8230;&lt;/p&gt;</description>
      <pubDate>Sun, 14 Jan 2007 15:46:48 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:1066aa1d-f055-436e-8390-0865dfa3f7e2</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-227</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by gar37bic</title>
      <description>&lt;p&gt;This is a great discussion, and has been very informative for me.  I&amp;#8217;m thinking about which language I want to tackle next, primarily for research into areas such as neural networks.&lt;/p&gt;


	&lt;p&gt;In my real life, I spend a lot of time writing heuristic filters based on regular expressions &amp;#8211; (typically using &lt;span class="caps"&gt;PCRE&lt;/span&gt;: &amp;#8216;perl-compatible regex&amp;#8217;, though I don&amp;#8217;t use Perl) &amp;#8211; to do things like parse, filter, sanitize and combine multiple legacy datasets into one &amp;#8216;canonical&amp;#8217; set.  This often requires running other programs to pre-sort incoming data streams, and then maintaining arrays of match-probability scores for possible matches.  How would these languages address problems such as these?&lt;/p&gt;</description>
      <pubDate>Sun, 14 Jan 2007 15:43:08 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:7d885806-c35e-441d-abe8-e38f510da09e</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-226</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by Chris Rathman</title>
      <description>&lt;p&gt;Since the topic is a comparison between Ruby and Lisp (and Simplicus expressed an interest in comparing Ruby with Haskell or ML or other FP languages), I thought I&amp;#8217;d mention my pet project to translate the &lt;span class="caps"&gt;SICP&lt;/span&gt; examples into these languages.&lt;/p&gt;


	&lt;p&gt;http://www.codepoetics.com/wiki/index.php?title=Topics:SICP_in_other_languages&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve still got a lot to learn about Ruby, but in translating the first chapter and a half the main quirks I had with Ruby were (1) it&amp;#8217;s lack of Tail Call Optimization &amp;#8211; an attibute shared with Python and JavaScript (many in the Lisp community consider the lack of &lt;span class="caps"&gt;TCO&lt;/span&gt; to be a bug); and (2) the distinction between named and anonymous functions.  As far as I can tell, you can curry lambdas, but you can&amp;#8217;t curry named functions &amp;#8211; Erlang works this way as well.&lt;/p&gt;</description>
      <pubDate>Sun, 14 Jan 2007 11:01:34 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:95c4a51a-ef34-4a3a-b5bc-d592c56e2b99</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-225</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by scripting geek</title>
      <description>&lt;p&gt;Very interesting and enjoyable discussion!&lt;/p&gt;


	&lt;p&gt;I did &lt;span class="caps"&gt;LISP&lt;/span&gt; and Scheme for a few years in the early 90s, doing AI at Berkeley.  Looking back over that code some years later, just for fun, I was struck by the total impenetrability of my earlier &lt;span class="caps"&gt;LISP&lt;/span&gt; excretions.  The resulting tangle of sexp was so nasty, I would have opted for ritual seppuku if required to decipher the stuff.  But that&amp;#8217;s just me and my substandard &lt;span class="caps"&gt;LISP&lt;/span&gt; code.&lt;/p&gt;


	&lt;p&gt;On another tangent..  I&amp;#8217;m finding the impassioned arguments about language properties very interesting, but ultimately somewhat irrelevant, at least insofar as productivity is concerned.&lt;/p&gt;


	&lt;p&gt;I think that nowadays the breadth and quality of the available open source libraries is a much larger factor in the appeal of a language as a useful tool than are the theoretical upper limits of its expressive capability.&lt;/p&gt;


	&lt;p&gt;Learning to live with somewhat clunky metaprogramming facilities as opposed to super-powerful macros is infinitely easier, I think, than lacking libraries for half the stuff you need done on a daily basis.&lt;/p&gt;


	&lt;p&gt;It sounds as though &lt;span class="caps"&gt;LISP&lt;/span&gt; is still far behind the Python/Ruby camps insofar as that&amp;#8217;s concerned, and for this reason alone I wouldn&amp;#8217;t give it another look at this time.  And, at least in my case, I learned that power of program-as-AST that&amp;#8217;s so nice for computers is not so good for human comprehension, as we do not make good recursive tree evaluators.  Beyond a modest level of nesting and layering, things start to look very nasty indeed.&lt;/p&gt;


	&lt;p&gt;Python/Ruby on the other hand are very readable, with plenty of useful idioms captured by grammar or sugar, and have APIs to easily interact with just about everything.  With tools such as these, I alone can replace a small department of C programmers, and that&amp;#8217;s very appealing.&lt;/p&gt;</description>
      <pubDate>Wed, 13 Dec 2006 06:48:37 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:3f8f4026-413f-4f45-a171-6c66ab28704c</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-224</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by Eric Kidd</title>
      <description>&lt;p&gt;Oh, I&amp;#8217;m a huge fan of Haskell. The syntax is nice and dense (though occasionally a bit alien), and monads are a remarkably powerful abstraction.&lt;/p&gt;


	&lt;p&gt;There&amp;#8217;s a whole class of designs which can be easily expressed with monads (unification, backtracking, transactions, continuations-as-a-library, localized state, modular parsers, and so on). A lot of these designs can&amp;#8217;t be implemented cleanly with Lisp macros (unless you write a code-walker, or an entire embedded language).&lt;/p&gt;


	&lt;p&gt;It also seems that monads are most useful when you can have more than one of them, and when you can overload your monadic operations depending on the return type of your function. This is the biggest barrier I&amp;#8217;ve found to using monadic code in Scheme.&lt;/p&gt;


	&lt;p&gt;Haskell is a fairly &lt;em&gt;hard&lt;/em&gt; programming language, and I doubt it will ever go mainstream. But it&amp;#8217;s by far one of the most interesting languages on the scene, and I learn a lot programming in it. My biggest complaint is the lack of subtyping, which is fixed by O&amp;#8217;Haskell.&lt;/p&gt;


	&lt;p&gt;If I had to recommend four languages to learn, I&amp;#8217;d recommend Ruby (because it&amp;#8217;s so fun), Lisp/Scheme (for the macros), Oz (for unification, concurrent logic and constraints) and Haskell (for monads and for the deeply mathematical style).&lt;/p&gt;</description>
      <pubDate>Thu, 26 Oct 2006 08:13:52 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:c655beac-0eab-4fd3-80cf-1603419c91b9</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-214</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by memeplex</title>
      <description>&lt;p&gt;Lack of community and codebase are strong impediments for every but a few language. Also most new languages are missing a standard ffi which let them easily access c/c++ legacy code, preferable via bindings autogenerated by tools like swig. In this regard, Lisp has cffi, which is a good thing. But anyway, you won&amp;#8217;t get too far away without people doing the heavy lifting, all that enormous amount of binding code should be generated, patched and tested. It seems like the way to go for small communities is to parasite mature and well established runtimes, and to compile to their intermediate binary representation. Of course I&amp;#8217;m talking of java and .net/mono/pnet here. They&amp;#8217;re doing their thing pretty well, performance is more than acceptable, and taken as intermediate languages (which msil is more than java bytecode) they can even be compiled to native code (take for example gcj). I love scheme programming but I&amp;#8217;m also fond of new oo+fp languages, namely scala or nemerle. Because of the reflection capabilities of this cross-language/cross-platform runtimes, binding is far easier than it is for C/C++ native stuff. Sometimes it&amp;#8217;s just a matter of importing modules and start using them. Admittedly, a generic runtime it&amp;#8217;s not the same than a standard library tailored to an specific language. But then those standard libraries could be build faster on top of the facilities offered by the runtime, and in case they are still not complete, one can always resort to the generic api, it&amp;#8217;s not a cul-de-sac. Also you can easily bind to c/c++ if you really need it: there are mature swig modules for java and c#, while there aren&amp;#8217;t others for a lot of cool, tiny languages. I&amp;#8217;m currently programming in bigloo scheme targeting the jvm, and in scala too (they both are able to generate code for the clr also, although support isn&amp;#8217;t that mature already). I think it&amp;#8217;s the way to go for languages with small communities. And in any case, these intermediate platforms promote code reuse, offer advanced interpretation/compilation techniques (while there could be lack of support for specific techniques, like tail-recursion, that&amp;#8217;s a price to pay), powerful development environments, etc etc. Just how I&amp;#8217;m feeling like lately.&lt;/p&gt;</description>
      <pubDate>Tue, 24 Oct 2006 21:01:44 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:ac22ce88-3f92-4864-b6c6-a0ddc7514a24</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-213</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by William James</title>
      <description>Quicksort in Ruby:
&lt;p&gt;&lt;pre&gt;
def qsort ary
  return ary  if ary == []
  pivot = ary[0]
  left, right = ary[1..-1].partition{|x| x &amp;lt; pivot }
  qsort( left ) + [pivot] + qsort( right )
end
&lt;/pre&gt;&lt;/p&gt;</description>
      <pubDate>Tue, 24 Oct 2006 12:56:48 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:3774efc5-39b6-4bc1-91c5-d9ab05a4c491</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-212</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by schemer</title>
      <description>&lt;p&gt;Argh.  I made some bad typos to my post: I meant &lt;em&gt;lack of&lt;/em&gt; non-imperative i/o in my prior statement.&lt;/p&gt;


	&lt;p&gt;Also, I forgot to note several prominent scheme hackers have implemented monads in scheme, though unfortunately there&amp;#8217;s no standardized example&amp;#8230;&lt;/p&gt;


	&lt;p&gt;Lazy evaluation in scheme is also doable as you mentioned, even though I haven&amp;#8217;t yet gottten the srfi for stream-define and friends working properly (apparently the my implementations&amp;#8217; modules are not compatable with it without extra macros)&lt;/p&gt;


	&lt;p&gt;I also don&amp;#8217;t grasp why the srfi for memoized streams uses set! when it could just use a helper function (but then again, I would say that this is a problem of mutable define in scheme)&lt;/p&gt;</description>
      <pubDate>Thu, 19 Oct 2006 18:04:23 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:9d885113-d614-48d8-bf7b-29177282a6f6</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-210</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by schemer</title>
      <description>&lt;p&gt;Simplicus, I would agree that pattern matching and guards are awesome, even in the absense of types.&lt;/p&gt;


	&lt;p&gt;I mainly code in Scheme, but I was absolutely blown away by Monads and lazy evaluation when I tried Haskell.  I can&amp;#8217;t belive most programmers consider those aspects of Haskell a turn off, both are techniques which I was earlier trying to reinvent while programming in Scheme while not even realizing it.&lt;/p&gt;


	&lt;p&gt;However, from personal experience, I would have to note that there is no reason why scheme can&amp;#8217;t have those features; (There are libraries for pattern matching as you presumed, and there are&lt;/p&gt;


	&lt;p&gt;As for what I think makes scheme less &amp;#8220;functionally dense&amp;#8221; than Haskell are:&lt;/p&gt;


	&lt;p&gt;Scheme&amp;#8217;s mutable define, mutable cons, and non-imperative i/o are what make it less functional than Haskell.  Of course, these features that I mentioned aren&amp;#8217;t really fundamental properties of the language, both in my opinion are historical cruft that I hope someday will be fixed&amp;#8230;&lt;/p&gt;


	&lt;p&gt;On the other hand, I&amp;#8217;d &lt;em&gt;love&lt;/em&gt; to see a sexpr Haskell. :)&lt;/p&gt;


	&lt;p&gt;As for ruby, I don&amp;#8217;t consider it to be &amp;#8220;functional,&amp;#8221; (although I wouldn&amp;#8217;t be surpised if ruby programmers were fond of hofs) because as far as I know, it doesn&amp;#8217;t have tail-call optimization.  With Common Lisp, even though it doesn&amp;#8217;t have tco, every major compiler out there (CMUCL, &lt;span class="caps"&gt;SBCL&lt;/span&gt;, probably also CLisp) optimizes tail calls, so I have no particular problem with CL, assuming a very non-idiomatic style to CL.&lt;/p&gt;


	&lt;p&gt;&lt;span class="caps"&gt;TCO&lt;/span&gt; is a big deal for me, because in Elisp I have to use destructive maps/filters to avoid exceeding the functional call depth, that&amp;#8217;s really annoying&amp;#8230;&lt;/p&gt;</description>
      <pubDate>Thu, 19 Oct 2006 17:55:57 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:5ef18dda-c1f8-4890-88da-c833e6be9504</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-209</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by Simplicus</title>
      <description>&lt;p&gt;Why compare Ruby with Lisp and not with Erlang, Haskell or ML or other FP languages?&lt;/p&gt;


	&lt;p&gt;I find this discussion very fruitful in many aspects. Yet the most interesting part of it for me personally is to what extent Ruby is a functional language?  Or using Eric terminology how “functionally dense” Ruby really is?&lt;/p&gt;


	&lt;p&gt;I have no doubts that Lisp and Scheme in particular can be used for functional programming (FP). Nevertheless both of these languages can be used equally well for non-functional programming also.&lt;/p&gt;


	&lt;p&gt;Now back to my question: 
Why compare Ruby with Lisp and not with Erlang, Haskell or ML, or other “true” (Haskell) or “more functional” (Erlang, ML) FP languages?&lt;/p&gt;


	&lt;p&gt;I understand that from the above mentioned FP languages only Erlang has no strict types and two others (Haskell and ML) are strict. Nevertheless, I think that we can still compare “functional density” of those with Ruby’s.&lt;/p&gt;


	&lt;p&gt;I have 20+ years of programming experience, starting with &lt;span class="caps"&gt;DEC PDP&lt;/span&gt;-11 Macro Assembler and most of later work in &lt;span class="caps"&gt;OOP&lt;/span&gt;, such as C+ and then Java which I started to play with its first alpha release. That time I liked Java a lot compared to C++. During that “old times” I had also a chance to get to know &lt;span class="caps"&gt;CLOS&lt;/span&gt; and was charmed with its powerful ideas (lists = code = data, generic functions, &lt;span class="caps"&gt;MOP&lt;/span&gt;, to name a few), uniformity and simplicity. Unfortunately, that time (and today as well) I couldn’t find a way to do my living working on Lisp or Scheme projects, though I did some work in AI related areas (and learned many other “small” and “big” languages including Prolog) .&lt;/p&gt;


	&lt;p&gt;About three years ago I started to research FP quite seriously, trying to find programming tools (languages) more powerful then Java and other &lt;span class="caps"&gt;OOP&lt;/span&gt; languages that I could use to implement some of the ideas waiting in silo quite for a long time already.&lt;/p&gt;


	&lt;p&gt;I started with Scheme, then ML and now Haskell which I like most for its clarity and power. In between I am looking at Erlang and Ruby. Returning back to “FP density” Scheme and Lisp lack some powerful constructs that ML and Haskell have and that I find very important for uniformity, clarity, readability and expressiveness of the language. (Mind you, I love them all Haskell, Scheme and Lisp :)&lt;/p&gt;


	&lt;p&gt;These things are:&lt;/p&gt;


	&lt;p&gt;1) Guards (Haskell)&lt;/p&gt;


	&lt;p&gt;2) Pattern matching (Haskell, ML, Erlang)&lt;/p&gt;


	&lt;p&gt;3) List comprehensions (Haskell)&lt;/p&gt;


	&lt;p&gt;Guards example:&lt;/p&gt;


&lt;pre&gt;
max :: Int -&amp;gt; Int -&amp;gt; Int
max x y
    | x &amp;gt;=y     = x
    | otherwise    = y

&lt;/pre&gt;

	&lt;p&gt;Example of both pattern matching and comprehensions &amp;#8211; quick sort in Haskell is simple as that:&lt;/p&gt;


&lt;pre&gt;
qSort :: [Int] -&amp;gt; [Int] 
qSort [] = []
qSort (x:xs) = 
  qSort [ y | y &amp;lt;-xs, y&amp;lt;=x] ++ [x] ++ qSort [ y | y&amp;lt;-xs, y &amp;gt; x]
&lt;/pre&gt;

	&lt;p&gt;This code is very close to informal definition of quick sort:&lt;/p&gt;


	&lt;p&gt;“To sort the list take off the head ‘(x:xs)’ and then split the result in two parts: the first containing the elements no larger then ‘x’ and the second exceeding ‘x’. Sort these two parts and then concatenate ‘x’ with results of these two sorts”&lt;/p&gt;


	&lt;p&gt;Isn’ it clarity and readability?&lt;/p&gt;


	&lt;p&gt;Isn’t purely functional notation is better then a notaion produced by macros?&lt;/p&gt;


	&lt;p&gt;What Ruby gives as equivalent to Guards, Pattern matching and List comprehensions?&lt;/p&gt;


	&lt;p&gt;I am not even talking about extremely powerful strategy of lazy evaluation that allows Haskell only evaluate a function argument when it is really needed (on demand) to compute the overall result. This in turn makes computations less expensive and allows language to describe infinite data structures.&lt;/p&gt;


	&lt;p&gt;As almost everything else, lazy evaluation can be implemented in Lisp and Scheme. Any ideas how to do this in Ruby?&lt;/p&gt;


	&lt;p&gt;After Haskell, Ruby syntax looks too eclectic for me (&lt;code&gt;foo, &lt;/code&gt;@bar, baz  :faz =&amp;gt; xxx), ‘blocks’ and ‘yields’ makes me feel sorry for functions as first class objects, “meta programming” seems for me to be a perfect tool to hide and obscure what is really going on behind the code I see right now (because methods can be added to classes in other source files),  etc…&lt;/p&gt;


	&lt;p&gt;Maybe I am totally wrong about Ruby and will drastically change my opinion after more experience with it, we’ll see.&lt;/p&gt;


	&lt;p&gt;As for this discussion it would be interesting to know what you guys think about:&lt;/p&gt;


	&lt;p&gt;1) The question I started this message with&lt;/p&gt;


	&lt;p&gt;2) Why Haskell (and FP in general) is not as widespread as Java, Python &amp;#38; Ruby? And all these sad things are happening in spite of:&lt;/p&gt;


	&lt;p&gt;a. Though not so big but very strong and dedicated community of Haskell developers.&lt;/p&gt;


	&lt;p&gt;b. Constantly growing set of open source Haskell applications, tools and libraries.&lt;/p&gt;</description>
      <pubDate>Tue, 03 Oct 2006 19:22:46 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:81b132c3-9184-480d-8479-e34104858832</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-208</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by taw</title>
      <description>&lt;p&gt;You might be interested in &lt;a href="http://t-a-w.blogspot.com/2006/07/rlisp-lisp-naturally-embedded-in-ruby.html" rel="nofollow"&gt;RLisp&lt;/a&gt;, which is Lisp directly connected to Ruby runtime and very tightly integrated with Ruby.&lt;/p&gt;


	&lt;p&gt;It is very alpha, but can do really cool stuff like &lt;a href="http://t-a-w.blogspot.com/2006/07/rlisp-gets-http-support.html" rel="nofollow"&gt;&lt;span class="caps"&gt;HTTP&lt;/span&gt; server&lt;/a&gt; that uses webrick (from standard Ruby library) and macros.&lt;/p&gt;


	&lt;p&gt;I think even at this early stage it is probably one of the most practical Lisps for scripting-style of programs, due to access to all Ruby libraries.&lt;/p&gt;


	&lt;p&gt;The biggest problem right now seems to be culture shock, as RLisp has Ruby/Python-style let (this is the most controversial part, I don&amp;#8217;t have any idea why), a &amp;#8220;real&amp;#8221; object system (based on message passing and everything-is-a-Ruby-object), and lists are arrays (so cdr/cons copy).&lt;/p&gt;


	&lt;p&gt;Enjoy :-)&lt;/p&gt;</description>
      <pubDate>Sun, 01 Oct 2006 15:23:17 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:d429275d-9991-4419-a503-25142944e94c</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-207</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by KristofU</title>
      <description>&lt;p&gt;I&amp;#8217;m a C++ programmer, and was looking for a new language to learn and do stuff more elegantly.
Ruby just sucked me right in. There is almost nothing to learn, it&amp;#8217;s just there.
You can slice and dice and juggle and the result is always a working program.
You like for-statements? Well, you can use for-statements. You like iterators? Well, you can use iterators. Make object functors or lambda&amp;#8217;s, whichever you prefer. Ruby doesn&amp;#8217;t force anything upon you, there is time to learn to appreciate the finer features, while still churning out working apps in the meantime.
I&amp;#8217;ve also briefly tried Haskell, Scheme and Erlang, but I have to say, I couldn&amp;#8217;t get anything done. Compared to Ruby, quite an anti-climax.&lt;/p&gt;</description>
      <pubDate>Tue, 26 Sep 2006 04:55:22 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:f63b7d7b-7b9a-4dbc-bde2-9271b47022b0</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-205</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by Pebblestone</title>
      <description>&lt;p&gt;Miquel:&lt;/p&gt;


	&lt;p&gt;Try &lt;span class="caps"&gt;CLSQL&lt;/span&gt;, it supports multiple DBs and on multiple lisp implementations. And I just used it in my last project.&lt;/p&gt;</description>
      <pubDate>Fri, 08 Sep 2006 07:13:50 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:0dbddf0f-a578-49c5-b717-3d350a7274de</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-202</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by Miquel</title>
      <description>&lt;p&gt;I have to say that I work with lisp everyday and it is very powerful. I just haven&amp;#8217;t got the motivation to make a decent interface to mysql for my web applications. That is why I chose Rails.&lt;/p&gt;


	&lt;p&gt;Oh Well..&lt;/p&gt;


	&lt;p&gt;However, when the db support arrives, I am going back.&lt;/p&gt;</description>
      <pubDate>Thu, 07 Sep 2006 23:42:52 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:759090fb-d6c9-4c75-8e2f-575704db038d</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-201</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by William James</title>
      <description>This version will work properly even if the list doesn&amp;#8217;t contain 49; also, the variable y has been eliminated.
&lt;pre&gt;
def maxi a,b; (yield a) &amp;gt; (yield b) ? a : b; end
[1,2,3,-4,-10,-43,49,49,8934].inject([[],0]){|a,n|
  break a  if n==49
  a[1] = maxi(a[1],n){|x| x.abs}
  a[0] &amp;lt;&amp;lt; n ; a }
&lt;/pre&gt;</description>
      <pubDate>Sat, 26 Aug 2006 01:09:45 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:a35b261f-4f4d-40f5-8b13-5326326224a4</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-200</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by William James</title>
      <description>&lt;p&gt;Here are some Ruby equivalents of some Lisp examples:&lt;/p&gt;


&lt;pre&gt;
(iter (for x in '(-1 2 -10 4))
      (finding x maximizing (abs x)))
&lt;/pre&gt;

&lt;pre&gt;
[-1, 2, -10, 4].inject{|a,b| a.abs &amp;gt; b.abs ? a : b}
# or
[-1, 2, -10, 4].sort_by{|n| n.abs}.last
&lt;/pre&gt;

&lt;pre&gt;
(iter (for x in '(1 2 3 -4 -10 -43 49 49 8934))
         (until (= (sqrt 7) x))
         (collect x into collection)
         (finding x maximizing (abs x) into y)
         (finally (return (list collection y))))
&lt;/pre&gt;
(By the way, I don&amp;#8217;t think this Lisp will work as advertised. (= (sqrt 7) x) seems wrong.)

&lt;pre&gt;
def maxim a,b; (yield a) &amp;gt; (yield b) ? a : b; end
y = 0
[1,2,3,-4,-10,-43,49,49,8934].inject([]){|a,n|
  break [a,y]  if n==49
  y = maxim(y,n){|x| x.abs}
  a &amp;lt;&amp;lt; n }
&lt;/pre&gt;</description>
      <pubDate>Fri, 25 Aug 2006 05:19:17 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:54f8820c-8c7b-4c6a-8645-e2b330347437</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-199</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by Eric</title>
      <description>&lt;p&gt;I suppose it depends on your geographic location: I&amp;#8217;ve spent at least 6 of the last 10 years working with Lisp and Scheme on both academic and commercial projects. But then again, I like to work on cool, offbeat stuff, and I live in the greater Boston area&amp;#8212;two factors which, together, correlate highly with Lisp.&lt;/p&gt;


	&lt;p&gt;If you&amp;#8217;ve been working in AI, and you&amp;#8217;ve never seen Lisp, the odds are extremely good that your work started after the late 80s. That&amp;#8217;s when a combination of Moore&amp;#8217;s Law and gross business incompetence killed off half the Lisp companies.&lt;/p&gt;


	&lt;p&gt;Nonetheless, you should probably learn Lisp if you want to take full advantage of Ruby: The book &lt;em&gt;Practical Common Lisp&lt;/em&gt; contains 10 times as much meta-programming advice as all the Ruby documentation I&amp;#8217;ve seen, combined.&lt;/p&gt;</description>
      <pubDate>Mon, 26 Jun 2006 08:13:48 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:00bb8026-7af3-48f7-bbbf-2f1c6d4acbf8</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-193</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by someone</title>
      <description>&lt;p&gt;Do Lisp coders write programs or do they just sit around talking about their language?&lt;/p&gt;


	&lt;p&gt;It seems to be in use deep within the halls of CS departments and AI research, but in years and years of working with software, managing systems, writing for more OSes and problem domains than I can keep track of, I haven&amp;#8217;t encountered a scrap of Lisp code or even a similar project to my own in which someone was using Lisp.  I don&amp;#8217;t mean to flame, but I&amp;#8217;ve seen roughly a thousand times more talking about Lisp than the using of it.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve always meant to learn Lisp, but I get the sense that I&amp;#8217;ll be applying the knowledge more on usenet than on actual programs.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve recently discovered Ruby, and of all its amazing strengths ( I&amp;#8217;ll put at the top of the list &lt;del&gt;- at least as far as something that you&amp;#8217;ll probably see on any open vim session on my workstation these days -&lt;/del&gt; is the enumerable module ) nothing quite matches the friendliness and helpfulness of its community.  Ruby seems to be the first language to really get that languages are software and programmers are users.&lt;/p&gt;


	&lt;p&gt;Programming communities need collective nouns.  An obfuscation of Perl hackers.  A stalwart of C coders.  A furrow of assembly wranglers.  An effusing of Ruby hackers.  An ulcer of &lt;span class="caps"&gt;CSS&lt;/span&gt; authors.  A grumbling of Lisp coders.&lt;/p&gt;</description>
      <pubDate>Sat, 24 Jun 2006 09:10:51 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:7aa80f7e-35b8-4551-b070-c0d227852564</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-192</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by Notav A.</title>
      <description>&lt;p&gt;(apply (lambda (a b) (+ a b)) &amp;#8216;(1 2))&lt;/p&gt;


	&lt;p&gt;can be done with:&lt;/p&gt;


	&lt;p&gt;lambda{|a,b| a+b}.call(*[1,2])&lt;/p&gt;</description>
      <pubDate>Tue, 13 Jun 2006 10:25:44 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:57b8e06d-8e39-4c4a-b3f5-fa5f13ed3b4c</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-190</link>
    </item>
    <item>
      <title>"Why Ruby is an acceptable LISP" by Eric</title>
      <description>&lt;p&gt;Try this:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;obj&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;meth&lt;/span&gt; &lt;span class="ident"&gt;arg1&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt; &lt;span class="ident"&gt;arg2&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt; &lt;span class="punct"&gt;*&lt;/span&gt;&lt;span class="ident"&gt;more_args&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;It&amp;#8217;s roughly equivalent to Scheme&amp;#8217;s &amp;#8220;apply.&amp;#8221;&lt;/p&gt;</description>
      <pubDate>Sun, 21 May 2006 16:21:23 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:5b2a654f-a141-46f4-a2a4-4197003b144c</guid>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp#comment-188</link>
    </item>
    <item>
      <title>Why Ruby is an acceptable LISP</title>
      <description>&lt;p&gt;Years ago, I looked at Ruby and decided to ignore it. Ruby wasn&amp;#8217;t as
popular as Python, and it wasn&amp;#8217;t as powerful as LISP. So why should I
bother?&lt;/p&gt;

&lt;p&gt;Of course, we could turn those criteria around.  What if Ruby were more
popular than &lt;em&gt;LISP&lt;/em&gt;, and more powerful than &lt;em&gt;Python&lt;/em&gt;?  Would that be enough
to make Ruby interesting?&lt;/p&gt;

&lt;p&gt;Before answering this question, we should decide what makes LISP so
powerful.  Paul Graham has &lt;a href="http://www.paulgraham.com/icad.html" title="Revenge of the Nerds"&gt;written eloquently&lt;/a&gt; about LISP&amp;#8217;s virtues.  But, for the sake of argument, I&amp;#8217;d like to boil them down to two things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;LISP is a dense functional language.  &lt;/li&gt;
&lt;li&gt;LISP has programmatic macros.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;As it turns out, Ruby compares well as a functional language, and it fakes
macros better than I&amp;#8217;d thought.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp"&gt;Read More&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Sat, 03 Dec 2005 11:30:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:080ade06-c978-4e36-8847-44c22d1bc9b9</guid>
      <author>Eric Kidd</author>
      <link>http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp</link>
      <category>Ruby</category>
      <category>LISP</category>
      <category>Macros</category>
      <category>Recommended</category>
      <trackback:ping>http://www.randomhacks.net/articles/trackback/77</trackback:ping>
    </item>
  </channel>
</rss>
