TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

J for C Programmers

71 pointsby sea6earover 10 years ago

14 comments

rebootthesystemover 10 years ago
I&#x27;m sorry, as someone who used APL professionally for about ten years J simply fills me with an urge to defecate. It is an absolute abomination. It left behind the power of notation as a tool for thought and turnd the concept of APL into a pile of giberish on a page.<p><a href="http://www.eecg.toronto.edu/~jzhu/csc326/readings/iverson.pdf" rel="nofollow">http:&#x2F;&#x2F;www.eecg.toronto.edu&#x2F;~jzhu&#x2F;csc326&#x2F;readings&#x2F;iverson.pd...</a> Where are APL and J? For the most part, dead. Sure there are people using them. If someone like me who used the language almost exclusively for ten years hasn&#x27;t touched it for two decades I think it is safe to say: Great language to learn. Powerful and fantastic concepts. But, no thanks. Happy with C, C++ and Python.<p>The failure to open source a good APL didn&#x27;t help either.<p>If J-Software wants to make a last valiant effort to bring this back my opinion is simple: Read the paper linked above and go back to the roots. Extend the language to make it object oriented and create interfaces to C, C++ and Python. That&#x27;s a start. I could write a paper on how to improve APL. It has to start with a commitment to moving software engineering into the realm of communicating through notation rather than cryptic text.
评论 #8605704 未加载
评论 #8607606 未加载
tailrecursionover 10 years ago
I&#x27;ve been struggling to learn J for a few weeks, and there are several things that make it difficult.<p>1) Lack of spaces in the majority of code make it difficult to lex let alone parse, meaning I can&#x27;t tell what the operators are. When people use spaces it makes a difference.<p>2) Every operator has at least two meanings. Some have three meanings. That&#x27;s more than 100 operators to memorize and 50 share the same spelling as the other 50.<p>3) The parsing rules as described strike me as extraordinarily complicated.<p>The ideas in APL are worth learning. For example striping objects and using grade up to make a concordance or annotate any other data structure. Another example is having the primitives auto-sort collections when searching to get nlogn complexity. Almost any language can use these ideas. If Python is one step up from Standard ML because of dicts and out-of-the-box primitives, then APL is one step up from Python.<p>If anyone who knows APL well is around, can I ask some simple questions?<p>1) Do user functions and if statements vectorize? Meaning, if I write a recursive function to implement Euclid&#x27;s GCD and then pass it two arrays, will it give an array of pairwise GCDs?<p>gcd(a,b) = if b=0 then a else gcd(b,a mod b)<p>where = and mod are both vectorized APL primitives.<p>2) Why do I see so few user functions being used? I would expect application code to consist mostly of specific functions but instead I see line after line of unbroken primitive operators.<p>(EDIT: fixed formatting.)
评论 #8605726 未加载
plaguuuuuuover 10 years ago
This is what Fibonacci looks like, apparently<p><pre><code> f1a=: 3 : 0 {. y f1a 0 1x : if. *x do. (x-1) f1a +&#x2F;\|.y else. y end. ) f1b=: {.@($:&amp;0 1x) : ((&lt;:@[ $: +&#x2F;\@|.@])^:(*@[)) </code></pre> I think I have PTSD already just from reading this stuff.
评论 #8606328 未加载
评论 #8606540 未加载
orbifoldover 10 years ago
I think the key idea behind APL and J is that they take one fundamental data structure, namely arrays of arbitrary rank containing characters, numbers or boxes, and define a number of operations on them, each of which has a natural mathematical definition and satisfies a number of laws. For example APL has at its core combinators ι ρ φ ⊤ , . \ &#x2F; and a number of binary and unary operators.<p>To give an example, &#x2F; is like fold in a functional programming language, so +&#x2F; would be fold (+) in Haskell, there fold (+) :: Foldable t, Monoid m =&gt; m t -&gt; t. However you would have a hard time implementing J like arbitrary rank arrays in Haskell efficiently and supporting all the operations it does.<p>The philosophy of J and K is to isolate the essential operations and laws the data structure you are trying to manipulate has and to implement an interpreter for those operations that is as efficient as possible. This is in contrast to a conventional general purpose language that tries to implement a sufficiently smart compiler and primitives to create new data types from a set of primitives ones. The problem is that it is quite hard and sometimes impossible to teach the compiler retroactively about all the nice properties your newly defined data structure has.<p>I believe several such domain specific interpreters&#x2F;compilers could be &quot;stitched together&quot; into a general purpose language, maybe integrated by a system specialised in symbolic computation. Instead of compilation to machine code the top level system would compile down to the base operations for each data structure and simplify according to the laws the base operations satisfy. Haskell and many other do that by compiling down to a Core language and then applying a huge number of simplification passes on that intermediate language.
DennisPover 10 years ago
Now I&#x27;ve gone and installed J and started playing around. I&#x27;m doomed.<p>Just the most basic stuff is pretty nifty: <a href="http://www.jsoftware.com/help/learning/01.htm" rel="nofollow">http:&#x2F;&#x2F;www.jsoftware.com&#x2F;help&#x2F;learning&#x2F;01.htm</a>
barbudorojoover 10 years ago
Perhaps the hope with J was that symbols could create a grammar for concepts. In maths we use intuition to define an integral as a certain kind of summation, a progressive difference as a certain kind of derivative, and so on. I was thinking that perhaps J symbols could create some form of grammar that suggest new concepts from primitive ones. But the language for me don&#x27;t provide me with that kind of thinking and at the end is simply a way of writing code that is cryptic and difficult to understand. The idea of using a language with automatic vectorization is orthogonal to the syntax of J.<p>Haskell is different, the concepts of monad, category and so on allow you to obtain a higher order view of your ideas, to frame them in a different concept, that is experience that expand your concept of programming, I don&#x27;t experiment that feeling with J, I paid the price to learn the vocabulary and grammar, but I don&#x27;t think the language is worth the effort.
评论 #8607882 未加载
yummyfajitasover 10 years ago
A question. I&#x27;ve played with J a bit, but I haven&#x27;t had the &quot;burst of enlightenment&quot; that some suggest will come (ala lisp&#x2F;haskell&#x2F;etc).<p>My hypothesis based on a few conversations: the &quot;burst of enlightenment&quot; is treating problems like &quot;applied math&quot; rather than computer science. I.e., &quot;first represent as a vector, then do linear algebra, iterate this process until &lt; epsilon&quot;. Since I already do this in Python&#x2F;Julia&#x2F;Mathematica, J just feels like a variant with esoteric syntax.<p>Possibly my problem is that I&#x27;m simply programming Python in J. Can anyone with deeper knowledge of J confirm&#x2F;deny this?
评论 #8609037 未加载
jimrandomhover 10 years ago
I am convinced that the J programming language is an elaborate hoax. I just don&#x27;t understand how anyone is falling for it.
评论 #8606668 未加载
评论 #8606018 未加载
ryan-cover 10 years ago
As someone who likes perl, this frightens me. It seems like an esolang, is it really intended for productivity?
评论 #8606368 未加载
评论 #8606135 未加载
NaNaNover 10 years ago
I thought it was a J library for C when I saw this title. Anyway, I think APL&#x2F;J&#x2F;K is the real geek code (and its syntax will be forgotten sooner than Perl syntax if you don&#x27;t use it often. ;)
toolsliveover 10 years ago
Greg Wilson (from the &#x27;Making Software&#x27; book) has been claiming the cost of building software is rather constant, regardless the programming language. The formula seems to be &quot;one can build and maintain 10 lines of code per hour&quot;.<p>If this holds for J, K, APL we should all be doing that.
ameliusover 10 years ago
&gt; Writing code in a scalar language makes you rather like a general who gives orders to his troops by visiting each one and whispering in his ear.<p>Well, actually, I use for-loops for that, thank you :)
评论 #8608404 未加载
AnimalMuppetover 10 years ago
Interestingly, we just had an article on HN that complained about the amount of mental RAM that C++ takes nowadays. I can&#x27;t imagine that J takes less.
inquistover 10 years ago
I find this hilarious.
评论 #8608534 未加载