1

Many days ago, I saw this code on an open source community:

frq =: [:-.[:(2:|+/)\''''&= sp =: (#@[)([:<[}.[:>])"0 0[(]</.~[:+/\E.*.[:frq]), spf =: [:<[:([:','&sp[:-.&')'=&'('{"0 1,.&',')> cl =: #~[:-.e.&(33{.a.)*.frq parse =: [:([:<[:((spf@{.),(}.`([:<[:([:<[:spf"0[:'),'&sp>)"0[:');'&sp[:>{:)@.(2:=#)))[:':-'&sp>)"0 _1:}.[:'.'&sp cl isVar =: [:(91&>*.64&<)[:a.&i.[:{.> replace =: ((]i.~[:{.[){([:{:[),]`([:<[$:[:>])@.([:32&=[:3!:0[:>]))"2 0 gp =: [:>[:{.> gv =: [:(#~[:+./"1 isVar"0),. suit =: ([(0:`(([:(#=[:#[:~.[:{.|:)[:~.[:(#~[:-.[:isVar"0[:{:|:)gv)*.([:*./[:+./[:(isVar"0,=/),:))@.(([:#[)=[:#]))[:gp])"1 0#] sr =: [(](replace~[:|:])"2[:(([:-.[:isVar{:)"1#])[gv~[:gp])"1 0 suit groupVars =: [:([:<]$~2:,~[:-:#)"1[:>[:([:<[:;(>@[)([:<,"1 1)"1 2(>@]))/]</.~[:{.|: isRuleTrue =: ([:+./([:*./](isTrue~[:>])"1 0[:>[)"0 1)`(0:<[:#getVarsFromRule)@.(0:<#@gv@;@;@[) isTrue =: ]((a:&e.@])+.[:+./[(isRuleTrue~[:>])"1 0[:-.&a:])[:{:[:|:[:-.&(a:,a:)[:(0 2$a:)&,[:>sr getVars =: ;(([:<[:~.(>@{.@[)gv[:gp])`((>@{.@[)$:(<@<@gp@])([replace~[:|:[:>])"0 0(}.@[)getVarsFromRule~[:>[:{:[:>])@.([:<:[:#[:>]))"1 0 sr getVarsFromRule =: ](([:{.])#~[(isRuleTrue~[:>])"1 0[:{:])[:|:[(],[:<[replace~[:|:[:>])"1 0[:]`groupVars@.(0:<#)[:~.[:;[:;]([:<[getVars~[:>])"1 0[:;[ goal =: ([:<S:0[:{.[:parse[:,&'.'])([:{&(>'No';'Yes')isTrue)`([:(]`((>@{.),[:' = '&,[:>{:)@.(2:=#))"1[:>getVars)@.([:+./[:isVar"0[)([:parse[) 

I have searched .j on these pages: (http://filext.com/file-extension/J), (http://fileinfo.com/extension/j). They said that written in Java language.

But, it is named: interpreter.j; and, on its repository, it is defined: Objective-J.

I have asked some people: "Is it written in Objective-J?". They asked me: "Have this code been obfuscated?".


Which programming language is used in this code?

2
  • 4
    It's definitely J and I'd consider it obfuscated. It's chock full of cap ([:), which to me indicates someone ran everything through J's explicit-to-tacit converter. Commented Aug 15, 2015 at 0:56
  • 3
    Looka like the code implements a simple Prolog interpreter, albeit, for a J programmer's perspective, with some damn ugly code (my take is @hoosierEE is correct: this guy originally wrote the parser in explicit J and then used 13 : to convert that to tacit J; so that he could "show off" his skills on his blog. Not realizing, or course, that the results of using 13 : to convert large passages of explicit J to tacit J are about the same as the results of converting large passages of Russian to English: they get the idea across, but in a ridiculous way.) Commented Aug 27, 2015 at 13:09

3 Answers 3

10

Yes, it is the J programming language. If you actually want to learn more about it take a look at http://www.jsoftware.com

Because it is so terse, it can be difficult to read at first, but there is a very supportive community who are willing to answer questions. http://www.jsoftware.com/forums.htm

Also, the J interactive environment also includes labs which will actually step you through the process of understanding some of the concepts, while allowing you to use the full power of the language.

If instead you would like to giggle about how difficult it is to read, then go ahead - but maybe also give it a try. :-)

Sign up to request clarification or add additional context in comments.

3 Comments

Bob, lack of readability is exactly the reason why I won't give it a try :-) A language is going to have to bring to the table a large number of reasons to use it, if it's takes away such readability. No, I think I'll probably stick with one of the hundreds of others.
I guess it is a bit of a chicken and egg argument, since I can read the code because I know the language. I will admit a line of J can be as challenging to read as a page of C, but often it is doing as much or more work. Codegolf J solutions are proof of that. The one thing that I will say about your choice of hundreds of others is that many of them are built on the same procedural foundation. Knowing J really does affect the way that I look at programming problems because it is so different and I could say the same of Lisp and a few others. Enjoy your choices.
Reading J is no different than reading a math formula. Most of us can read: 2 + 3 * 4 - 5 and even apply prioritization of '' over '+' and '-' because we learned this in elementary school. The meaning of the symbols '+', '' and '-' were acquired early and reinforced throughout our 12 years of school. J's language is no different -- it's an derivative of APL, which was developed as a tool for representing programmable, testable mathematical formulas. With a few hours of practice, you'll be able to read most of J's symbols and understand the basic meaning of many J sentences.
3

It's the J programming language, as the file extension and the bass-ackward assignment indicate.

Based on my limited exposure (which admittedly consists only of the code snippet provided in the question), it's also apparently the first language I've ever found that actually outclasses Perl in terms of being a write-only language, something I thought I'd never live to see :-) I think I'd prefer to stick with something a little more readable myself.

7 Comments

So what does that snippet actually do? :-)
Never seen APL then, or FLUB?
@Paul, it's an recursive implementation of the Boyer-Moore string search algori ... sorry, can't keep a straight face, I actually have no idea what it does. Given it's called interpreter.j, it's probably not a massive stretch to assume it's some form of interpreter though :-) But, beyond that, someone more knowledgeable will need to chime in.
This could just as easily be an emoticon chart.
@Danylo, I refer the honorable gentleman to the smiley at the end of that sentence. However, in the interest of fairness, I'm qualifying my statement since I haven't actually seen a lot of J - my experience is limited to the current question.
|
0

No idea what the J language is, but it appears that your code does parse correctly with it.

http://www.jsoftware.com/

Comments