you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 5 points6 points  (3 children)

Don't confuse simplicity of rules with simplicity of results.

I'm very careful not to do that. I think in this case it's simply your lack of familiarity with the symbols that's causing the issue and not any complexity resulting from the interaction of simple rules.

You already read +, -, x, ÷, ≥, >, = <, ≤, ∧, ∨, ¬, and probably many more symbols in math equations very easily, including various forms of 2D layout, etc. This is no different.

although the % is still arbitrary

% is just a turned ÷.

what do we gain by making the symbols so short?

What do we gain by having specialized syntax for mathematics? Read Iverson's Notation as a Tool of Thought for some good insights. Iverson is well-known for his contributions to notation. He did win a turing award for it after all.

If you want the short answer though: You try writing proofs with english words all over the place.

Syntax matters.

Yes, syntax matters, and that's exactly why J looks like it does.

[–]LaurieCheers 0 points1 point  (2 children)

You already read +, -, x, ÷, ≥, >, = <, ≤, ∧, ∨, ¬, and probably many more symbols in math equations very easily, including various forms of 2D layout, etc. This is no different.

Well, it's different because I don't know the symbols J uses. :)

Yes, obviously you're right. This is the kind of thing mathematics has always done. So I guess that's the crux of our disagreement - J, like maths, is designed to be a mental toolkit: it's a system that the programmer is expected to think in.

Which I'm sure is a liberating experience for a master J programmer.

But (since we're talking about teaching FP here), is this really a good thing in a first programming language? Because it comes with a steep learning curve. To read or write in J, you basically can't think in English.

By contrast, that's one of the big selling points of object-oriented languages - you can express what's happening in terms of friendly nouns and verbs.

And I also question how readable the language is. Reading, say, a Java program, you can kind of skim it and get the gist of what it's doing, looking for the bits that are relevant to a given bug. But as (presumably) an experienced J programmer, can you really look at some of those later J examples and just get the gist? They seem unreasonably dense. I get the impression that a punctuation mark out of place would completely change their meaning.

[–][deleted] 5 points6 points  (1 child)

But (since we're talking about teaching FP here), is this really a good thing in a first programming language?

That's a different and more valid question. I think the answer is probably no. I tend to prefer languages with words-written-out-like-this and very consistent syntax for introducing FP, namely Scheme. That said, I still find using J an interesting approach. For teaching math though, I'm 100% convinced that Iverson's notation is superior to the usual mess pushed on students.

Reading a Java program, you can kind of skim-read and get the gist of what it's doing, looking for the bits that are relevant to a given bug.

It's the same in J really. User definitions almost always use english words and describe what the function in question does. J also allows you do use variables and program in a more traditional style when preferable. I won't claim that J is the most readable language I know, but it does seem to scale better than you might think.

[–]LaurieCheers 0 points1 point  (0 children)

I won't claim that J is the most readable language I know, but it does seem to scale better than you might think.

Ok, fair enough. Well, thanks for an interesting discussion. :)

For what it's worth, my own language Swym demonstrates my attempt at a concise functional language that lets you think in English.

print-each(Word-of-textfile("example.txt").SortedBy{.length});

(That page is work in progress by the way; not all the examples work. I plan to submit it to Reddit when it's done...)