HNHacker News
TopNewBestAskShowJobs

xi

141 karma · joined May 24, 2010

The author of PyYAML, LibYAML, HTSQL, DataKnots.jl, PrettyPrinting.jl, and FunSQL.jl.
submissionscomments
xi··on Haskell and the "foul stench of cargo cult mathematics"
It's called defaulting:

http://www.haskell.org/onlinereport/decls.html#sect4.3.4

In my opinion, though it wasn't me you asked, it's an ugly workaround for Haskell's lack of proper coercion rules.

xi··on Haskell and the "foul stench of cargo cult mathematics"
I find myself wondering if this is getting upvoted by Haskell contrarians who aren't actually reading the article and noticing that it not about Haskell "being too mathematical", but not being out-of-the-box suitable as a really convenient ring theory explorer.

I love how you, in the same sentence, managed to put in doubt credibility of the upvoters and downplay the issue in hand.

To answer your question: yes, I actually read the article. Why I upvoted it? Haskell's way of wrapping integer literals with implicit `fromInteger` seems to be a clever hack that alleviates some pain when dealing with basic arithmetics, but I always wondered what kind of unexpected problems it may cause. I got an answer in this article.

xi··on Charming Python: Functional programming in Python
Syntax. Strict indentation rules do not allow using a block of code in an expression.
xi··on Haskell Researchers Announce Discovery of Industry Programmer Who Gives a Shit
Even assuming independence from the debug output, `putStrLn` may fail or block, which breaks referential transparency.
xi··on Haskell Researchers Announce Discovery of Industry Programmer Who Gives a Shit
I'm not arguing that there are no ways to debug Haskell programs. My point was that the OP's phrase indicates at least basic familiarity with Haskell and debug printing might be the thing he had in mind writing it.

Haskell's not like other languages, where you have to build up massive unreadable piles of code to get anything done.

That's fanboyism. I understand you feel offended by the OP's post, but it is not a good satire unless it offends somebody, and IMO, the article is excellent in summarizing attitudes of some members of the Haskell community. ;)

xi··on Haskell Researchers Announce Discovery of Industry Programmer Who Gives a Shit
You can't inject 'print' or 'printStrLn' into a random function, which is the point of debug printing. And using 'Debug.Trace' qualifies perfectly as subverting Haskell's type system.
xi··on Haskell Researchers Announce Discovery of Industry Programmer Who Gives a Shit
I disagree. For instance, debug printing is a very common pattern in many languages.
xi··on Haskell Researchers Announce Discovery of Industry Programmer Who Gives a Shit
When somebody tosses around phrases like how to subvert Haskell's type system to accomplish basic shit you can do in other languages, it's a big red flag that they've never used Haskell, and possibly have never even seen Haskell code.

IMO, it proves exactly the opposite; a person could never say it unless they at least tried to write some Haskell code.

xi··on First Impressions of Python from a Java Developer
Just like semantic indentation, ":" is ABC's heritage. It was discovered that newbie programmers comprehend block operations better when they end with ":".

http://python-history.blogspot.com/2009/02/early-language-de...

xi··on Python 2.7 released
2.7 is the last major release of the 2.x series. The goal was to ease transition to 3.x by backporting some of the features and provide a stable base for people unable or unwilling to jump to 3.x.
xi··on MultiMethods for Python
I wonder how Clojure deals with ambiguities when dispatching by arbitrary predicates. Also in this case, the overhead of of generic call will grow linearly with the number of methods, right?

In Python, you could limit generic dispatch to argument type only without losing generality since you could override the `isinstance` operator. For instance, you could define a `const()` type so that `isinstance(x, const(100))` is true if and only if `x == 100`. Then your example could be written in Python as:

  foo = generic()

  foo.when(const(0))
  def foo_0(x): print "passed in zero"
  foo.when(const(100))
  def foo_100(x): print "passed in 100"
  foo.when(const(200))
  def foo_200(x): print "passed in 200"
  foo.when(int)
  def foo_default(x): print "passed in", x
This is not as elegant as in a language with native support for generic functions, but it works. I wish mainstream languages started to adopt multi-methods; it's conceptually very simple and much more extension-friendly than traditional OOP. Sadly it doesn't seem to happen.
xi··on MultiMethods for Python
Multi-methods are not overloaded functions (in the C++ sense). You are correct that overloaded function calls are resolved at compile-time while multi-method calls are resolved at runtime, but if you want to make a C++ analogy, you'd better compare them to virtual methods. Multi-methods work almost like virtual methods, with two exceptions:

1) multi-methods are declared outside the class definitions; it is important since it allows you to extend a class without directly modifying its definition or implementation.

2) virtual functions do dispatch by one argument (`this` in C++) while multi-methods could perform dispatch by an arbitrary number of arguments.

That said, I don't like this implementation that much since it does not respect class inheritance. Suppose you defined a MultiMethod with two registered implementations, for class A and class B, where B is inherited from A. Then the result of the multi-method call with an object of type B is undefined. A proper multi-method would call the most specific implementation in this case.

xi··on Common False Beliefs in Mathematics
We could also notice that UW+VW is a subspace of (U+V)W, and therefore the following statement is valid:

dim(U+V+W)<= dim(U)+dim(V)+dim(W) - dim(UV)-dim(UW)-dim(VW) + dim(UVW).

So the result is weakened, but not entirely lost.

xi··on Common False Beliefs in Mathematics
It is explained in the comments: take three different lines in the plane, and you'll get 2=3.
xi··on Advanced programming languages
Python is as strongly typed as Scheme; 1+"1" will produce an exception in Python.
← PreviousPage 2 of 2