I like using functional methods in Java to implement DSLs but the guava docs are right when they say you shouldn't be ashamed to use a for loop from time to time in Java.
Learning Haskell/Python makes you a worse C# programmer
21–30 of 64 posts
Re: Learning Haskell/Python makes you a worse C# programmer
#22TLDR: C# 2.0 had ugly syntax. article from 2006 in c#3.0 we write string.Join("\n", mylist.Select(x=>x.Description()).Where(x=>x != "").ToArray()); and now string.Join("\n", mylist.Select(x=>x.Description()).Where(x=>x != ""));
Re: Learning Haskell/Python makes you a worse C# programmer
#23People should not be so eager to jump to the new functional constructs in C# to proof it can be cool too. There is no shame in imperative programming, it has its own advantages and can be pretty too. In this case, just using C# a bit more idiomatically can go a long way: var descriptions = new ArrayList(mylist.Length); foreach (var foo in myList) { if (foo.Description == "") { continue; } descriptions.Add(foo.Descrip…
Here's a slightly more idiomatic C# 2.0 (i.e. sans var goodness)
ArrayList descriptions = new ArrayList(mylist.Length);
foreach (Foo foo in myList)
if (foo.Description != "")
descriptions.Add(foo.Description);
return String.Join("\n", descriptions);Re: Learning Haskell/Python makes you a worse C# programmer
#24Earlier quoted context omitted.
I'll see your Perl5 and raise you some Perl6: @list.map(*.description).grep(?*).join("\n")
That is starting to look more like J or K than Perl. Is the Perl 6 team still considering syntax changes? If so, any thought on making map/grep/join operators?
Instead of chaining methods, one could also use
# p5 style
join "\n", grep ?*, map *.description, @list;
# dataflow style
@list ==> map *.description ==> grep ?* ==> join "\n";
join "\n" Re: Learning Haskell/Python makes you a worse C# programmer
#25TLDR: C# 2.0 had ugly syntax. article from 2006 in c#3.0 we write string.Join("\n", mylist.Select(x=>x.Description()).Where(x=>x != "").ToArray()); and now string.Join("\n", mylist.Select(x=>x.Description()).Where(x=>x != ""));
A method named 'where' seems really odd.
Re: Learning Haskell/Python makes you a worse C# programmer
#26Re: Learning Haskell/Python makes you a worse C# programmer
#27Earlier quoted context omitted.
Note that this article is from 2006 . Hence his using of C# 2.0 instead of a later version which includes Linq.
Linq, which was inspired by ... Haskell! Would it be irresponsible to speculate that this article is directly responsible for the inclusion of Linq in C#? It would be irresponsible not to speculate!
http://research.microsoft.com/en-us/um/people/emeijer/papers...
Re: Learning Haskell/Python makes you a worse C# programmer
#28It is unfortunate, that the type of positions that employ .NET developers, enforce C# (or sometimes VB.NET) as their language that targets the CLI. While I understand the need for consistency, it would be nice if IronPython or F# were accepted. But dont just feel defeated, make a case to your architect or manager, they might be open to it. However its worth noting that in my experience, C# is a fine language - especi…
Java developers are sold to customers as expert .NET consultants, because on management eyes C# is just like Java! :(