Archive

Archive for April, 2009

Snippet Designer in April’s MSDN Magazine!

April 14th, 2009
Comments Off

I am excited to announce that the Snippet Designer is featured in the April issue of MSDN Magazine. 

msdnMag

 

 

 

 

 

 

 

 

 

It is featured in the Toolbox column where they highlight useful tools and blogs. Here is a snippet of what it says:

Creating Code Snippets is a lot easier when using Snippet Designer (version 1.1), a free, open-source Add-In for Visual Studio 2008 for creating and editing Code Snippets directly within the IDE. Once you install it, creating a new Code Snippet is as easy as going to the File menu and creating a new Code Snippet File.

 

That is so cool! If you are interested go and download the Snippet Designer from the Codeplex website and give me more feedback.

 

Also, in the same article my friend Sara Ford had her blog featured.  When I found out the Snippet Designer and Sara’s blog were in the magazine I quickly emailed to ask Sara if she knew about it.  She already did and also had an extra copy of the magazine for me!

Author: MattManela Categories: Personal, Snippet Designer Tags:

Snippet Designer in April’s MSDN Magazine!

April 14th, 2009
Comments Off

I am excited to announce that the Snippet Designer is featured in the April issue of MSDN Magazine. 

msdnMag

 

 

 

 

 

 

 

 

 

It is featured in the Toolbox column where they highlight useful tools and blogs. Here is a snippet of what it says:

Creating Code Snippets is a lot easier when using Snippet Designer (version 1.1), a free, open-source Add-In for Visual Studio 2008 for creating and editing Code Snippets directly within the IDE. Once you install it, creating a new Code Snippet is as easy as going to the File menu and creating a new Code Snippet File.

 

That is so cool! If you are interested go and download the Snippet Designer from the Codeplex website and give me more feedback.

 

Also, in the same article my friend Sara Ford had her blog featured.  When I found out the Snippet Designer and Sara’s blog were in the magazine I quickly emailed to ask Sara if she knew about it.  She already did and also had an extra copy of the magazine for me!

Author: MattManela Categories: Personal, Snippet Designer Tags:

Snippet Designer in April’s MSDN Magazine!

April 14th, 2009
Comments Off

I am excited to announce that the Snippet Designer is featured in the April issue of MSDN Magazine. 

msdnMag

 

 

 

 

 

 

 

 

 

It is featured in the Toolbox column where they highlight useful tools and blogs. Here is a snippet of what it says:

Creating Code Snippets is a lot easier when using Snippet Designer (version 1.1), a free, open-source Add-In for Visual Studio 2008 for creating and editing Code Snippets directly within the IDE. Once you install it, creating a new Code Snippet is as easy as going to the File menu and creating a new Code Snippet File.

 

That is so cool! If you are interested go and download the Snippet Designer from the Codeplex website and give me more feedback.

 

Also, in the same article my friend Sara Ford had her blog featured.  When I found out the Snippet Designer and Sara’s blog were in the magazine I quickly emailed to ask Sara if she knew about it.  She already did and also had an extra copy of the magazine for me!

Author: MattManela Categories: Personal, Snippet Designer Tags:

A functional take on console program loop in F#

April 14th, 2009
Comments Off

Often when learning a new technology I start with a simple console application in which the program is run in a loop it continues to prompt you for more input until you give some command like quit or exit or whatever you choose:

Enter input: someInput
someOutput
Enter input: otherInput
someoutPut
Enter input: quit
Thanks! Come again!

The code for this is in an imperative language is usually something like:

   1: while(true)
   2: {
   3:     Console.Write("\nEnter input:");
   4:     var line = Console.ReadLine();
   5:     if(line == "quit") break;
   6:     
   7:     doSomething(line);
   8: }
   9:  
  10: Console.WriteLine("Thanks! Come Again");

 

While reading some F# samples, I saw some code doing essentially the same thing which looked something like:

   1: Console.Write "\nEnter input:"
   2: let mutable input = Console.ReadLine()
   3: while input <> "quit"
   4:     do
   5:     
   6:     if input <> "quit" 
   7:     then
   8:         doSomething input
   9:         Console.Write "\nEnter input:" 
  10:         input <- Console.ReadLine()

 

