<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Word Cube</title>
	<atom:link href="http://programmingpraxis.com/2010/07/13/word-cube/feed/" rel="self" type="application/rss+xml" />
	<link>http://programmingpraxis.com/2010/07/13/word-cube/</link>
	<description>A collection of etudes, updated weekly, for the education and enjoyment of the savvy programmer</description>
	<lastBuildDate>Mon, 28 May 2012 03:30:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Jebb</title>
		<link>http://programmingpraxis.com/2010/07/13/word-cube/#comment-1536</link>
		<dc:creator><![CDATA[Jebb]]></dc:creator>
		<pubDate>Sat, 31 Jul 2010 21:13:09 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=2642#comment-1536</guid>
		<description><![CDATA[@ Gary: OK, looks like I&#039;d completely misunderstood the assignment. I&#039;m beginning to suspect regexes are not the right tool here...]]></description>
		<content:encoded><![CDATA[<p>@ Gary: OK, looks like I&#8217;d completely misunderstood the assignment. I&#8217;m beginning to suspect regexes are not the right tool here&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elvis Montero &#187; Blog Archive &#187; Fun with Word Cubes</title>
		<link>http://programmingpraxis.com/2010/07/13/word-cube/#comment-1494</link>
		<dc:creator><![CDATA[Elvis Montero &#187; Blog Archive &#187; Fun with Word Cubes]]></dc:creator>
		<pubDate>Mon, 26 Jul 2010 13:42:43 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=2642#comment-1494</guid>
		<description><![CDATA[[...] that finds all matching words for a given word cube. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments [...]]]></description>
		<content:encoded><![CDATA[<p>[...] that finds all matching words for a given word cube. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gary Johnson</title>
		<link>http://programmingpraxis.com/2010/07/13/word-cube/#comment-1483</link>
		<dc:creator><![CDATA[Gary Johnson]]></dc:creator>
		<pubDate>Sun, 25 Jul 2010 22:58:37 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=2642#comment-1483</guid>
		<description><![CDATA[@Jebb

The character set match ^[ncbcioune]+$ just validates that your dictionary word only consists of characters from the cube.  However, like some of the other answers here, it doesn&#039;t account for the distribution of these characters in the cube and the dictionary word.  Therefore, your algorithm gives incorrect answers like &quot;bobbin&quot;, &quot;innocence&quot;, &quot;niece&quot;, and &quot;onion&quot;.]]></description>
		<content:encoded><![CDATA[<p>@Jebb</p>
<p>The character set match ^[ncbcioune]+$ just validates that your dictionary word only consists of characters from the cube.  However, like some of the other answers here, it doesn&#8217;t account for the distribution of these characters in the cube and the dictionary word.  Therefore, your algorithm gives incorrect answers like &#8220;bobbin&#8221;, &#8220;innocence&#8221;, &#8220;niece&#8221;, and &#8220;onion&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jebb</title>
		<link>http://programmingpraxis.com/2010/07/13/word-cube/#comment-1477</link>
		<dc:creator><![CDATA[Jebb]]></dc:creator>
		<pubDate>Sun, 25 Jul 2010 13:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=2642#comment-1477</guid>
		<description><![CDATA[I&#039;d appreciate any well-versed criticism of the regex I used:
[sourcecode lang=&quot;python&quot;]
def cubewords(word_cube):
    import re
    center = word_cube[4]
    f = open(&#039;/usr/share/dict/words&#039;, &#039;r&#039;)
    str = f.read()
    f.close()
    pattern1 = &quot;(?mi)(?=^\w{4,}$)(?=^[&quot; + word_cube + &quot;]+$)^\w*&quot; + center + &quot;\w*$&quot;
    return re.findall(pattern1, str)
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>I&#8217;d appreciate any well-versed criticism of the regex I used:</p>
<pre class="brush: python;">
def cubewords(word_cube):
    import re
    center = word_cube[4]
    f = open('/usr/share/dict/words', 'r')
    str = f.read()
    f.close()
    pattern1 = &quot;(?mi)(?=^\w{4,}$)(?=^[&quot; + word_cube + &quot;]+$)^\w*&quot; + center + &quot;\w*$&quot;
    return re.findall(pattern1, str)
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Programming Praxis &#8211; Word Cube &#187; Perused</title>
		<link>http://programmingpraxis.com/2010/07/13/word-cube/#comment-1432</link>
		<dc:creator><![CDATA[Programming Praxis &#8211; Word Cube &#187; Perused]]></dc:creator>
		<pubDate>Tue, 20 Jul 2010 18:41:54 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=2642#comment-1432</guid>
		<description><![CDATA[[...] is my first solution for a Programming Praxis assignment, the Word Cube [...]]]></description>
		<content:encoded><![CDATA[<p>[...] is my first solution for a Programming Praxis assignment, the Word Cube [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mac</title>
		<link>http://programmingpraxis.com/2010/07/13/word-cube/#comment-1430</link>
		<dc:creator><![CDATA[Mac]]></dc:creator>
		<pubDate>Tue, 20 Jul 2010 12:04:09 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=2642#comment-1430</guid>
		<description><![CDATA[Here&#039;s a version in LUA: 

http://pastebin.com/vBeDvup9

@matias: The python version misses the words with upper case characters.]]></description>
		<content:encoded><![CDATA[<p>Here&#8217;s a version in LUA: </p>
<p><a href="http://pastebin.com/vBeDvup9" rel="nofollow">http://pastebin.com/vBeDvup9</a></p>
<p>@matias: The python version misses the words with upper case characters.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gary Johnson</title>
		<link>http://programmingpraxis.com/2010/07/13/word-cube/#comment-1426</link>
		<dc:creator><![CDATA[Gary Johnson]]></dc:creator>
		<pubDate>Mon, 19 Jul 2010 20:09:45 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=2642#comment-1426</guid>
		<description><![CDATA[&lt;pre&gt;
;; My clojure solution.
;; The previous one forgets to compare the distribution
;; of characters between the words from the word list
;; and the characters from the word cube.

(ns wordcube
  (:use [clojure.contrib.duck-streams :only (read-lines)]))

(defn count-chars [chars] (apply merge-with + (for [char chars] {char 1})))

(defn solve [chars words-file]
  (let [middle-char #{(get chars 4)}
        char-counts (count-chars chars)]
    (filter #(and (&gt; (count %) 3)
                  (some middle-char %)
                  (every? (fn [[char reps]] (&lt;= reps (char-counts char 0))) (count-chars %)))
            (read-lines words-file))))

;; Usage
(solve &quot;ncbcioune&quot; &quot;words.txt&quot;)
&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<pre>
;; My clojure solution.
;; The previous one forgets to compare the distribution
;; of characters between the words from the word list
;; and the characters from the word cube.

(ns wordcube
  (:use [clojure.contrib.duck-streams :only (read-lines)]))

(defn count-chars [chars] (apply merge-with + (for [char chars] {char 1})))

(defn solve [chars words-file]
  (let [middle-char #{(get chars 4)}
        char-counts (count-chars chars)]
    (filter #(and (&gt; (count %) 3)
                  (some middle-char %)
                  (every? (fn [[char reps]] (&lt;= reps (char-counts char 0))) (count-chars %)))
            (read-lines words-file))))

;; Usage
(solve &quot;ncbcioune&quot; &quot;words.txt&quot;)
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: matías</title>
		<link>http://programmingpraxis.com/2010/07/13/word-cube/#comment-1425</link>
		<dc:creator><![CDATA[matías]]></dc:creator>
		<pubDate>Mon, 19 Jul 2010 19:43:23 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=2642#comment-1425</guid>
		<description><![CDATA[A bit of python:

def words_in_cube(cube):
    return filter(lambda word: 3 &lt; len(word) &lt; 10 and \
                           cube[4] in word and
                           all(word.count(x) &lt;= cube.count(x) for x in word),
                  (word.strip() for word in open(&#039;/usr/share/dict/words&#039;).xreadlines()))]]></description>
		<content:encoded><![CDATA[<p>A bit of python:</p>
<p>def words_in_cube(cube):<br />
    return filter(lambda word: 3 &lt; len(word) &lt; 10 and \<br />
                           cube[4] in word and<br />
                           all(word.count(x) &lt;= cube.count(x) for x in word),<br />
                  (word.strip() for word in open(&#039;/usr/share/dict/words&#039;).xreadlines()))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: karijes</title>
		<link>http://programmingpraxis.com/2010/07/13/word-cube/#comment-1424</link>
		<dc:creator><![CDATA[karijes]]></dc:creator>
		<pubDate>Mon, 19 Jul 2010 16:17:46 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=2642#comment-1424</guid>
		<description><![CDATA[Here is my attempt in clojure:

 http://pastebin.com/gVf0DZV9]]></description>
		<content:encoded><![CDATA[<p>Here is my attempt in clojure:</p>
<p> <a href="http://pastebin.com/gVf0DZV9" rel="nofollow">http://pastebin.com/gVf0DZV9</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Remco Niemeijer</title>
		<link>http://programmingpraxis.com/2010/07/13/word-cube/#comment-1417</link>
		<dc:creator><![CDATA[Remco Niemeijer]]></dc:creator>
		<pubDate>Tue, 13 Jul 2010 09:50:45 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=2642#comment-1417</guid>
		<description><![CDATA[My Haskell solution (see http://bonsaicode.wordpress.com/2010/07/13/programming-praxis-word-cube/ for a version with comments):

[sourcecode lang=&quot;css&quot;]
import Data.Char
import Data.List

solve :: String -&gt; [String] -&gt; [String]
solve c = filter (\w -&gt; length w &gt; 3 &amp;&amp; elem (c !! 4) w &amp;&amp; null (w \\ c))

wordcube :: String -&gt; IO ()
wordcube cube = mapM_ putStrLn . solve cube .
                lines . map toLower =&lt;&lt; readFile &quot;words.txt&quot;
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>My Haskell solution (see <a href="http://bonsaicode.wordpress.com/2010/07/13/programming-praxis-word-cube/" rel="nofollow">http://bonsaicode.wordpress.com/2010/07/13/programming-praxis-word-cube/</a> for a version with comments):</p>
<pre class="brush: css;">
import Data.Char
import Data.List

solve :: String -&gt; [String] -&gt; [String]
solve c = filter (\w -&gt; length w &gt; 3 &amp;&amp; elem (c !! 4) w &amp;&amp; null (w \\ c))

wordcube :: String -&gt; IO ()
wordcube cube = mapM_ putStrLn . solve cube .
                lines . map toLower =&lt;&lt; readFile &quot;words.txt&quot;
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>

