<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Random Hacks comments</title>
    <link>http://www.randomhacks.net/</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Technology and Other Fun Stuff</description>
    <item>
      <title>"Why Hygienic Macros Rock" by Scott</title>
      <description>&lt;p&gt;Daniel: Ok, thanks.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;m acquainted with Forth. I read both &lt;em&gt;Starting Forth&lt;/em&gt; and &lt;em&gt;Thinking Forth&lt;/em&gt; a few days after posting the above comment, actually; I love the concatenative approach, though I find Forth a bit too low-level for my taste. (My favorite language is currently OCaml, so you can guess how I feel about working without any type system whatsover.) I&amp;#8217;ve also looked a little at Factor, but not in depth.&lt;/p&gt;


	&lt;p&gt;That said, the source to a Forth interpreter in i386 assembly and Forth was one of the single most mind-blowing programming things I&amp;#8217;ve ever read. When I saw that the interpreter had a bit for whether the code was being compiled or evaluated, and immediate functions could toggle it at runtime, everything suddenly made sense. So much flexibility emerging from so few constructs!&lt;/p&gt;


	&lt;p&gt;http://www.annexia.org/_file/jonesforth.s.txt&lt;/p&gt;</description>
      <pubDate>Tue, 15 Jul 2008 22:30:03 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:5306f8c6-4510-4d49-aa1f-5c2ea96606bc</guid>
      <link>http://www.randomhacks.net/articles/2002/09/13/hygienic-macros#comment-578</link>
    </item>
    <item>
      <title>"Why Hygienic Macros Rock" by Daniel</title>
      <description>&lt;p&gt;I have actually read a lot about hygienic vs non-hygienic macros. I just cannot recall what blogs and sites I read them.&lt;/p&gt;


	&lt;p&gt;You might try smuglispweeny and lambda-the-ultimate blogs, though. And wikipedia.&lt;/p&gt;


	&lt;p&gt;The thing is, gensyms handles some of the stuff hygienic macros handle, but not all of the stuff. There are some complex cases which would require heroic efforts in &lt;span class="caps"&gt;LISP&lt;/span&gt;, and very prone to errors at that.&lt;/p&gt;


	&lt;p&gt;On the other hand, hygienic macros can access the runtime context, in a more verbose way.&lt;/p&gt;


	&lt;p&gt;So, really, they each can be used for the same things, with varied levels of complexity depending on the task. But let me advocate hygienic macros a bit here.&lt;/p&gt;


	&lt;p&gt;There once was a language called Forth. Forth was interesting in that not only it was written in itself, but all the internals were available to any programs written in it, and, furthermore, it could be changed at will. You could change the parser, for instance, or you could change how it performed compilation.&lt;/p&gt;


	&lt;p&gt;Needless to say, it was powerful in the way such languages are. The thing is&amp;#8230; Forth lacked abstraction. Yes, you could change the compiler. But, of course, you&amp;#8217;d have to know how the specific compiler you were changing worked&amp;#8212;and I don&amp;#8217;t mean simply dialect differences. The most famous Forth generated indirectly threaded code, quite a few generated directly threaded code, some generated subrouting threaded code, others generated bytecode, and others compiled directly to machine code.&lt;/p&gt;


	&lt;p&gt;So it was very powerful stuff, which had very little portability. Well, let&amp;#8217;s be honest. It had no portability at all.&lt;/p&gt;


	&lt;p&gt;And here is the thing with non-hygienic macros&amp;#8230; the programmers using someone&amp;#8217;s macro also have to know how that macro works. Either that, or you add stuff to your macro until it is, effectively, hygienic.&lt;/p&gt;


	&lt;p&gt;So, by using hygienic macros, you guarantee a level of portability to them similar to library functions.&lt;/p&gt;</description>
      <pubDate>Sun, 22 Jun 2008 21:47:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:569edc73-4167-4cba-bbfa-ef2b1225b0cd</guid>
      <link>http://www.randomhacks.net/articles/2002/09/13/hygienic-macros#comment-577</link>
    </item>
    <item>
      <title>"Why Hygienic Macros Rock" by Eric</title>
      <description>&lt;p&gt;Scott: That&amp;#8217;s a good question, and I don&amp;#8217;t actually know the answer.&lt;/p&gt;


	&lt;p&gt;Most Scheme implementations take a distantly-related approach. They generally have two different hygenic macro systems:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;A &amp;#8220;low-level&amp;#8221; macro system, which works roughly like &lt;span class="caps"&gt;LISP&lt;/span&gt;, but which provides hygiene by default, but also provides the ability to violate hygiene selectively. This tends to be a bit fiddly to use.&lt;/li&gt;
		&lt;li&gt;A &amp;#8220;high-level&amp;#8221; macro system, which is based on hygienic rewrite rules. This is very easy to use, and will work for nearly all common macros.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Of course, using the low-level macro system, you can easily implement Lisp-style non-hygienic macros.&lt;/p&gt;


	&lt;p&gt;The &lt;span class="caps"&gt;PLT&lt;/span&gt; people have recently added another very slick feature to the standard Scheme toolkit: The ability the selectively violate hygiene from inside rewrite rules, in a &lt;a href="http://blog.plt-scheme.org/2008/02/dirty-looking-hygiene.html" rel="nofollow"&gt;carefully controlled&lt;/a&gt; fashion. This is a really nice feature, and we&amp;#8217;ve been using it at work with great success.&lt;/p&gt;</description>
      <pubDate>Fri, 20 Jun 2008 07:40:30 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:1053b2b2-1a16-4305-a516-c8dd0265bd4c</guid>
      <link>http://www.randomhacks.net/articles/2002/09/13/hygienic-macros#comment-576</link>
    </item>
    <item>
      <title>"Why Hygienic Macros Rock" by Scott</title>
      <description>&lt;p&gt;To what extent can hygienic macros be implemented in non- and vice versa? I&amp;#8217;m more familiar with Emacs Lisp-style macros than CL or Scheme macros, but it seems like the hygiene involves automatically writing code with gensyms to avoid variable capture and other compile-time analysis. If one is implemented in terms of the other, it would probably make the most sense to have two different forms, e.g. hmacro for declaring hygienic macros, and macro for when you deliberately want to do things like variable capture.&lt;/p&gt;</description>
      <pubDate>Thu, 19 Jun 2008 20:15:42 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:3d805087-bf74-43a9-aa42-addf5622bbeb</guid>
      <link>http://www.randomhacks.net/articles/2002/09/13/hygienic-macros#comment-575</link>
    </item>
    <item>
      <title>"Monads in 15 minutes: Backtracking and Maybe" by Doug Auclair</title>
      <description>&lt;p&gt;Linking this article on an introductory post about Maybe, List and Either monads and their uses for nondeterministic programming.&lt;/p&gt;


	&lt;p&gt;Coincidentally, I wrote a same-game-like puzzle solver (cf. comp.lang.haskell), where I needed to flatten a list of lists.  I didn&amp;#8217;t see `flatten` in the Prelude or List, so I wrote it out.  I then realized that `msum` is flatten for lists of depth 1 &amp;#8230; then I reread this article where join :: m (m a) &amp;rarr; m a does the same thing.  Applied that in my code and noticed I had this pattern: join $ map f x &amp;#8230; and replaced that with x &amp;gt;&amp;gt;= f.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Sigh&lt;/strong&gt;! Months later and I&amp;#8217;m still not recognizing when to use a simple bind!&lt;/p&gt;</description>
      <pubDate>Wed, 14 May 2008 01:39:52 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:45f28eaf-7838-4a02-a8b8-14f35a921082</guid>
      <link>http://www.randomhacks.net/articles/2007/03/12/monads-in-15-minutes#comment-571</link>
    </item>
    <item>
      <title>"Monads in 15 minutes: Backtracking and Maybe" by Joel Hough</title>
      <description>&lt;p&gt;Great article!  A few things clicked for me while reading.  I found that writing out the choice monad example step by step helped me to understand.  Like so:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_haskell "&gt;&lt;span class='varid'&gt;choose&lt;/span&gt; &lt;span class='keyglyph'&gt;[&lt;/span&gt;&lt;span class='num'&gt;1&lt;/span&gt;&lt;span class='layout'&gt;,&lt;/span&gt;&lt;span class='num'&gt;2&lt;/span&gt;&lt;span class='layout'&gt;,&lt;/span&gt;&lt;span class='num'&gt;3&lt;/span&gt;&lt;span class='keyglyph'&gt;]&lt;/span&gt; &lt;span class='varop'&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class='layout'&gt;(&lt;/span&gt;&lt;span class='keyglyph'&gt;\&lt;/span&gt;&lt;span class='varid'&gt;x&lt;/span&gt; &lt;span class='keyglyph'&gt;-&amp;gt;&lt;/span&gt;
