Live data from Hacker News

A look at the J language: the fine line between genius and insanity (2012)

scottlocklin.wordpress.com

31–40 of 70 posts

Re: A look at the J language: the fine line between genius and insanity (2012)

#31

Someone who was _very competent_ with J gave a demo of it at one of the Recurse Center (ne Hackruiter) _Brain Dump_ meetups back in the day and broke the crowd's collective brain. It might as well have been Brainfuck to all of us, but the proof was in the ... STDOUT. I believe they were demonstrating the standard factorial, map/reduce, etc. sorts of solutions you'd expect, but I remember being shocked by the small am…

There's a very elegant Haskell quicksort implementation that misses out on performance because it's not in-place. It's frequently used as a demonstration. The performant version looks as bad as C. I'd be more interested in a J/K demonstration that plays to the language's strengths. How about live-commentating e-sports? * Player gets first blood. Commentator executes search query in J across DB. * "We've seen $PLAYER_…

Idiomatic K solutions (and from what I hear, J as well) tend to be faster than idiomatic C solutions to the same problems.

It originally seemed like magic to me, but really - there is no magic. It is simpler in K and J to process more things, in more stages, but with completely predictable and very pipelineable operations. The J/K program often does 2 or 4 times as many operations, but has virtually everything prefetched to L1 before it’s needed so it runs as fast or even faster.

CPUs are constantly converging towards the K model (GPUs were always there).

Re: A look at the J language: the fine line between genius and insanity (2012)

#32

J seems like a language I should learn using flash cards. Make a flash card for each character, for each operation, and just learn all the operators, and then I will know J. Any truth to this? I suppose it might be like telling someone, "you know conditionals and loops, now you know how to program!"

In my experience -- flash cards might help a little, but writing code is the only way to internalize it. Read the books/tutorials and follow along until your feet are a little wet.

Keep in mind that it's not just about the verbs (operators) in isolation, it's also about sentence structure. While you can get quite far in the language without learning how to write a fork or a hook (two related ways of combining verbs), it will be near impossible to read someone else's code until you practice these forms yourself.

Having said that, if you're anything like me you will have the NuVoc page [1] open basically all the time while writing or reading J. It's hard to keep them all straight, esp. the verbs that you don't use very often.

[1] https://code.jsoftware.com/wiki/NuVoc

Re: A look at the J language: the fine line between genius and insanity (2012)

#33

J seems like a language I should learn using flash cards. Make a flash card for each character, for each operation, and just learn all the operators, and then I will know J. Any truth to this? I suppose it might be like telling someone, "you know conditionals and loops, now you know how to program!"

Definitely no; I tried something similar with the J dictionary. The right way to learn is to go through "J for C programmers" (it comes with the language), or just grab NuVoc[0] and start writing code for something non trivial. Labs can also help for areas you're not familiar with. Its the composition in J which carries meaning; and stuff like hooks and forks (more or less, writing J AST's directly) make it non-obvious in early days.

[0] https://code.jsoftware.com/wiki/NuVoc

Re: A look at the J language: the fine line between genius and insanity (2012)

#34
post #12

Earlier quoted context omitted.

APL and J are different between themselves (I started with APL but jumped into J) like FORTRAN and C are... What is your point?

But do they implement the same programming paradigm, or is there any fundamental differences For example, C# and Java implement the same paradigm , they are different, many argue which provide a better set of feature, but I would not call the differences fundamental C#, F#, implement completely different paradigms F# and Clojure, same paradigm, but have fundamental differences, F# being static and come from the ML fa…

That is what I was meaning, to me C and FORTRAN are mostly "the same" except at a surface level, and FORTRAN has multidimensional arrays and regions (a slight abstraction that can help the compiler, in particular, for automatic parallelization of loops)

Re: A look at the J language: the fine line between genius and insanity (2012)

#35

J seems like a language I should learn using flash cards. Make a flash card for each character, for each operation, and just learn all the operators, and then I will know J. Any truth to this? I suppose it might be like telling someone, "you know conditionals and loops, now you know how to program!"

Definitely no; I tried something similar with the J dictionary. The right way to learn is to go through "J for C programmers" (it comes with the language), or just grab NuVoc[0] and start writing code for something non trivial. Labs can also help for areas you're not familiar with. Its the composition in J which carries meaning; and stuff like hooks and forks (more or less, writing J AST's directly) make it non-obvio…

