Learning Haskell/Python makes you a worse C# programmer
lukeplant.me.uk
Learning Haskell/Python makes you a worse C# programmer
1–10 of 64 posts
Re: Learning Haskell/Python makes you a worse C# programmer
#2You can even remove functional from the sentence. Powerful features of languages like Python and Lisp don't get you more power than languages like Java. They give you more power per unit of effort.
Re: Learning Haskell/Python makes you a worse C# programmer
#3 join "\n", map { $_->{description} } grep { $_->{description} ne "" } @mylist;
sorry, every time i see something like this, i just can't resist to post code in Perl. =)Re: Learning Haskell/Python makes you a worse C# programmer
#4in 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
#5Or in perl: join "\n", map { $_->{description} } grep { $_->{description} ne "" } @mylist; sorry, every time i see something like this, i just can't resist to post code in Perl. =)
Re: Learning Haskell/Python makes you a worse C# programmer
#6Re: Learning Haskell/Python makes you a worse C# programmer
#7 string.Join("\n",
from elem in myList
where elem.Description != ""
select elem.Description);
Note how mind-numbingly close this is to the Python: "\n".join(foo.description() for foo in mylist
if foo.description() != "")
I also think it's considerably easier to read than the foreach loop.Re: Learning Haskell/Python makes you a worse C# programmer
#8It 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…
We just allowed some F# code into Kiln. On the one hand, it was vastly simpler than the C# code it replaced. On the other hand, we had to rearchitect our solution layout to handle changing the build order, which we in turn had to do so that the F# code could be sanely usable from the C# code and vice-versa, which in turn required writing a lot of call-site boilerplate and type converters (from C# to F# types). Add in that the CLR is simply not as optimized for F# as for C# (or vice-versa, depending on how you want to view things), and it's not exactly a situation where you can simply say, "Well, F# is better than C# at expressing this problem, so let's use it here."
I want to be really clear on this: I don't think these problems are any worse on the CLR than they'd be on the JVM or with native tools (e.g., OCaml calling C or vice-versa). In fact, they're better in many ways: you have the BCL for your primitives, rather than the native C ABI (for native), and you have a VM that is legitimately much less tied to an individual language than the JVM, which makes things like tail-recursive languages a lot simpler. But I think the right way to regard Foo# languages is more-or-less the same as any other language: unless you can write the entire project in Foo#, think hard about whether the cost of interfacing between Foo# and C# is worth it to your project. Most of the time, it isn't.
Re: Learning Haskell/Python makes you a worse C# programmer
#9But if you've learned a whole range of languages you'll try to come up with more elegant solution. He tried that, but as gecko pointed out the errors were not in trying, but rather in his results.
I work in a C# dev house now, and boy what is considered a good solution there (and in their contractors works) is so sad I don't even know what to call it.
But then, you look at the latest c# version and it has quite a few interesting features, people just don't use it. My guess is that they've just been doing it since c# 2.0. And the fact that c# is not really made for web development, which is what it seems to be most taught doesn't really help either.
Re: Learning Haskell/Python makes you a worse C# programmer
#10Or in perl: join "\n", map { $_->{description} } grep { $_->{description} ne "" } @mylist; sorry, every time i see something like this, i just can't resist to post code in Perl. =)
@list.map(*.description).grep(?*).join("\n")