<?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"
	>
<channel>
	<title>Comments on: Logo, Ruby &#038; JavaScript</title>
	<atom:link href="http://lojic.com/blog/2007/08/31/logo-ruby-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://lojic.com/blog/2007/08/31/logo-ruby-javascript/</link>
	<description></description>
	<pubDate>Tue, 06 Jan 2009 01:48:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
		<item>
		<title>By: XXX</title>
		<link>http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-78</link>
		<dc:creator>XXX</dc:creator>
		<pubDate>Tue, 11 Nov 2008 02:04:32 +0000</pubDate>
		<guid isPermaLink="false">http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-78</guid>
		<description>&lt;pre&gt;
APL:

?,??.{?,' ',?}/('small' 'medium' 'large')('vanilla' 'ultra chocolate' 'lychee' 'rum raisin' 'ginger')('cone' 'cup')

J (2 solutions):

&#62;,{ ('small';'medium';'large');('vanilla';'ultra chocolate';'lychee';'rum raisin';'ginger'); , { options
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<pre>
APL:

?,??.{?,' ',?}/('small' 'medium' 'large')('vanilla' 'ultra chocolate' 'lychee' 'rum raisin' 'ginger')('cone' 'cup')

J (2 solutions):

&gt;,{ ('small';'medium';'large');('vanilla';'ultra chocolate';'lychee';'rum raisin';'ginger'); , { options
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ric</title>
		<link>http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-79</link>
		<dc:creator>Ric</dc:creator>
		<pubDate>Tue, 11 Nov 2008 01:13:01 +0000</pubDate>
		<guid isPermaLink="false">http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-79</guid>
		<description>There are some APL, J &#38; K versions of this program in &lt;a href="http://groups.google.com/group/comp.lang.apl/browse_thread/thread/c323c1da136d5c03/d148e7a626d27a5f#d148e7a626d27a5f" title="" rel="nofollow"&gt;this comp.lang.apl thread&lt;/a&gt;. Here is a version in J:

&lt;pre&gt;
   Options=: ;: each ('small large medium');('ginger lychee rum_raisin ultra_choc vanilla');('cone cup')
   choices=: monad : ';:^:_1 &#62;,{ y'
   choices Options
small vanilla cone
small vanilla cup
small ultra_choc cone
...
large rum_raisin cup
large ginger cone
large ginger cup
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>There are some APL, J &amp; K versions of this program in <a href="http://groups.google.com/group/comp.lang.apl/browse_thread/thread/c323c1da136d5c03/d148e7a626d27a5f#d148e7a626d27a5f" title="" rel="nofollow">this comp.lang.apl thread</a>. Here is a version in J:</p>
<pre>
   Options=: ;: each ('small large medium');('ginger lychee rum_raisin ultra_choc vanilla');('cone cup')
   choices=: monad : ';:^:_1 &gt;,{ y'
   choices Options
small vanilla cone
small vanilla cup
small ultra_choc cone
...
large rum_raisin cup
large ginger cone
large ginger cup
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil</title>
		<link>http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-74</link>
		<dc:creator>Neil</dc:creator>
		<pubDate>Sat, 02 Feb 2008 18:22:15 +0000</pubDate>
		<guid isPermaLink="false">http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-74</guid>
		<description>One more:

&lt;pre&gt;
&lt;code&gt;
choices xss = mapM_ (putStrLn . unwords) (sequence xss)

main = choices [["small", "medium", "large"],
 ["vanilla", "ultra chocolate", "lychee", "rum raisin", "ginger"],
 ["cone", "cup"]]
&lt;/code&gt;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>One more:</p>
<pre>
<code>
choices xss = mapM_ (putStrLn . unwords) (sequence xss)

main = choices [["small", "medium", "large"],
 ["vanilla", "ultra chocolate", "lychee", "rum raisin", "ginger"],
 ["cone", "cup"]]
</code>
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil</title>
		<link>http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-75</link>
		<dc:creator>Neil</dc:creator>
		<pubDate>Sat, 02 Feb 2008 17:29:34 +0000</pubDate>
		<guid isPermaLink="false">http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-75</guid>
		<description>Having just usefully taught myself how to use ampersands etc. in order to prevent "&#60;-" being parsed as a comment, I can finally unveil my Haskell version.

Thanks for your patience. (And fingers crossed for third attempt...)

Ben's Haskell version is shorter, of course, but I think mine might be more 'idiomatic' in that it abides by old Haskell maxim: 'use monads whenever you see the slightest opportunity to show off the fact that you know how they work'.

&lt;code&gt;
&lt;pre&gt;
choices :: [[String]] -&#62; IO ()
choices xss = mapM_ (putStrLn . unwords) (f xss)
    where f [] = return []
          f (zs:zss) = do x &#60;- zs
                          xs &#60;- f zss
                          return $ x:xs

main = choices [["small", "medium", "large"], ["vanilla", "ultra chocolate", "lychee", "rum raisin", "ginger"], ["cone", "cup"]]
&lt;/pre&gt;
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Having just usefully taught myself how to use ampersands etc. in order to prevent &#8220;&lt;-&#8221; being parsed as a comment, I can finally unveil my Haskell version.</p>
<p>Thanks for your patience. (And fingers crossed for third attempt&#8230;)</p>
<p>Ben&#8217;s Haskell version is shorter, of course, but I think mine might be more &#8216;idiomatic&#8217; in that it abides by old Haskell maxim: &#8216;use monads whenever you see the slightest opportunity to show off the fact that you know how they work&#8217;.</p>
<p><code></p>
<pre>
choices :: [[String]] -&gt; IO ()
choices xss = mapM_ (putStrLn . unwords) (f xss)
    where f [] = return []
          f (zs:zss) = do x &lt;- zs
                          xs &lt;- f zss
                          return $ x:xs

main = choices [["small", "medium", "large"], ["vanilla", "ultra chocolate", "lychee", "rum raisin", "ginger"], ["cone", "cup"]]
</pre>
<p></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil</title>
		<link>http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-76</link>
		<dc:creator>Neil</dc:creator>
		<pubDate>Sat, 02 Feb 2008 17:04:42 +0000</pubDate>
		<guid isPermaLink="false">http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-76</guid>
		<description>I hardly ever use HTML, so unsurprisingly I screwed up my first attempt to post a comment.  Sorry (again)!

&lt;code&gt;
&lt;pre&gt;
choices :: [[String]] -&#62; IO ()
choices xss = mapM_ (putStrLn . unwords) (f xss)
    where f [] = return []
          f (zs:zss) = do x
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>I hardly ever use HTML, so unsurprisingly I screwed up my first attempt to post a comment.  Sorry (again)!</p>
<p><code></p>
<pre>
choices :: [[String]] -&gt; IO ()
choices xss = mapM_ (putStrLn . unwords) (f xss)
    where f [] = return []
          f (zs:zss) = do x
</pre>
<p></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil</title>
		<link>http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-77</link>
		<dc:creator>Neil</dc:creator>
		<pubDate>Sat, 02 Feb 2008 17:01:28 +0000</pubDate>
		<guid isPermaLink="false">http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-77</guid>
		<description>Sorry - couldn't help writing another Haskell version:

&lt;code&gt;
choices :: [[String]] -&#62; IO ()
choices xss = mapM_ (putStrLn . unwords) (f xss)
    where f [] = return []
          f (zs:zss) = do x</description>
		<content:encoded><![CDATA[<p>Sorry - couldn&#8217;t help writing another Haskell version:</p>
<p><code><br />
choices :: [[String]] -&gt; IO ()<br />
choices xss = mapM_ (putStrLn . unwords) (f xss)<br />
    where f [] = return []<br />
          f (zs:zss) = do x</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Adkins</title>
		<link>http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-73</link>
		<dc:creator>Brian Adkins</dc:creator>
		<pubDate>Thu, 31 Jan 2008 22:41:32 +0000</pubDate>
		<guid isPermaLink="false">http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-73</guid>
		<description>After helpful feedback on the Arc forum and discovering join:

&lt;pre&gt;
(def choices (menu (o result '()))
  (if menu
    (each x (car menu)
      (choices (cdr menu) (join result (list x))))
    (prall result "\n" " ")))

(choices '(
  ("small" "medium" "large")
  ("vanilla" "ultra chocolate" "lychee" "rum raisin" "ginger")
  ("cone" "cup")))
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>After helpful feedback on the Arc forum and discovering join:</p>
<pre>
(def choices (menu (o result '()))
  (if menu
    (each x (car menu)
      (choices (cdr menu) (join result (list x))))
    (prall result "\n" " ")))

(choices '(
  ("small" "medium" "large")
  ("vanilla" "ultra chocolate" "lychee" "rum raisin" "ginger")
  ("cone" "cup")))
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Adkins</title>
		<link>http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-72</link>
		<dc:creator>Brian Adkins</dc:creator>
		<pubDate>Thu, 31 Jan 2008 16:28:57 +0000</pubDate>
		<guid isPermaLink="false">http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-72</guid>
		<description>I thought I'd put a first draft up of a version in Arc :)

&lt;pre&gt;
(def joinstr (lst (o sep " "))
  (if lst
    (string (car lst) (apply string (map [string sep _] (cdr lst))))
    ""))

(def choices (menu (o result '()))
  (if menu
    (each x (car menu)
      (choices (cdr menu) (cons x result)))
    (prn (joinstr:rev result))))

(choices (list
  (list "small" "medium" "large")
  (list "vanilla" "ultra chocolate" "lychee" "rum raisin" "ginger")
  (list "cone" "cup")))
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I thought I&#8217;d put a first draft up of a version in Arc <img src='http://lojic.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre>
(def joinstr (lst (o sep " "))
  (if lst
    (string (car lst) (apply string (map [string sep _] (cdr lst))))
    ""))

(def choices (menu (o result '()))
  (if menu
    (each x (car menu)
      (choices (cdr menu) (cons x result)))
    (prn (joinstr:rev result))))

(choices (list
  (list "small" "medium" "large")
  (list "vanilla" "ultra chocolate" "lychee" "rum raisin" "ginger")
  (list "cone" "cup")))
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: lojic.com &#187; Blog Archive &#187; Learning Logo - Part One</title>
		<link>http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-71</link>
		<dc:creator>lojic.com &#187; Blog Archive &#187; Learning Logo - Part One</dc:creator>
		<pubDate>Sat, 05 Jan 2008 21:37:06 +0000</pubDate>
		<guid isPermaLink="false">http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-71</guid>
		<description>[...] August, I wrote a blog post comparing a short function (from Brian Harvey&#8217;s home page) in Logo and several other [...]</description>
		<content:encoded><![CDATA[<p>[...] August, I wrote a blog post comparing a short function (from Brian Harvey&#8217;s home page) in Logo and several other [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PL</title>
		<link>http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-70</link>
		<dc:creator>PL</dc:creator>
		<pubDate>Sun, 30 Sep 2007 15:18:33 +0000</pubDate>
		<guid isPermaLink="false">http://lojic.com/blog/2007/08/31/logo-ruby-javascript/#comment-70</guid>
		<description>Clean:

items =: [["small","medium","large"],["vanilla","chocolate"],["cup","cone"]]
menu i
	&#124; i == []	= ""
				= hd i +++ "\n" +++ menu (tl i)
Start = menu [x+++" "+++y+++" "+++z \\ x</description>
		<content:encoded><![CDATA[<p>Clean:</p>
<p>items =: [["small","medium","large"],["vanilla","chocolate"],["cup","cone"]]<br />
menu i<br />
	| i == []	= &#8220;&#8221;<br />
				= hd i +++ &#8220;\n&#8221; +++ menu (tl i)<br />
Start = menu [x+++&#8221; &#8220;+++y+++&#8221; &#8220;+++z \\ x</p>
]]></content:encoded>
	</item>
</channel>
</rss>