I couldn't find "J for C programmers" in my installation, but there seems to be more info here.

https://code.jsoftware.com/wiki/Books#J_for_C_Programmers

Re: A look at the J language: the fine line between genius and insanity (2012)

#36
post #9

I've learned a bunch of different languages[1], but J (and its friends APL and K) has been both the one that I don't feel I have the patience to learn AND the one that I feel like I might fall in love with if I actually learned it. The incomprehensible programs just seem to hint that there is some sort of maximal information density where every keystroke provides maximal productivity. There's also something artistica…

Have you learned Chinese, Japanese or Korean? Perhaps try classical Chinese.

Re: A look at the J language: the fine line between genius and insanity (2012)

#37

J seems like a language I should learn using flash cards. Make a flash card for each character, for each operation, and just learn all the operators, and then I will know J. Any truth to this? I suppose it might be like telling someone, "you know conditionals and loops, now you know how to program!"

In my experience -- flash cards might help a little, but writing code is the only way to internalize it. Read the books/tutorials and follow along until your feet are a little wet. Keep in mind that it's not just about the verbs (operators) in isolation, it's also about sentence structure. While you can get quite far in the language without learning how to write a fork or a hook (two related ways of combining verbs),…

I've been experimenting with flashcards that prompt me to write or solve some problem, versus the more common memorization usage. Not necessarily solving the same problem (write FizzBuzz in SomeLang) but maybe more complex (select a public web API with a JSON source, get the data, process it, and make a simple report). A way to reinforce understanding of different libraries or tools. I haven't figured out the scheduling on that in Anki yet, though. The same ratings can still be applied, even if it takes an hour to do it it's "how easy was that hour?" Did I have to pull open a lot of language and library references? Was I able to, without much effort, create the basic project template and start filling it out? Or did I have to look up the details on defpackage again?

Then combine that with more explicit memorization/recall cards like I use for Spanish. "In Common Lisp what non-destructive function filters a sequence based on a predicate?" "remove-if".

I think this should work well as a way to develop an understanding when paired with books/tutorials on the language and its libraries.

Re: A look at the J language: the fine line between genius and insanity (2012)

#38
Some of these languages are an excellent fit for specific problems. I still think an array based language is best for sql queries rather than set based. Any time you hear something like "select the first....", you don't want a set, you want an ordered list.

Plug: I wrote an open source version of q/kdb that runs on the JVM: https://github.com/timestored/jq

You can give it a try online in the browser here: http://www.timestored.com/jq/

Re: A look at the J language: the fine line between genius and insanity (2012)

#39
post #18
post #12

Earlier quoted context omitted.

But do they implement the same programming paradigm, or is there any fundamental differences For example, C# and Java implement the same paradigm , they are different, many argue which provide a better set of feature, but I would not call the differences fundamental C#, F#, implement completely different paradigms F# and Clojure, same paradigm, but have fundamental differences, F# being static and come from the ML fa…

APL and J are similar but for a pretty fundamental difference: APL has nested array theory while J is flat array theory. In practice, this does not make them that different to the user, except APL's model is arguably more elegant since it's "turtles all the way down" (J array elements are not array themselves). K on the other hand, is really different! K doesn't have true multidimensional arrays, but lists of vectors…

I see now your point. And as you say it does not make a lot of difference to the user. I have never used K.

Re: A look at the J language: the fine line between genius and insanity (2012)

#40

Earlier quoted context omitted.

In my experience -- flash cards might help a little, but writing code is the only way to internalize it. Read the books/tutorials and follow along until your feet are a little wet. Keep in mind that it's not just about the verbs (operators) in isolation, it's also about sentence structure. While you can get quite far in the language without learning how to write a fork or a hook (two related ways of combining verbs),…

I've been experimenting with flashcards that prompt me to write or solve some problem, versus the more common memorization usage. Not necessarily solving the same problem (write FizzBuzz in SomeLang) but maybe more complex (select a public web API with a JSON source, get the data, process it, and make a simple report). A way to reinforce understanding of different libraries or tools. I haven't figured out the schedul…

Good luck, I hope it works! Consider adding some flash cards with grammatical forms to mix in with your "character" cards. e.g. a monadic hook "(f g) y" is equivalent to "y f g y". And some short idiomatic phrases, e.g. "(#~ f) y" means -- approximately! -- "copy the values y_i of y wherever (f y_i) is true." You can find examples of these little phrases on the J wiki.
Post reply on HN