&lt;span class='varid'&gt;choose&lt;/span&gt; &lt;span class='keyglyph'&gt;[&lt;/span&gt;&lt;span class='num'&gt;4&lt;/span&gt;&lt;span class='layout'&gt;,&lt;/span&gt;&lt;span class='num'&gt;5&lt;/span&gt;&lt;span class='layout'&gt;,&lt;/span&gt;&lt;span class='num'&gt;6&lt;/span&gt;&lt;span class='keyglyph'&gt;]&lt;/span&gt; &lt;span class='varop'&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class='layout'&gt;(&lt;/span&gt;&lt;span class='keyglyph'&gt;\&lt;/span&gt;&lt;span class='varid'&gt;y&lt;/span&gt; &lt;span class='keyglyph'&gt;-&amp;gt;&lt;/span&gt;
&lt;span class='varid'&gt;guard&lt;/span&gt; &lt;span class='layout'&gt;(&lt;/span&gt;&lt;span class='varid'&gt;x&lt;/span&gt;&lt;span class='varop'&gt;*&lt;/span&gt;&lt;span class='varid'&gt;y&lt;/span&gt;&lt;span class='varop'&gt;==&lt;/span&gt;&lt;span class='num'&gt;8&lt;/span&gt;&lt;span class='layout'&gt;)&lt;/span&gt; &lt;span class='varop'&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class='layout'&gt;(&lt;/span&gt;&lt;span class='keyglyph'&gt;\&lt;/span&gt;&lt;span class='varid'&gt;ignored&lt;/span&gt; &lt;span class='keyglyph'&gt;-&amp;gt;&lt;/span&gt;
&lt;span class='varid'&gt;return&lt;/span&gt; &lt;span class='layout'&gt;(&lt;/span&gt;&lt;span class='varid'&gt;x&lt;/span&gt;&lt;span class='layout'&gt;,&lt;/span&gt;&lt;span class='varid'&gt;y&lt;/span&gt;&lt;span class='layout'&gt;)&lt;/span&gt;&lt;span class='layout'&gt;)&lt;/span&gt;&lt;span class='layout'&gt;)&lt;/span&gt;&lt;span class='layout'&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
is equivalent to&amp;#8230;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_haskell "&gt;&lt;span class='varid'&gt;step1&lt;/span&gt; &lt;span class='keyglyph'&gt;=&lt;/span&gt; &lt;span class='varid'&gt;concat&lt;/span&gt; &lt;span class='varop'&gt;$&lt;/span&gt; &lt;span class='varid'&gt;map&lt;/span&gt; &lt;span class='varid'&gt;step2&lt;/span&gt; &lt;span class='keyglyph'&gt;[&lt;/span&gt;&lt;span class='num'&gt;1&lt;/span&gt;&lt;span class='layout'&gt;,&lt;/span&gt;&lt;span class='num'&gt;2&lt;/span&gt;&lt;span class='layout'&gt;,&lt;/span&gt;&lt;span class='num'&gt;3&lt;/span&gt;&lt;span class='keyglyph'&gt;]&lt;/span&gt;
&lt;span class='varid'&gt;step2&lt;/span&gt; &lt;span class='varid'&gt;x&lt;/span&gt; &lt;span class='keyglyph'&gt;=&lt;/span&gt; &lt;span class='varid'&gt;concat&lt;/span&gt; &lt;span class='varop'&gt;$&lt;/span&gt; &lt;span class='varid'&gt;map&lt;/span&gt; &lt;span class='layout'&gt;(&lt;/span&gt;&lt;span class='varid'&gt;step3&lt;/span&gt; &lt;span class='varid'&gt;x&lt;/span&gt;&lt;span class='layout'&gt;)&lt;/span&gt; &lt;span class='keyglyph'&gt;[&lt;/span&gt;&lt;span class='num'&gt;4&lt;/span&gt;&lt;span class='layout'&gt;,&lt;/span&gt;&lt;span class='num'&gt;5&lt;/span&gt;&lt;span class='layout'&gt;,&lt;/span&gt;&lt;span class='num'&gt;6&lt;/span&gt;&lt;span class='keyglyph'&gt;]&lt;/span&gt;
&lt;span class='varid'&gt;step3&lt;/span&gt; &lt;span class='varid'&gt;x&lt;/span&gt; &lt;span class='varid'&gt;y&lt;/span&gt; &lt;span class='keyglyph'&gt;=&lt;/span&gt; &lt;span class='varid'&gt;concat&lt;/span&gt; &lt;span class='varop'&gt;$&lt;/span&gt; &lt;span class='varid'&gt;map&lt;/span&gt; &lt;span class='layout'&gt;(&lt;/span&gt;&lt;span class='varid'&gt;step4&lt;/span&gt; &lt;span class='varid'&gt;x&lt;/span&gt; &lt;span class='varid'&gt;y&lt;/span&gt;&lt;span class='layout'&gt;)&lt;/span&gt; &lt;span class='layout'&gt;(&lt;/span&gt;&lt;span class='keyword'&gt;if&lt;/span&gt; &lt;span class='varid'&gt;x&lt;/span&gt;&lt;span class='varop'&gt;*&lt;/span&gt;&lt;span class='varid'&gt;y&lt;/span&gt; &lt;span class='varop'&gt;==&lt;/span&gt; &lt;span class='num'&gt;8&lt;/span&gt; &lt;span class='keyword'&gt;then&lt;/span&gt; &lt;span class='keyglyph'&gt;[&lt;/span&gt;&lt;span class='layout'&gt;(&lt;/span&gt;&lt;span class='layout'&gt;)&lt;/span&gt;&lt;span class='keyglyph'&gt;]&lt;/span&gt; &lt;span class='keyword'&gt;else&lt;/span&gt; &lt;span class='keyglyph'&gt;[&lt;/span&gt;&lt;span class='keyglyph'&gt;]&lt;/span&gt;&lt;span class='layout'&gt;)&lt;/span&gt;
&lt;span class='varid'&gt;step4&lt;/span&gt; &lt;span class='varid'&gt;x&lt;/span&gt; &lt;span class='varid'&gt;y&lt;/span&gt; &lt;span class='keyword'&gt;_&lt;/span&gt; &lt;span class='keyglyph'&gt;=&lt;/span&gt; &lt;span class='keyglyph'&gt;[&lt;/span&gt;&lt;span class='layout'&gt;(&lt;/span&gt;&lt;span class='varid'&gt;x&lt;/span&gt;&lt;span class='layout'&gt;,&lt;/span&gt; &lt;span class='varid'&gt;y&lt;/span&gt;&lt;span class='layout'&gt;)&lt;/span&gt;&lt;span class='keyglyph'&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Thanks for the epiphanies!&lt;/p&gt;</description>
      <pubDate>Thu, 10 Apr 2008 03:29:26 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:df7d3e3c-c8bf-4469-94c1-b44ff7f1fca5</guid>
      <link>http://www.randomhacks.net/articles/2007/03/12/monads-in-15-minutes#comment-570</link>
    </item>
    <item>
      <title>"Refactoring probability distributions, part 1: PerhapsT" by Robert</title>
      <description>&lt;p&gt;With regards to what Dan P said, there is a quantum IO monad:&lt;/p&gt;


	&lt;p&gt;http://www.cs.nott.ac.uk/~txa/talks/qnet06.pdf&lt;/p&gt;</description>
      <pubDate>Fri, 04 Apr 2008 10:37:48 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:21ae612c-60af-4f15-9c99-8491883fcf93</guid>
      <link>http://www.randomhacks.net/articles/2007/02/21/refactoring-probability-distributions#comment-569</link>
    </item>
    <item>
      <title>"Map fusion: Making Haskell 225% faster" by Lemming</title>
      <description>&lt;p&gt;I encountered the following problem which will hurt us in case of generalized monads as sketched in http://www.randomhacks.net/articles/2007/03/15/data-set-monad-haskell-macros
and of data structure like StorableVector
http://code.haskell.org/~sjanssen/storablevector
that requires a constraint on the element types. There it makes a difference if you separately map and fold or if you do it in one go. In the first case you need a Storable constraint for intermediate result type, too. That is, these constraints make implementation issues observable via the type signature.&lt;/p&gt;</description>
      <pubDate>Fri, 04 Apr 2008 02:42:12 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:010465d6-a7fb-4a0e-9b03-da629e12468d</guid>
      <link>http://www.randomhacks.net/articles/2007/02/10/map-fusion-and-haskell-performance#comment-567</link>
    </item>
    <item>
      <title>"Jim Hefferon's Linear Algebra: A free textbook with fascinating applications" by Arun J. C.</title>
      <description>&lt;p&gt;i am 2 semester Btech student in &lt;span class="caps"&gt;NIT&lt;/span&gt; Calicut&lt;/p&gt;</description>
      <pubDate>Wed, 05 Mar 2008 08:48:55 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:32d7e10c-84fd-4b28-ac23-3a3d8c80081e</guid>
      <link>http://www.randomhacks.net/articles/2007/03/07/hefferon-linear-algebra-review#comment-556</link>
    </item>
    <item>
      <title>"Jim Hefferon's Linear Algebra: A free textbook with fascinating applications" by Arun J. C.</title>
      <description>&lt;p&gt;I just searched linear agebra and this came up wonderful , really benifical better than any other book. 
thanks &amp;#8230;.&lt;/p&gt;</description>
      <pubDate>Wed, 05 Mar 2008 08:47:23 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:03f1ebba-1a33-4202-a78a-cfed2889baf8</guid>
      <link>http://www.randomhacks.net/articles/2007/03/07/hefferon-linear-algebra-review#comment-555</link>
    </item>
  </channel>
</rss>
