<?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/"
		>
<channel>
	<title>Comments on: Equivalent of and-let*?</title>
	<atom:link href="http://www.ventonegro.org/2008/12/equivalent-of-and-let/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ventonegro.org/2008/12/equivalent-of-and-let/</link>
	<description>Geek random ramblings</description>
	<lastBuildDate>Wed, 10 Mar 2010 04:59:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: ByersAurelia31</title>
		<link>http://www.ventonegro.org/2008/12/equivalent-of-and-let/comment-page-1/#comment-11484</link>
		<dc:creator>ByersAurelia31</dc:creator>
		<pubDate>Wed, 10 Mar 2010 04:59:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.ventonegro.org/?p=64#comment-11484</guid>
		<description>One acknowledges that our life is very expensive, but some people need money for different issues and not every person gets enough cash. So to receive quick &lt;a href=&quot;http://lowest-rate-loans.com/topics/home-loans&quot; rel=&quot;nofollow&quot;&gt;home loans&lt;/a&gt; or consolidation loans should be a right way out.</description>
		<content:encoded><![CDATA[<p>One acknowledges that our life is very expensive, but some people need money for different issues and not every person gets enough cash. So to receive quick <a href="http://lowest-rate-loans.com/topics/home-loans" rel="nofollow">home loans</a> or consolidation loans should be a right way out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexey Romanov</title>
		<link>http://www.ventonegro.org/2008/12/equivalent-of-and-let/comment-page-1/#comment-389</link>
		<dc:creator>Alexey Romanov</dc:creator>
		<pubDate>Thu, 04 Dec 2008 17:55:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.ventonegro.org/?p=64#comment-389</guid>
		<description>Indent all lines the same amount, except the first one.</description>
		<content:encoded><![CDATA[<p>Indent all lines the same amount, except the first one.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexey Romanov</title>
		<link>http://www.ventonegro.org/2008/12/equivalent-of-and-let/comment-page-1/#comment-388</link>
		<dc:creator>Alexey Romanov</dc:creator>
		<pubDate>Thu, 04 Dec 2008 17:54:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.ventonegro.org/?p=64#comment-388</guid>
		<description>Hello, Maybe monad!
A Haskell version looks like this:

get-session request = do
  cookies &lt;- requestCookies request
  p &lt;- lookup &quot;session_id&quot; cookies
  sidStr &lt;- snd p
  sid &lt;- (readMaybe sidStr :: Maybe Integer) -- readMaybe is not in the standard library for some reason, but is easy to write
  guard (exact? sid) -- not really, no exact/inexact distiction
  sp &lt;- lookup sid sessions 
  return (snd sp)
</description>
		<content:encoded><![CDATA[<p>Hello, Maybe monad!<br />
A Haskell version looks like this:</p>
<p>get-session request = do<br />
  cookies &lt;- requestCookies request<br />
  p &lt;- lookup &#8220;session_id&#8221; cookies<br />
  sidStr &lt;- snd p<br />
  sid &lt;- (readMaybe sidStr :: Maybe Integer) &#8212; readMaybe is not in the standard library for some reason, but is easy to write<br />
  guard (exact? sid) &#8212; not really, no exact/inexact distiction<br />
  sp &lt;- lookup sid sessions<br />
  return (snd sp)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ventonegro</title>
		<link>http://www.ventonegro.org/2008/12/equivalent-of-and-let/comment-page-1/#comment-378</link>
		<dc:creator>ventonegro</dc:creator>
		<pubDate>Wed, 03 Dec 2008 11:11:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.ventonegro.org/?p=64#comment-378</guid>
		<description>@Bogdan:

It&#039;s nice to see Lua here! But you would have to intersperse the lines with &quot;if not x then return false end&quot;...

@Peter:

The assignment inside the &quot;and&quot; is a nice trick, I am really surprised. Nevertheless, the scope of the variables is the whole function, and there are a lot of &quot;ands&quot;! :-)</description>
		<content:encoded><![CDATA[<p>@Bogdan:</p>
<p>It&#8217;s nice to see Lua here! But you would have to intersperse the lines with &#8220;if not x then return false end&#8221;&#8230;</p>
<p>@Peter:</p>
<p>The assignment inside the &#8220;and&#8221; is a nice trick, I am really surprised. Nevertheless, the scope of the variables is the whole function, and there are a lot of &#8220;ands&#8221;! <img src='http://www.ventonegro.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Snell-Pym &#187; I&#8217;m missing Scheme</title>
		<link>http://www.ventonegro.org/2008/12/equivalent-of-and-let/comment-page-1/#comment-377</link>
		<dc:creator>Snell-Pym &#187; I&#8217;m missing Scheme</dc:creator>
		<pubDate>Wed, 03 Dec 2008 01:29:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.ventonegro.org/?p=64#comment-377</guid>
		<description>[...] I came across Ventonegro&#039;s post on and-let* and it set me thinking. The Lisp family of languages (which includes Scheme) are renowned for their [...]</description>
		<content:encoded><![CDATA[<p>[...] I came across Ventonegro&#8217;s post on and-let* and it set me thinking. The Lisp family of languages (which includes Scheme) are renowned for their [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bogdan</title>
		<link>http://www.ventonegro.org/2008/12/equivalent-of-and-let/comment-page-1/#comment-376</link>
		<dc:creator>Bogdan</dc:creator>
		<pubDate>Wed, 03 Dec 2008 00:27:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.ventonegro.org/?p=64#comment-376</guid>
		<description>I would say any language with logical shortcut evaluation can get away with something like

function get_session(req)
   local cookies = request_cookies(req)
   local p = cookies and cookies.session_id
   local sid_str = p and p[1]
   local sid_nr = sid_str and tonumber(sid_str)
...

But I agree the Scheme version (or even the Ruby one) is more to the point.</description>
		<content:encoded><![CDATA[<p>I would say any language with logical shortcut evaluation can get away with something like</p>
<p>function get_session(req)<br />
   local cookies = request_cookies(req)<br />
   local p = cookies and cookies.session_id<br />
   local sid_str = p and p[1]<br />
   local sid_nr = sid_str and tonumber(sid_str)<br />
&#8230;</p>
<p>But I agree the Scheme version (or even the Ruby one) is more to the point.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Baga</title>
		<link>http://www.ventonegro.org/2008/12/equivalent-of-and-let/comment-page-1/#comment-375</link>
		<dc:creator>Tim Baga</dc:creator>
		<pubDate>Tue, 02 Dec 2008 22:25:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.ventonegro.org/?p=64#comment-375</guid>
		<description>There are no &#039;common&#039; way for such task. Maybe a bit stupid idea, but you can use something like ParseTree (http://parsetree.rubyforge.org/ParseTree/) to implement this macro in a way you would like it. Implementation won&#039;t take more than 5-6 lines.</description>
		<content:encoded><![CDATA[<p>There are no &#8216;common&#8217; way for such task. Maybe a bit stupid idea, but you can use something like ParseTree (<a href="http://parsetree.rubyforge.org/ParseTree/" rel="nofollow">http://parsetree.rubyforge.org/ParseTree/</a>) to implement this macro in a way you would like it. Implementation won&#8217;t take more than 5-6 lines.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Bex</title>
		<link>http://www.ventonegro.org/2008/12/equivalent-of-and-let/comment-page-1/#comment-374</link>
		<dc:creator>Peter Bex</dc:creator>
		<pubDate>Tue, 02 Dec 2008 20:44:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.ventonegro.org/?p=64#comment-374</guid>
		<description>Forgot to enclose in PRE tags. Just indent according to taste :)</description>
		<content:encoded><![CDATA[<p>Forgot to enclose in PRE tags. Just indent according to taste <img src='http://www.ventonegro.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Bex</title>
		<link>http://www.ventonegro.org/2008/12/equivalent-of-and-let/comment-page-1/#comment-373</link>
		<dc:creator>Peter Bex</dc:creator>
		<pubDate>Tue, 02 Dec 2008 20:42:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.ventonegro.org/?p=64#comment-373</guid>
		<description>It&#039;s actually deceptively simple:

def get_session(req)
        cookies = request_cookies(req)
    and p = cookies[:session_id]
    and sid_str = p[1]
    and sid_nr = sid_str.to_i
    and sid.is_a?(Integer)
    and sp = sessions[sid]
    and sp[1]
end</description>
		<content:encoded><![CDATA[<p>It&#8217;s actually deceptively simple:</p>
<p>def get_session(req)<br />
        cookies = request_cookies(req)<br />
    and p = cookies[:session_id]<br />
    and sid_str = p[1]<br />
    and sid_nr = sid_str.to_i<br />
    and sid.is_a?(Integer)<br />
    and sp = sessions[sid]<br />
    and sp[1]<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Grant Rettke</title>
		<link>http://www.ventonegro.org/2008/12/equivalent-of-and-let/comment-page-1/#comment-372</link>
		<dc:creator>Grant Rettke</dc:creator>
		<pubDate>Tue, 02 Dec 2008 19:55:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.ventonegro.org/?p=64#comment-372</guid>
		<description>You mean non-ugly Ruby, right? :)</description>
		<content:encoded><![CDATA[<p>You mean non-ugly Ruby, right? <img src='http://www.ventonegro.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
