Welcome to The Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads

Programming With J/k/apl


xafizzle
 Share

Recommended Posts

So I've been starting to brush up on my programming and practice a bit and I've been doing this through projecteuler.net

 

It's a cool site that gives you mathematics problems to solve and when you solve a problem, you can view the forum for that problem showing all the ways people programmed it.

 

It ranges from the C++ and Java all the way to Assembly, Lua.

 

Anyway, while I was going through the forums for some of the problems, I came across a language called J. I was amazed because not only did it make no sense at all, but it needed only one line to perform a task that would take Java 10 lines.

 

It's a really strange language that utilizes tacit programming and function composition to make code, although dense, very short. It also makes use of every ASCII character to mean a word. For example, where a ( ) only make sense in java in for and if loops, the ( symbol represents a whole word. Loops almost never have to be specified because they are built into the way that functions are applied to arrays and functions are first class objects.

 

A few examples of it: http://www.jsoftware.../SimpleExamples

 

The only downside to languages like these are that no one understands them, making them useless. For example, someone proficient in Python should still be able to understand the goal of a Ruby program. But with programming languages like J, K, and APL, unless you're an expert at that specific language, you can't tell anything of it.

 

 

But it does make me wonder if programming languages like these will ever be more popular. It would seem that brevity in code would be the goal of all programmers, yet these languages are sparsely used. So what is it about these languages that deters the majority of programmers?

Link to comment
Share on other sites

...but it needed only one line to perform a task that would take Java 10 lines.

 

Sounds a little like jQuery is to Javascript.

 

jQuery (Shortened)

<a id="gone" href="#">Now you see me... now you don't!</a>

<script>
window.onload = function(){
$("#gone").click( function(){
 $("#gone").hide();
});
}
</script>

 

Javascript

<a onclick="hide" id="gone" href="javascript:void(0);">Now you see me... now you don't!</a>


<script>
function hide() {
   document.getElementById('gone').style.visibility = 'hidden';
}
</script>

Link to comment
Share on other sites

Sounds a little like jQuery is to Javascript.

 

Nah, JQuery is still the same language just an extension or required library. They essentially just added more native functionality, whereas what he is referring to is the language itself naively is brief. A more accurate example would be comparing C# to traditional C/++. Over the years the base language has remained largely the same, however, they have expanded upon it to be more functional and take less steps to solve problems naively. But, in regards to the thread, I wouldn't really put any time into this language besides for your own personal experimentation. I don't believe you will find any real world examples where the language would be preferred over others.

Edited by Papa John
  • Like 1
Link to comment
Share on other sites

I understand that but I'm wondering why. I know it's useless because no one uses it and no one can understand it, but why hasn't it caught on? Such an efficient language would seem like me to be ideal

 

I believe you answered your own question, just because it appears to have more efficient nomenclature doesn't mean it is necessarily efficient from a processing point of view. At the end of the day everything, besides scripting languages, is compiled to the choosen architecture's machine language.

Edited by Papa John
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share