<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.11" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>Omnigia: Scheme, web applications, tech</title>
	<link>http://www.omnigia.com/news</link>
	<description>Scheme, web applications, tech</description>
	<pubDate>Sat, 25 Oct 2008 16:52:06 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.11</generator>
	<language>en</language>
			<item>
		<title>Scsh-regexp and SISCweb URLs</title>
		<link>http://www.omnigia.com/news/2007/02/21/scsh-regexp-match-cond-siscweb/</link>
		<comments>http://www.omnigia.com/news/2007/02/21/scsh-regexp-match-cond-siscweb/#comments</comments>
		<pubDate>Thu, 22 Feb 2007 01:52:51 +0000</pubDate>
		<dc:creator>Dan Muresan</dc:creator>
		
		<category>scheme</category>

		<category>scsh-regexp</category>

		<category>siscweb</category>

		<guid isPermaLink="false">http://www.omnigia.com/news/2007/02/21/scsh-regexp-match-cond-siscweb/</guid>
		<description><![CDATA[A new version of scsh-regexp, the SCSH regular expression API port to Chicken and SISC, is available. All API functions (except regexp manipulation such as uncase) are implemented, and there are a few bugfixes (including one that prevented compilation under SISC); there is still no SRE support.
For the moment, you will have to download this [...]]]></description>
			<content:encoded><![CDATA[<p>A new version of <a href="http://www.omnigia.com/scheme/scsh-regexp"><kbd>scsh-regexp</kbd></a>, the <a href="http://www.scsh.net/docu/html/man-Z-H-7.html#node_sec_6.4">SCSH regular expression API</a> port to Chicken and SISC, is available. All API functions (except regexp manipulation such as <code>uncase</code>) are implemented, and there are a few bugfixes (including one that prevented compilation under SISC); there is still no SRE support.</p>
<p>For the moment, you will have to <a href="http://code.google.com/p/scsh-regexp/source">download this release from Google Code</a>; the Chicken <a href="http://www.call-with-current-continuation.org/eggs/scsh-regexp.html">egg</a> should be updated to release 0.2 in a day or two.</p>
<p>If you&#8217;d like to see a port of <kbd>scsh-regexp</kbd> to your favorite Scheme, feel free to let me know (or contribute some code), as I am unlikely to make any further changes otherwise (save fixing potential bugs, should any surface). A Guile port would be the easiest.</p>
<p>And now, a fun exercise: scsh-regexp can handle pretty URLs in <a href="http://siscweb.sourceforge.net">SISCweb</a> applications. More specifically, we are going to sidestep the <code>publish</code> method by passing all requests to a single handler, which will discriminate between various URLs using the <code>match-cond</code> macro; here&#8217;s what a CMS application&#8217;s entry point might look like:</p>
<pre>(publish "/*" url-dispatcher)
(define (url-dispatcher request)
  (define path (request/get-path-info))
  (define (m url)
    (regexp-search (posix-string-&gt;regexp (string-append "^" url "$") path)))
  (match-cond
   ((m "/archives/([0-9]+)/([0-9]+)") (_ year month)
    (list-stories year month))
   ((m "/story/([^/]*)") (_ story-slug)
    (send-story story-slug))
   ...
   (else (send-404))))</pre>
<p><code>match-cond</code> is <a href="http://www.scsh.net/docu/html/man-Z-H-7.html#node_sec_6.4">described in the SCSH manual</a>, but briefly it goes through a list of clauses (just like <code>cond</code>), and when a match is found, it binds variables to the specified sub-matches (which correspond to paranthesized chunks in the regexp). Note that the URLs now contain regexp-style wildcards, instead of SISCweb&#8217;s usual servlet-style wildcards.</p>
<p>This approach can be made cleaner with macros, or, as I will describe in a future post, by using an upcoming feature of SISCweb 0.5 &mdash; <code>(publish "/some/url/.*" handler 'regexp)</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.omnigia.com/news/2007/02/21/scsh-regexp-match-cond-siscweb/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Regular expressions in Scheme</title>
		<link>http://www.omnigia.com/news/2006/11/15/regular-expressions-in-scheme/</link>
		<comments>http://www.omnigia.com/news/2006/11/15/regular-expressions-in-scheme/#comments</comments>
		<pubDate>Wed, 15 Nov 2006 11:16:48 +0000</pubDate>
		<dc:creator>Dan Muresan</dc:creator>
		
		<category>scheme</category>

		<category>scsh-regexp</category>

		<guid isPermaLink="false">http://www.omnigia.com/news/2006/11/15/regular-expressions-in-scheme/</guid>
		<description><![CDATA[In my last post, I mentioned generating the R5RS identifier list by scraping the HTML version of the R5RS standard. I decided to use Scheme for the job, and quickly learned that Chicken and SISC lack adequate regexp support (SISC has no support at all, apart from letting you interface with the underlying JVM). Eventually, I [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://www.omnigia.com/news/2006/11/07/scheme-readline-completion/">last post</a>, I mentioned generating the <a href="http://www.omnigia.com/scheme/r5rs_kw.txt">R5RS identifier list</a> by scraping the HTML version of the R5RS standard. I decided to use Scheme for the job, and quickly learned that Chicken and SISC lack adequate regexp support (SISC has no support at all, apart from letting you interface with the underlying JVM). Eventually, I settled upon SCSH, as it has a powerful <a href="http://www.scsh.net/docu/html/man-Z-H-7.html#node_sec_6.4">regexp API</a>, as well as good shell integration.</p>
<p>The resulting SCSH script took forever to run (to be fair, I added code to separate procedure names from macro names, and  didn&#8217;t bother optimizing beyond the naive O(n<sup>2</sup>) algorithm). I started to miss Chicken&#8217;s speed. The SCSH regexp API looked reasonably easy to port. I ended up writing both a Chicken and a SISC emulation layer (the latter based on <code>java.util.regex</code>). I am planning to add a <a href="http://www.ccs.neu.edu/home/dorai/pregexp/pregexp.html">pregexp</a> backend as well, which would extend regexp support to any R5RS system.</p>
<p>Have a look at the <a href="http://www.omnigia.com/scheme/scsh-regexp/">scsh-regexp project</a>  for details, examples and news.
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.omnigia.com/news/2006/11/15/regular-expressions-in-scheme/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
