<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Factor: a stack-based programming language</title>
	<link>http://www.rfc1149.net/blog/2007/01/18/factor-a-stack-based-programming-language/</link>
	<description>Samuel Tardieu's dual-sided blog</description>
	<pubDate>Sun, 06 Jul 2008 06:58:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: simon</title>
		<link>http://www.rfc1149.net/blog/2007/01/18/factor-a-stack-based-programming-language/#comment-28548</link>
		<dc:creator>simon</dc:creator>
		<pubDate>Sun, 04 Feb 2007 07:29:35 +0000</pubDate>
		<guid>http://www.rfc1149.net/blog/2007/01/18/factor-a-stack-based-programming-language/#comment-28548</guid>
		<description>&#62;In the same family you should not forget Postscript!

C'est vrai ça (hey, why English? Don't we all speak French here? And I'm sure those who don't will be more than pleased to learn our language, as we did for theirs :-))... J'ai toujours trouvé le postscript fantastique.. Un peu lent, peut-être :-) Mais vraiment intéressant.
 Mais "factor" a l'air épatant. Merci !

P.S : j'espère que tout va bien !</description>
		<content:encoded><![CDATA[<p>&gt;In the same family you should not forget Postscript!</p>
<p>C&#8217;est vrai ça (hey, why English? Don&#8217;t we all speak French here? And I&#8217;m sure those who don&#8217;t will be more than pleased to learn our language, as we did for theirs :-))&#8230; J&#8217;ai toujours trouvé le postscript fantastique.. Un peu lent, peut-être <img src='http://www.rfc1149.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> Mais vraiment intéressant.<br />
 Mais &#8220;factor&#8221; a l&#8217;air épatant. Merci !</p>
<p>P.S : j&#8217;espère que tout va bien !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anonymous</title>
		<link>http://www.rfc1149.net/blog/2007/01/18/factor-a-stack-based-programming-language/#comment-26164</link>
		<dc:creator>anonymous</dc:creator>
		<pubDate>Fri, 19 Jan 2007 16:07:40 +0000</pubDate>
		<guid>http://www.rfc1149.net/blog/2007/01/18/factor-a-stack-based-programming-language/#comment-26164</guid>
		<description>Now, that's one nasty sig :)</description>
		<content:encoded><![CDATA[<p>Now, that&#8217;s one nasty sig <img src='http://www.rfc1149.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian Cornelssen</title>
		<link>http://www.rfc1149.net/blog/2007/01/18/factor-a-stack-based-programming-language/#comment-26144</link>
		<dc:creator>Christian Cornelssen</dc:creator>
		<pubDate>Fri, 19 Jan 2007 13:04:09 +0000</pubDate>
		<guid>http://www.rfc1149.net/blog/2007/01/18/factor-a-stack-based-programming-language/#comment-26144</guid>
		<description>
perl -nle 'print pack("B*",$_)'

does the same job, but yes, the factor code is elegant.</description>
		<content:encoded><![CDATA[<p>perl -nle &#8216;print pack(&#8221;B*&#8221;,$_)&#8217;</p>
<p>does the same job, but yes, the factor code is elegant.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samuel Tardieu</title>
		<link>http://www.rfc1149.net/blog/2007/01/18/factor-a-stack-based-programming-language/#comment-26044</link>
		<dc:creator>Samuel Tardieu</dc:creator>
		<pubDate>Thu, 18 Jan 2007 21:15:23 +0000</pubDate>
		<guid>http://www.rfc1149.net/blog/2007/01/18/factor-a-stack-based-programming-language/#comment-26044</guid>
		<description>&lt;b&gt;Daniel:&lt;/b&gt; I was not comfortable in introducing yet another concept here (&lt;code&gt;make&lt;/code&gt;), while I assumed everyone familiar with functional languages would recognize &lt;code&gt;reduce&lt;/code&gt;. But thanks for your input, it looks just like my own implementation indeed.

And by the way I read your post earlier today already :)</description>
		<content:encoded><![CDATA[<p><b>Daniel:</b> I was not comfortable in introducing yet another concept here (<code>make</code>), while I assumed everyone familiar with functional languages would recognize <code>reduce</code>. But thanks for your input, it looks just like my own implementation indeed.</p>
<p>And by the way I read your post earlier today already <img src='http://www.rfc1149.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Ehrenberg</title>
		<link>http://www.rfc1149.net/blog/2007/01/18/factor-a-stack-based-programming-language/#comment-26029</link>
		<dc:creator>Daniel Ehrenberg</dc:creator>
		<pubDate>Thu, 18 Jan 2007 17:23:19 +0000</pubDate>
		<guid>http://www.rfc1149.net/blog/2007/01/18/factor-a-stack-based-programming-language/#comment-26029</guid>
		<description>This is a great example. There's just a little thing about your ascii encoding that could be improved. &lt;code&gt;"" [ 2 &#62;base 8 CHAR: 0 pad-left append ] reduce&lt;/code&gt; is O(n^2), because it appends to "" n times. This might be OK for a short string, but for longer strings, it could take a really long time. A more efficient way to do it is using &lt;code&gt;make&lt;/code&gt;. I happen to have just written a summary of how to use &lt;code&gt;make&lt;/code&gt; &lt;a href="http://useless-factor.blogspot.com/2007/01/factors-make.html" rel="nofollow"&gt;here&lt;/a&gt;. The (untested) way to rewrite your code using &lt;code&gt;make&lt;/code&gt; is: &lt;code&gt;[ [ 2 &#62;base 8 CHAR: 0 pad-left % ] each ] "" make&lt;/code&gt;. The way that is implemented, it takes a vector and repeatedly appends on to it &lt;em&gt;in place&lt;/em&gt; before converting the result to a string. This way, you don't have to copy the string so many times.</description>
		<content:encoded><![CDATA[<p>This is a great example. There&#8217;s just a little thing about your ascii encoding that could be improved. <code>"" [ 2 &gt;base 8 CHAR: 0 pad-left append ] reduce</code> is O(n^2), because it appends to &#8220;&#8221; n times. This might be OK for a short string, but for longer strings, it could take a really long time. A more efficient way to do it is using <code>make</code>. I happen to have just written a summary of how to use <code>make</code> <a href="http://useless-factor.blogspot.com/2007/01/factors-make.html"  class="external">here</a>. The (untested) way to rewrite your code using <code>make</code> is: <code>[ [ 2 &gt;base 8 CHAR: 0 pad-left % ] each ] "" make</code>. The way that is implemented, it takes a vector and repeatedly appends on to it <em>in place</em> before converting the result to a string. This way, you don&#8217;t have to copy the string so many times.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samuel Tardieu</title>
		<link>http://www.rfc1149.net/blog/2007/01/18/factor-a-stack-based-programming-language/#comment-25978</link>
		<dc:creator>Samuel Tardieu</dc:creator>
		<pubDate>Thu, 18 Jan 2007 07:51:01 +0000</pubDate>
		<guid>http://www.rfc1149.net/blog/2007/01/18/factor-a-stack-based-programming-language/#comment-25978</guid>
		<description>&lt;b&gt;Thomas:&lt;/b&gt; here is a possible Factor quine.

&lt;blockquote&gt;
&lt;pre&gt;
[ pprint " dup call" print ] dup call
&lt;/pre&gt;
&lt;/blockquote&gt;</description>
		<content:encoded><![CDATA[<p><b>Thomas:</b> here is a possible Factor quine.</p>
<blockquote>
<pre>
[ pprint " dup call" print ] dup call
</pre>
</blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samuel Tardieu</title>
		<link>http://www.rfc1149.net/blog/2007/01/18/factor-a-stack-based-programming-language/#comment-25977</link>
		<dc:creator>Samuel Tardieu</dc:creator>
		<pubDate>Thu, 18 Jan 2007 07:45:54 +0000</pubDate>
		<guid>http://www.rfc1149.net/blog/2007/01/18/factor-a-stack-based-programming-language/#comment-25977</guid>
		<description>&lt;b&gt;Thomas:&lt;/b&gt; yeah, I like &lt;a href="http://en.wikipedia.org/wiki/Quine_%28computing%29" rel="nofollow"&gt;quines&lt;/a&gt; too.</description>
		<content:encoded><![CDATA[<p><b>Thomas:</b> yeah, I like <a href="http://en.wikipedia.org/wiki/Quine_%28computing%29"  class="external">quines</a> too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas</title>
		<link>http://www.rfc1149.net/blog/2007/01/18/factor-a-stack-based-programming-language/#comment-25927</link>
		<dc:creator>Thomas</dc:creator>
		<pubDate>Wed, 17 Jan 2007 23:57:53 +0000</pubDate>
		<guid>http://www.rfc1149.net/blog/2007/01/18/factor-a-stack-based-programming-language/#comment-25927</guid>
		<description>In the same family you should not forget Postscript!

Here's an example I like of a Postscript program that renders its own source text, using the stack to create a function and pass it as argument to itself for the purpose of displaying it...


%!PS-Adobe-2.0
{ ($Id: //depot/src/self.ps#5 $) pop
  20 616 moveto /Helvetica-Bold findfont 12 scalefont setfont
  (%!PS-Adobe-2.0) show
  20 600 moveto
  /tshow { currentpoint pop dup 550 ge { neg 20 add -16 rmoveto } { pop }
    ifelse show }
    bind def
  4 dict dup /cdict exch def
   dup 40 (\\\() put
   dup 41 (\\\)) put
       92 (\\\\) put
  /cshow { dup cdict exch known { dup cdict exch get }
           { 1 string dup 0 4 3 roll put } ifelse show } bind def
  /xshow {
    dup type /arraytype eq { ({ ) tshow { xshow } forall (} ) tshow }
    { dup type /nametype eq { dup xcheck not { (/) tshow } if } if
      dup type /stringtype eq { (\() tshow { cshow } forall (\) ) tshow }
      { 20 string cvs tshow ( ) tshow } ifelse } ifelse } def
  xshow
  { dup exec showpage } { xshow } forall } dup exec showpage
</description>
		<content:encoded><![CDATA[<p>In the same family you should not forget Postscript!</p>
<p>Here&#8217;s an example I like of a Postscript program that renders its own source text, using the stack to create a function and pass it as argument to itself for the purpose of displaying it&#8230;</p>
<p>%!PS-Adobe-2.0<br />
{ ($Id: //depot/src/self.ps#5 $) pop<br />
  20 616 moveto /Helvetica-Bold findfont 12 scalefont setfont<br />
  (%!PS-Adobe-2.0) show<br />
  20 600 moveto<br />
  /tshow { currentpoint pop dup 550 ge { neg 20 add -16 rmoveto } { pop }<br />
    ifelse show }<br />
    bind def<br />
  4 dict dup /cdict exch def<br />
   dup 40 (\\\() put<br />
   dup 41 (\\\)) put<br />
       92 (\\\\) put<br />
  /cshow { dup cdict exch known { dup cdict exch get }<br />
           { 1 string dup 0 4 3 roll put } ifelse show } bind def<br />
  /xshow {<br />
    dup type /arraytype eq { ({ ) tshow { xshow } forall (} ) tshow }<br />
    { dup type /nametype eq { dup xcheck not { (/) tshow } if } if<br />
      dup type /stringtype eq { (\() tshow { cshow } forall (\) ) tshow }<br />
      { 20 string cvs tshow ( ) tshow } ifelse } ifelse } def<br />
  xshow<br />
  { dup exec showpage } { xshow } forall } dup exec showpage</p>
]]></content:encoded>
	</item>
</channel>
</rss>