Now this just feels dirty! In a functional language explicit loop constructs like a while loop feel wrong.  I different way of doing this which is more functional is to create an infinite list of actions.  Where each action represents one iteration of any of the above loops. Then you just execute each action until some condition is met (like seeing the input “quit”).

   1: let action = fun _ ->
   2:     Console.Write "\nEnter input: "
   3:     Console.ReadLine()
   4:  
   5: let readlines = Seq.init_infinite (fun _ -> action())
   6:     
   7: let run item = if item = "quit" 
   8:                 then Some(item) 
   9:                 else
  10:                     parse item 
  11:                     None
  12:  
  13: Seq.first run readlines |> ignore
  14: Console.WriteLine "Thanks! Come Again"

This code makes use of the Seq.init_infinite which create a infinite sequence and Seq.first which enumerates the sequence until the passed in function returns Some.

Author: MattManela Categories: F#, Programming Tags:

A functional take on console program loop in F#

April 14th, 2009
Comments Off

Often when learning a new technology I start with a simple console application in which the program is run in a loop it continues to prompt you for more input until you give some command like quit or exit or whatever you choose:

Enter input: someInput
someOutput
Enter input: otherInput
someoutPut
Enter input: quit
Thanks! Come again!

The code for this is in an imperative language is usually something like:

   1: while(true)
   2: {
   3:     Console.Write("\nEnter input:");
   4:     var line = Console.ReadLine();
   5:     if(line == "quit") break;
   6:     
   7:     doSomething(line);
   8: }
   9:  
  10: Console.WriteLine("Thanks! Come Again");

 

While reading some F# samples, I saw some code doing essentially the same thing which looked something like:

   1: Console.Write "\nEnter input:"
   2: let mutable input = Console.ReadLine()
   3: while input <> "quit"
   4:     do
   5:     
   6:     if input <> "quit" 
   7:     then
   8:         doSomething input
   9:         Console.Write "\nEnter input:" 
  10:         input <- Console.ReadLine()

 

Now this just feels dirty! In a functional language explicit loop constructs like a while loop feel wrong.  I different way of doing this which is more functional is to create an infinite list of actions.  Where each action represents one iteration of any of the above loops. Then you just execute each action until some condition is met (like seeing the input “quit”).

   1: let action = fun _ ->
   2:     Console.Write "\nEnter input: "
   3:     Console.ReadLine()
   4:  
   5: let readlines = Seq.init_infinite (fun _ -> action())
   6:     
   7: let run item = if item = "quit" 
   8:                 then Some(item) 
   9:                 else
  10:                     parse item 
  11:                     None
  12:  
  13: Seq.first run readlines |> ignore
  14: Console.WriteLine "Thanks! Come Again"

This code makes use of the Seq.init_infinite which create a infinite sequence and Seq.first which enumerates the sequence until the passed in function returns Some.

Author: MattManela Categories: F#, Programming Tags:

A functional take on console program loop in F#

April 14th, 2009
Comments Off

Often when learning a new technology I start with a simple console application in which the program is run in a loop it continues to prompt you for more input until you give some command like quit or exit or whatever you choose:

Enter input: someInput
someOutput
Enter input: otherInput
someoutPut
Enter input: quit
Thanks! Come again!

The code for this is in an imperative language is usually something like:

   1: while(true)
   2: {
   3:     Console.Write("\nEnter input:");
   4:     var line = Console.ReadLine();
   5:     if(line == "quit") break;
   6:     
   7:     doSomething(line);
   8: }
   9:  
  10: Console.WriteLine("Thanks! Come Again");

 

While reading some F# samples, I saw some code doing essentially the same thing which looked something like:

   1: Console.Write "\nEnter input:"
   2: let mutable input = Console.ReadLine()
   3: while input <> "quit"
   4:     do
   5:     
   6:     if input <> "quit" 
   7:     then
   8:         doSomething input
   9:         Console.Write "\nEnter input:" 
  10:         input <- Console.ReadLine()

 

Now this just feels dirty! In a functional language explicit loop constructs like a while loop feel wrong.  I different way of doing this which is more functional is to create an infinite list of actions.  Where each action represents one iteration of any of the above loops. Then you just execute each action until some condition is met (like seeing the input “quit”).

   1: let action = fun _ ->
   2:     Console.Write "\nEnter input: "
   3:     Console.ReadLine()
   4:  
   5: let readlines = Seq.init_infinite (fun _ -> action())
   6:     
   7: let run item = if item = "quit" 
   8:                 then Some(item) 
   9:                 else
  10:                     parse item 
  11:                     None
  12:  
  13: Seq.first run readlines |> ignore
  14: Console.WriteLine "Thanks! Come Again"

This code makes use of the Seq.init_infinite which create a infinite sequence and Seq.first which enumerates the sequence until the passed in function returns Some.

Author: MattManela Categories: F# Tags: