Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

APL/J/K/NIAL

Name: Anonymous 2011-01-08 13:31

What's so special about array languages? When I look at them all I see is a decent Math library on top of a rather poor and antiquated language. On Wikipedia and sites of those languages people rave about how much more concise than other languages they are and how learning them expands your horizons and makes you a better programmer but except for higher order functions, which may have been special at the time APL was invented, but now are present in almost every modern language, I don't see any features that come close to what Haskell, ML, Scala and the likes offer.
Am I missing something?

Name: Anonymous 2011-01-08 15:51

>>1
Look at it this way.

Consider a language like Scheme with no implicit partial application. Instead of writing something like map (+ 1), you have to write:

  (lambda (xs)
    (map (lambda (y) (+ 1 y)) xs))


Of course you can write a curry or partial function that makes this less verbose, but it still has to be an explicit function call. You can't just express it with syntax. In this way, Haskell is more expressive than Scheme.

J (I can't speak for the others) takes this a step further.

Now consider the Haskell functions liftA2 and liftM2. You can use either of these on functions as if they were defined as follows:

liftOp2 f a b = \x -> a x `f` b x

In J, these semantics are invoked implicitly whenever two functions are passed as arguments to an operator that normally expects scalars or arrays. This is only one example of the many implicit type promotions that make J very expressive when writing functions. You can implement much of this in Haskell, but it's painful (at least with Haskell's standard library) and the error messages you get are no better than J's reclusive "syntax error".

Still, this isn't that abstract, since it's still dealing with real things in the real world. Many believe that in this world, there are those things that are true, and those that obviously aren't. This divides reality into two extremes: truth and falsehood. But, since we have two extremes, logically one can imagine a boundary between those two extremes - the border between truth and lies. If one were to manipulate this border, suddenly things that were pure fantasy (flying pigs, for the sake of argument) have become reality - or things from reality have ceased to exist. This is how Yukari is said to have invaded the moon - by manipulating the border between truth and lies, as applied to the reflection of the moon on a pond, she was able to make the reflection of the moon into a manifestation of the actual moon, and so send her youkai army onto it. This is what's truly amazing about Yukari's power - the ability to manipulate the border between completely abstract concepts allows her to fundamentally change reality as we know it (at least in terms of two abstract concepts).

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List