Live data from Hacker News

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

scottlocklin.wordpress.com

61–70 of 70 posts

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

#61

Earlier quoted context omitted.

I struggled a lot too. I think the main issue is the problem domain in which these languages excel at. I like compilers, systems programming, distributed systems... but math? statistics? I'm admittedly terrible at that and find it really uninteresting. It doesn't help that most literature on J tries to teach its language concepts showing you how to solve math problems. I have no need for a fancy calculator. For what…

My general belief is that these languages would be far more useful as embedded languages; occasionally there is a need for the core of some complicated system to take advantage of their power, but the same design that makes them good at math makes them horrible for writing APIs or database access.

What makes them bad for APIs or databases? Both k and q are very practical general purpose languages (J and APL less so) that would be an appropriate choice for almost any kind of app, imo.

q especially looks mostly like a normal procedural language, and can be used like one too.

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

#62
post #31

Earlier quoted context omitted.

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 prefet…

If there was a time for array languages, it would be now. I would argue that most programming nowadays is about manipulating arrays of data.

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

#63
post #51
post #16

Earlier quoted context omitted.

The first time I watched the video my response was that he was literally doing magic or that it was some sort of joke. Over time the video has become more approachable and I have a pretty good idea of what is going on. However, if I was asked to approach game of life in APL myself then I think I would still be pretty lost.

It's a kind of sleight of hand. It purports to be showing off the power of APL; what it's really showing off is the cleverness of someone who realized that the rules of Life could be expressed as a series of array operations. APL has a kind of mystique, but all it really is is a bunch of NumPy functions with a quirky DSL (of course, APL came first and heavily inspired NumPy). But we've quietly been doing the APL expe…

Lisp has April, which I thought was pretty cool. https://github.com/phantomics/april

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

#64

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…

I have a hard time understanding where apl/j/k maintenance costs could be higher than java / c#

As A. Hsu say, a java method name is long enough to encode a complete algorithm. the drag of having to maintain MLoC of boilerplate with all the opportunities for bad naming, bad style, NPE and such is so huge.

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

#65
post #58

Earlier quoted context omitted.

> I do wish we had some better cross-platform solutions though, instead of cementing nVidia's hegemony. There's no technical reason why GPGPU should be any more difficult on AMD hardware. Then look no further than GPUCompiler.jl. Tim factored out all the platform agnostic parts of CUDA.jl (successor of CuArrays.jl and CudaNative.jl) into GPUCompiler.jl and that is now being used by the AMDGPU.jl package. It works tod…

Thanks! I had hit some of those pages before, but their ontology isn't immediately obvious, so thanks for the clarification. In particular I've definitely looked at AMDGPU.jl recently, but as the page says: "not all features (and especially performance) are up to par with CUDA.jl" - hence my impression of AMD being a second-class citizen. Still, it's great that we have anything at all, and I'm extremely grateful for…

> In particular I've definitely looked at AMDGPU.jl recently, but as the page says: "not all features (and especially performance) are up to par with CUDA.jl" - hence my impression of AMD being a second-class citizen.

That just takes developer time to fix. Currently it’s basically just a one-man show.

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

#67
post #52
post #43

Earlier quoted context omitted.

If your primary interest is in parallel code that runs on a GPU, and not autograd features of Pytorch/Jax, take a look at CuPy: https://cupy.dev/

That's extremely cool. Julia has something very similar, in the form of CuArrays [0]. I do wish we had some better cross-platform solutions though, instead of cementing nVidia's hegemony. There's no technical reason why GPGPU should be any more difficult on AMD hardware. [0] https://github.com/JuliaGPU/CuArrays.jl

OpenCL was pretty good in this a few years ago. I had some kernels which ran across AMD and Nvidia GPUs as well as many core Xeon systems without changing anything. To squeeze the highest performance out, you still had to tune for the device, but it was a great start.

Now, all vendors seem to have dropped support for OpenCL, though it will live on nicely in PortableCL, which implements it atop LLVM, allowing it to target anything LLVM does, which finally goes further to achieve the open-ness the original standard aspired to, than the vendors themselves at the time.

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

#68

The TSDB is now called 'jd'[0] FWIIW. Funny, I've been using J on and off since then and I'm still not sure if it's genius or insane. It, along with the other APLs, is definitely its own thing, just as much as Lisp is (my previous favorite weird language was Yann LeCun and Leon Bottou's "Lush,"[1] which I continue to think is an amazing design). Once you get a little bit proficient at it, you finally realize what an…

Monument has had great experiences with J. It is fast, runs everywhere, and it is great for data handling and algorithmic dev. Monument runs on an extended version of J that is implicitly parallel, which enables devs to focus on math rather than optimizing C code.

Yes -- it runs super fast!

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

#69

Earlier quoted context omitted.

I struggled a lot too. I think the main issue is the problem domain in which these languages excel at. I like compilers, systems programming, distributed systems... but math? statistics? I'm admittedly terrible at that and find it really uninteresting. It doesn't help that most literature on J tries to teach its language concepts showing you how to solve math problems. I have no need for a fancy calculator. For what…

My general belief is that these languages would be far more useful as embedded languages; occasionally there is a need for the core of some complicated system to take advantage of their power, but the same design that makes them good at math makes them horrible for writing APIs or database access.

APL isn't always written (⊂∘⍋⌷⊢), APL has a traditional notation which is like other procedural languages:

    :If databaseResult.Rows.Count > 5
    :AndIf warnOnLargeData
        
        :For Row :In databaseResult.Rows

            logToFile 'Careful, that's a lot of data, e.g. ', Row[1]

        :EndFor
    :EndIf
and Dyalog APL is a .Net language, which has extended this style with :Namespace and :Class and :Access and :Signature ways to build objects and methods to make your API and export it as a .DLL for use by other .Net languages, or plugin to ASP.Net and make a web service[1], or accessing most things C# can[2], e.g. if you want to use a System.Collections.ArrayList it's right there:

          ⎕USING←'System' 'System.Collections'
          arr←⎕NEW ArrayList
          tmp←arr.Add ⊂'Test'
          tmp←arr.Add ⊂'Hello'
          tmp←arr.Add ⊂'World'
          arr[0 1 2]
    ┌────┬─────┬─────┐
    │Test│Hello│World│
    └────┴─────┴─────┘
          arr.RemoveAt 0
          arr[0 1]
    ┌─────┬─────┐
    │Hello│World│
    └─────┴─────┘

and that means things like System.Data.DataTable and SQL Connections for your database access. .Net isn't as popular as JavaScript and Rust, but it is a pretty large, stable, capable and established ecosystem to be able to hook into.

The core of APL symbols more or less /are/ an embedded language in the wider APL, just that wider APL is not showy for codegolf and is not unusual and pretty symbols, and you can't use it /without/ the symbols.

[1] See the examples shipped in the install folder like "C:\Program Files\Dyalog\Dyalog APL-64 18.0 Unicode\Samples\asp.net\webservices\"

[2] I expect not /everything/ C# can; C# is the first-class .Net language, but if you have things written in C# you can use them.

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

#70

Is J fast enough for image processing? I have to do all of my experiments in C because every other language is just too slow.

Perhaps you should try Single Assignment C (SAC), it's a fast array based language with C/Algol syntax but it's proprietary though.

http://www.sac-home.org/doku.php

Post reply on HN