<?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: Bring functional programming to IEEExtreme!</title>
	<atom:link href="http://blog.kamibu.com/2009/09/01/bring-functional-programming-to-ieeextreme/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.kamibu.com/2009/09/01/bring-functional-programming-to-ieeextreme/</link>
	<description></description>
	<lastBuildDate>Fri, 28 May 2010 12:33:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Ian Atha</title>
		<link>http://blog.kamibu.com/2009/09/01/bring-functional-programming-to-ieeextreme/comment-page-1/#comment-4502</link>
		<dc:creator>Ian Atha</dc:creator>
		<pubDate>Wed, 02 Sep 2009 17:51:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.kamibu.com/?p=84#comment-4502</guid>
		<description>They are in the SRFI&#039;s... Scheme extensions.</description>
		<content:encoded><![CDATA[<p>They are in the SRFI&#8217;s&#8230; Scheme extensions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: abresas</title>
		<link>http://blog.kamibu.com/2009/09/01/bring-functional-programming-to-ieeextreme/comment-page-1/#comment-4496</link>
		<dc:creator>abresas</dc:creator>
		<pubDate>Wed, 02 Sep 2009 13:42:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.kamibu.com/?p=84#comment-4496</guid>
		<description>Just for the sake of showing that there are many ways to work in Scheme, I will post my implementation of ip2long too.

(define (ip2long ip)
  (let
    ((quads (map (lambda (x) (string-&gt;number x)) (string-split ip #\.))))
    (fold-left (lambda (x y) (+ (* x 256) y)) 0 quads)))

And the string-split function: (some Scheme compilers have it built-in)

; split string str by delimiter del
; returns list of strings
(define (string-split str del)
  (let ((i (string-find-next-char str del)))
    (if (false? i)
      (cons str ())
      (cons
        (substring str 0 i)
        (string-split
          (substring str (+ i 1) (string-length str))
          del)))))

I would be happy to hear comments on these too :)</description>
		<content:encoded><![CDATA[<p>Just for the sake of showing that there are many ways to work in Scheme, I will post my implementation of ip2long too.</p>
<p>(define (ip2long ip)<br />
  (let<br />
    ((quads (map (lambda (x) (string->number x)) (string-split ip #\.))))<br />
    (fold-left (lambda (x y) (+ (* x 256) y)) 0 quads)))</p>
<p>And the string-split function: (some Scheme compilers have it built-in)</p>
<p>; split string str by delimiter del<br />
; returns list of strings<br />
(define (string-split str del)<br />
  (let ((i (string-find-next-char str del)))<br />
    (if (false? i)<br />
      (cons str ())<br />
      (cons<br />
        (substring str 0 i)<br />
        (string-split<br />
          (substring str (+ i 1) (string-length str))<br />
          del)))))</p>
<p>I would be happy to hear comments on these too <img src='http://blog.kamibu.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: abresas</title>
		<link>http://blog.kamibu.com/2009/09/01/bring-functional-programming-to-ieeextreme/comment-page-1/#comment-4495</link>
		<dc:creator>abresas</dc:creator>
		<pubDate>Wed, 02 Sep 2009 13:35:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.kamibu.com/?p=84#comment-4495</guid>
		<description>The link works now, thank you Ian.

Very interesting implementations for ip-to-int and int-to-ip.

The way you used map with two lists for ip-to-int was pretty clever - I didn&#039;t even know you can pass many lists as arguments to map.

The unfold-right procedure was also new for me, I guess that&#039;s because there is no built-in implementation for MIT-Scheme.</description>
		<content:encoded><![CDATA[<p>The link works now, thank you Ian.</p>
<p>Very interesting implementations for ip-to-int and int-to-ip.</p>
<p>The way you used map with two lists for ip-to-int was pretty clever &#8211; I didn&#8217;t even know you can pass many lists as arguments to map.</p>
<p>The unfold-right procedure was also new for me, I guess that&#8217;s because there is no built-in implementation for MIT-Scheme.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Atha</title>
		<link>http://blog.kamibu.com/2009/09/01/bring-functional-programming-to-ieeextreme/comment-page-1/#comment-4489</link>
		<dc:creator>Ian Atha</dc:creator>
		<pubDate>Tue, 01 Sep 2009 23:32:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.kamibu.com/?p=84#comment-4489</guid>
		<description>Here&#039;s some hastily put together functions for ip2long and back in MzScheme.

#lang mzscheme
(require srfi/1/list
         srfi/14/char-set
         srfi/13/string)

(define ip-to-int
  (lambda (ip)
    (apply +
           (map *
                (map string-&gt;number (string-tokenize ip (string-&gt;char-set &quot;0123456789&quot;)))
                (map (lambda (x) (expt 256 x)) (iota 4 3 -1))))))

(define int-to-ip
  (lambda (intip)
    (string-join
     (map
      number-&gt;string
      (unfold-right
       zero?
       (lambda (x) (remainder x 256))
       (lambda (x) (quotient x 256))
       intip))
     &quot;.&quot;)))</description>
		<content:encoded><![CDATA[<p>Here&#8217;s some hastily put together functions for ip2long and back in MzScheme.</p>
<p>#lang mzscheme<br />
(require srfi/1/list<br />
         srfi/14/char-set<br />
         srfi/13/string)</p>
<p>(define ip-to-int<br />
  (lambda (ip)<br />
    (apply +<br />
           (map *<br />
                (map string-&gt;number (string-tokenize ip (string-&gt;char-set &#8220;0123456789&#8243;)))<br />
                (map (lambda (x) (expt 256 x)) (iota 4 3 -1))))))</p>
<p>(define int-to-ip<br />
  (lambda (intip)<br />
    (string-join<br />
     (map<br />
      number-&gt;string<br />
      (unfold-right<br />
       zero?<br />
       (lambda (x) (remainder x 256))<br />
       (lambda (x) (quotient x 256))<br />
       intip))<br />
     &#8220;.&#8221;)))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Atha</title>
		<link>http://blog.kamibu.com/2009/09/01/bring-functional-programming-to-ieeextreme/comment-page-1/#comment-4487</link>
		<dc:creator>Ian Atha</dc:creator>
		<pubDate>Tue, 01 Sep 2009 19:43:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.kamibu.com/?p=84#comment-4487</guid>
		<description>The link to ieee.org is broken--it&#039;s missing the protocol identifier.</description>
		<content:encoded><![CDATA[<p>The link to ieee.org is broken&#8211;it&#8217;s missing the protocol identifier.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
