<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Disqus - Latest Comments for Aldric</title><link>http://disqus.com/by/Aldric/</link><description></description><atom:link href="http://disqus.com/Aldric/comments.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 30 Oct 2008 16:30:11 -0000</lastBuildDate><item><title>Re: Simple Permutations in Python and Ruby</title><link>http://blog.adambachman.org/2008/10/simple-permutations-in-python-and-ruby.html#comment-3397325</link><description>&lt;p&gt;*chuckle* I tried to look at simple output from the function (I'll be honest, I was doing Project Euler, too) to figure out how it worked and I realized, from the output, it was nesting lists. I also figured you could do the .flatten but I think that adds quite a bit of time to the computation. Your original bugged version found the answer to the Euler problem in 24.8 seconds or so, and I didn't bother waiting past a minute for the .flatten.&lt;/p&gt;&lt;p&gt;On the other hand, using &lt;br&gt;[element].concat (val)&lt;/p&gt;&lt;p&gt;got me a result in ~25 seconds (only two runs, so not conclusive). Since this is Ruby, this should work on most anything that's enumerable.. Even sets (just tested it), however worthless that may be on a set.&lt;/p&gt;&lt;p&gt;This, I must admit, is by far the most elegant permutation implementation I've found on the web. Do you mind if I keep it, add your name/handle/URL to the source and reuse / distribute as I see fit (Not that I expect to find too many people who need to permute in Ruby/Python, but who knows) ?&lt;/p&gt;&lt;p&gt;And, to answer, yes, this was very helpful. It's really the "plain" permutation system, but quite ruby-ified with a flavor of LISP ;-)&lt;/p&gt;&lt;p&gt;Thanks for your explanation!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Aldric</dc:creator><pubDate>Thu, 30 Oct 2008 16:30:11 -0000</pubDate></item><item><title>Re: Simple Permutations in Python and Ruby</title><link>http://blog.adambachman.org/2008/10/simple-permutations-in-python-and-ruby.html#comment-3392638</link><description>&lt;p&gt;Okay - funny, I've been looking for a good way to do permutations (had no clue how to even begin) and found your code (I'm teaching myself Ruby). It taught me quite a bit about co-routines and what on earth yield could be used for.. But I'm a little curious about this bit :&lt;br&gt;      permutations(&lt;a href="http://li.select" rel="nofollow noopener" target="_blank" title="li.select"&gt;li.select&lt;/a&gt;() {|n| n != element}) \&lt;br&gt;       {|val| yield([element] &amp;lt;&amp;lt; val)}&lt;/p&gt;&lt;p&gt;Now, what this is saying is ...&lt;br&gt;run the permutation function on every element in the list except the current one, and run that against ... What, exactly? What is  "yield(|element &amp;lt;&amp;lt; val)" ? I can't find a good way to put this in english..&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Aldric</dc:creator><pubDate>Thu, 30 Oct 2008 12:30:01 -0000</pubDate></item></channel></rss>