<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Joel-On-Software on the power of a good language</title><link>http://blogs.msdn.com/b/powershell/archive/2006/08/02/joelonsoftware-on-the-power-of-a-good-language.aspx</link><description>Joel Spolsky of Joel-On-Software fame, just posted a blog, "Can Your Programming Language Do This?" http://www.joelonsoftware.com/items/2006/08/01.html 
 In this article, he drives home the point that when it comes to code: Maintainability, Readability</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Joel-On-Software on the power of a good language</title><link>http://blogs.msdn.com/b/powershell/archive/2006/08/02/joelonsoftware-on-the-power-of-a-good-language.aspx#9811248</link><pubDate>Wed, 01 Jul 2009 18:23:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9811248</guid><dc:creator>Rupert</dc:creator><description>&lt;p&gt;I'd prefer a version of map that returned a new array rather than altering the existing one in place. Something like...&lt;/p&gt;
&lt;p&gt;function map ($fn, $list)&lt;/p&gt;
&lt;p&gt;{ &amp;nbsp;&lt;/p&gt;
&lt;p&gt;	$ret = $null&lt;/p&gt;
&lt;p&gt;	for ($i = 0; $i -lt $list.length; $i++)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; 	{ &amp;nbsp;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; 		$ret += ,(&amp;amp;$fn $list[$i])&lt;/p&gt;
&lt;p&gt; &amp;nbsp; 	}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; 	return $ret&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9811248" width="1" height="1"&gt;</description></item><item><title>re: Joel-On-Software on the power of a good language</title><link>http://blogs.msdn.com/b/powershell/archive/2006/08/02/joelonsoftware-on-the-power-of-a-good-language.aspx#3238632</link><pubDate>Tue, 12 Jun 2007 03:45:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3238632</guid><dc:creator>James Hugard</dc:creator><description>&lt;p&gt;Hah, that should be reduced to:&lt;/p&gt;
&lt;p&gt;filter map( [ScriptBlock] $fn ) { &amp;amp; $fn $_ }&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3238632" width="1" height="1"&gt;</description></item><item><title>re: Joel-On-Software on the power of a good language</title><link>http://blogs.msdn.com/b/powershell/archive/2006/08/02/joelonsoftware-on-the-power-of-a-good-language.aspx#3152713</link><pubDate>Fri, 08 Jun 2007 04:45:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3152713</guid><dc:creator>James Hugard</dc:creator><description>&lt;p&gt;I prefer this version of &amp;quot;map&amp;quot;, because it works with any collection object or scalar:&lt;/p&gt;
&lt;p&gt;filter map( [ScriptBlock]$fn )&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	$_ | %{ &amp;amp;$fn $_ }&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Works like this:&lt;/p&gt;
&lt;p&gt;$files = &amp;quot;a&lt;/p&gt;
&lt;p&gt;b&lt;/p&gt;
&lt;p&gt;c&lt;/p&gt;
&lt;p&gt;d&amp;quot;&lt;/p&gt;
&lt;p&gt;$files = $files.split(&amp;quot;`n&amp;quot;) | map { $_.Trim() }&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3152713" width="1" height="1"&gt;</description></item><item><title>re: Joel-On-Software on the power of a good language</title><link>http://blogs.msdn.com/b/powershell/archive/2006/08/02/joelonsoftware-on-the-power-of-a-good-language.aspx#792356</link><pubDate>Thu, 05 Oct 2006 02:37:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:792356</guid><dc:creator>Fabio Galuppo</dc:creator><description>I like the simplicity and "power" of PowerShell...

But, check this. Nice work from a strong type-checked language, isn't it?

//////////
// C# 2.0 version of "famous" Map/Reduce sample
//////////

using con = System.Console;
using gen = System.Collections.Generic;

namespace DynamicProgram
{
    static class Program
    {
        delegate void Function&lt;T&gt;( T arg );
        delegate T FunctionWithRet&lt;T&gt;( T arg );
        
        static Function&lt;string&gt; alert = con.WriteLine;        
        static Function&lt;int&gt; alert_i = con.WriteLine;

        static void SwedishChef&lt;T&gt;( T msg ){ alert( "I'd like some " + msg + "!" ); }

        static void PutInPot&lt;T&gt;( T ingredient ){ alert( "POT: " + ingredient + " added" ); }
        static void BoomBoom&lt;T&gt;( T ingredient ){ alert( "BOOM: " + ingredient ); }

        static void Cook&lt;T&gt;(T i1, T i2, Function&lt;T&gt; f)
        {
            alert( "Get the " + i1 );
            f(i1);
            f(i2);
        }

        static void map&lt;T&gt;(Function&lt;T&gt; f, gen.IEnumerable&lt;T&gt; a){ foreach (T i in a) f( i ); }
        static void map&lt;T&gt;(FunctionWithRet&lt;T&gt; f, T[] a){ for( int i = 0; i &lt; a.Length; ++i ) a[i] = f( a[i] ); }

        delegate T BinaryOperation&lt;T&gt;( T i, T j );
        static BinaryOperation&lt;int&gt; add = delegate( int i, int j ){ return i + j; };
        static BinaryOperation&lt;string&gt; concat = delegate( string i, string j ){ return i + j; };

        static T sum&lt;T&gt;(BinaryOperation&lt;T&gt; binOp, params T[] a)
        {
            T t = default(T);
            foreach (T i in a) t = binOp( t, i );                        
            return t;
        }

        static T join&lt;T&gt;( BinaryOperation&lt;T&gt; binOp, params T[] a )
        {
            T t = default(T);
            foreach (T i in a) t = binOp( t, i );            
            return t;
        }

        static T reduce&lt;T&gt;( BinaryOperation&lt;T&gt; binOp, params T[] a )
        {
            T t = default(T);
            foreach (T i in a) t = binOp( t, i );            
            return t;
        }

        static T sum_r&lt;T&gt;(BinaryOperation&lt;T&gt; binOp, params T[] a){ return reduce( binOp, a );}
        static T join_r&lt;T&gt;( BinaryOperation&lt;T&gt; binOp, params T[] a ){ return reduce( binOp, a ); }

        //extra
        delegate T reduceHandler&lt;T&gt;( params T[] a );
        static reduceHandler&lt;int&gt; reduced_sum = delegate( int[] a ){ return reduce( add, a ); };
        static reduceHandler&lt;string&gt; reduced_join = delegate( string[] a ){ return reduce( concat, a ); };
        
        static void Main(string[] args)
        {
            alert("I'd like some Spaghetti!");
            alert("I'd like some Chocolate Moose!");

            SwedishChef("Spagetthi");
            SwedishChef("Chocolate Moose");

            Cook("Lobster", "Water", PutInPot);
            Cook("Chicken", "Coconut", BoomBoom);

            Cook("Lobster", "Water", delegate(string ingredient) { alert("POT: " + ingredient + " added"); });
            Cook("Chicken", "Coconut", delegate(string ingredient) { alert("BOOM: " + ingredient); });
                        
            int[] a = { 1, 2, 3 }; 
            for( int i = 0; i &lt; a.Length;  ++i ) { a[i] *= 2; }
            foreach ( int i in a ) { alert_i( i ); }
            
            a = new int[]{ 1, 2, 3 }; 
            map(delegate(int i) { return i * 2; }, a);
            map(alert_i, a);
            
            alert_i( sum( add, 1, 2, 3 ) );
            alert( join( concat, "a", "b", "c" ) );

            alert_i( sum_r( add, 1, 2, 3 ) );
            alert( join_r( concat, "a", "b", "c" ) );

            //extra
            alert_i( reduced_sum( 1, 2, 3 ) );
            alert( reduced_join( "a", "b", "c" ) );
        }
    }
}

//////////
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=792356" width="1" height="1"&gt;</description></item><item><title>re: Joel-On-Software on the power of a good language</title><link>http://blogs.msdn.com/b/powershell/archive/2006/08/02/joelonsoftware-on-the-power-of-a-good-language.aspx#699812</link><pubDate>Mon, 14 Aug 2006 20:18:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:699812</guid><dc:creator>Lee</dc:creator><description>lb:&lt;br&gt;&lt;br&gt;You normally define functions with the parameters listed after the function name, but it is just as correct to provide a param statement. &amp;nbsp;That lets you write:&lt;br&gt;&lt;br&gt;Function PutInPot {Param($x) Alert &amp;quot;Boom $x&amp;quot;}&lt;br&gt;&lt;br&gt;Also, all script blocks, functions, and scripts can be written to easily accept pipeline input:&lt;br&gt;&lt;br&gt;&amp;quot;Hi&amp;quot; | &amp;amp; { begin { &amp;quot;Beginning&amp;quot;} process { write-host &amp;quot;Boom $_&amp;quot; } end { &amp;quot;Ending&amp;quot; } }&lt;br&gt;&lt;br&gt;function foo { begin { &amp;quot;Beginning&amp;quot;} process { write-host &amp;quot;Boom $_&amp;quot; } end { &amp;quot;Ending&amp;quot; } }&lt;br&gt;&amp;quot;Hi&amp;quot; | foo&lt;br&gt;&lt;br&gt;We also support a shortcut for functions act on pipeline input -- called filters. &amp;nbsp;For an example, see the help topic, about_Filter.&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=699812" width="1" height="1"&gt;</description></item><item><title>re: Joel-On-Software on the power of a good language</title><link>http://blogs.msdn.com/b/powershell/archive/2006/08/02/joelonsoftware-on-the-power-of-a-good-language.aspx#693393</link><pubDate>Wed, 09 Aug 2006 18:50:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:693393</guid><dc:creator>Jason Gurtz</dc:creator><description>I had read the Joel on sw article and it's neat to see this real life example so soon after. &amp;nbsp;:)&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=693393" width="1" height="1"&gt;</description></item><item><title>re: Joel-On-Software on the power of a good language</title><link>http://blogs.msdn.com/b/powershell/archive/2006/08/02/joelonsoftware-on-the-power-of-a-good-language.aspx#692922</link><pubDate>Wed, 09 Aug 2006 07:42:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:692922</guid><dc:creator>lb</dc:creator><description>Love it!&lt;br&gt;&lt;br&gt;so this is an anonymous function that accepts a parameter called $x --&lt;br&gt;&lt;br&gt;{Param($x) Alert &amp;quot;Boom $x&amp;quot;}&lt;br&gt;&lt;br&gt;while *this* is a named function with a parameter called $x:&lt;br&gt;&lt;br&gt;Function PutInPot($x) {Alert &amp;quot;Boom $x&amp;quot;}&lt;br&gt;&lt;br&gt;and am i right trying to compare with ruby and saying that:&lt;br&gt;&lt;br&gt;{Param($x) Alert &amp;quot;Boom $x&amp;quot;}&lt;br&gt;&lt;br&gt;is similar to:&lt;br&gt;&lt;br&gt;{|x| Alert &amp;quot;Boom x&amp;quot;}&lt;br&gt;&lt;br&gt;---&lt;br&gt;and next guess: the anonymous function is going to accept piped in variables, where-as the function won't? (in its current form)&lt;br&gt;&lt;br&gt;lovin the pshell!&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=692922" width="1" height="1"&gt;</description></item><item><title>re: Joel-On-Software on the power of a good language</title><link>http://blogs.msdn.com/b/powershell/archive/2006/08/02/joelonsoftware-on-the-power-of-a-good-language.aspx#687334</link><pubDate>Thu, 03 Aug 2006 10:32:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:687334</guid><dc:creator>PowerShell Team</dc:creator><description>&amp;gt; How do you bind the Alert alias at definition time and not run-time? &lt;br&gt;&lt;br&gt;Runtime binding is one of the key features of Shells and other dynamic environments. &amp;nbsp;There are some huge advantages to it but there are some downsides as well. &amp;nbsp;In future releases, we expect to provide users the option to choose more static behaviour. &amp;nbsp;Alias binding is on the top of my list for this.&lt;br&gt;&lt;br&gt;Jeffrey Snover [MSFT]&lt;br&gt;Windows PowerShell/Aspen Architect&lt;br&gt;Visit the Windows PowerShell Team blog at: &amp;nbsp; &amp;nbsp;&lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/PowerShell"&gt;http://blogs.msdn.com/PowerShell&lt;/a&gt;&lt;br&gt;Visit the Windows PowerShell ScriptCenter at: &amp;nbsp;&lt;a rel="nofollow" target="_new" href="http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx"&gt;http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx&lt;/a&gt;&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=687334" width="1" height="1"&gt;</description></item><item><title>re: Joel-On-Software on the power of a good language</title><link>http://blogs.msdn.com/b/powershell/archive/2006/08/02/joelonsoftware-on-the-power-of-a-good-language.aspx#687152</link><pubDate>Thu, 03 Aug 2006 05:04:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:687152</guid><dc:creator>Mike S</dc:creator><description>PS &amp;gt;Set-Alias Alert Write-Host&lt;br&gt;PS &amp;gt; function SwedishChef ($food)&lt;br&gt;&amp;gt;&amp;gt; {&lt;br&gt;&amp;gt;&amp;gt; Alert &amp;quot;id like some $food&amp;quot;&lt;br&gt;&amp;gt;&amp;gt; }&lt;br&gt;PS &amp;gt; SwedishChef spag&lt;br&gt;id like some spag&lt;br&gt;&lt;br&gt;Good!&lt;br&gt;&lt;br&gt;PS &amp;gt; Set-Alias Alert gorb&lt;br&gt;PS &amp;gt; SwedishChef spag&lt;br&gt;Alias not resolved because alias 'Alert' referenced command 'gorb', this comman&lt;br&gt;d is not recognized as a cmdlet, function, operable program, or script file.&lt;br&gt;At line:3 char:6&lt;br&gt;+ Alert &amp;nbsp;&amp;lt;&amp;lt;&amp;lt;&amp;lt; &amp;quot;id like some $food&amp;quot;&lt;br&gt;&lt;br&gt;I personally hate this run-time name binding.&lt;br&gt;&lt;br&gt;How do you bind the Alert alias at definition time and not run-time?&lt;br&gt;&lt;br&gt;I dont know power-shell but I would think the syntax of what happened should be&lt;br&gt;PS &amp;gt; function SwedishChef ($food)&lt;br&gt;&amp;gt;&amp;gt; {&lt;br&gt;&amp;gt;&amp;gt; $Alert &amp;quot;id like some $food&amp;quot;&lt;br&gt;&amp;gt;&amp;gt; }&lt;br&gt;&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=687152" width="1" height="1"&gt;</description></item><item><title>re: Joel-On-Software on the power of a good language</title><link>http://blogs.msdn.com/b/powershell/archive/2006/08/02/joelonsoftware-on-the-power-of-a-good-language.aspx#686548</link><pubDate>Wed, 02 Aug 2006 18:31:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:686548</guid><dc:creator>Gantenbein</dc:creator><description>Nice to see that the PowerShell scripting language offers functional programming features like LISP or Haskell do.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=686548" width="1" height="1"&gt;</description></item></channel></rss>