<?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: Defining custom literals in Chicken Scheme</title>
	<atom:link href="http://4.flowsnake.org/archives/49/feed" rel="self" type="application/rss+xml" />
	<link>http://4.flowsnake.org/archives/49</link>
	<description>A Pythoneer's adventures with Chicken Scheme. ^_^ And more.</description>
	<pubDate>Fri, 21 Nov 2008 05:55:13 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Graham Fawcett</title>
		<link>http://4.flowsnake.org/archives/49#comment-33</link>
		<dc:creator>Graham Fawcett</dc:creator>
		<pubDate>Mon, 28 Jan 2008 14:08:36 +0000</pubDate>
		<guid isPermaLink="false">http://4.flowsnake.org/archives/49#comment-33</guid>
		<description>(string-&#62;number (read-number port)) seems like overkill, since your syntax expression is space-delimited. You could just use (read port), which would parse the expression, returning (in this case) a numeric literal. 

To catch bad inputs (non-numbers), you could use (ensure number? (read port)) which will throw an error if the value is anything non-numeric. 

Mind you, this would also allow expressions like "-234" and "3.1" to be parsed. You could trap it with (ensure (conjoin fixnum? positive?) (read port)), where (conjoin ...) takes a set of predicates and combines them in the "and" sense. 

It's great to see someone blogging about some down-and-dirty Chicken. Keep it up! :-)</description>
		<content:encoded><![CDATA[<p>(string-&gt;number (read-number port)) seems like overkill, since your syntax expression is space-delimited. You could just use (read port), which would parse the expression, returning (in this case) a numeric literal. </p>
<p>To catch bad inputs (non-numbers), you could use (ensure number? (read port)) which will throw an error if the value is anything non-numeric. </p>
<p>Mind you, this would also allow expressions like "-234" and "3.1" to be parsed. You could trap it with (ensure (conjoin fixnum? positive?) (read port)), where (conjoin ...) takes a set of predicates and combines them in the "and" sense. </p>
<p>It's great to see someone blogging about some down-and-dirty Chicken. Keep it up! :-)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
