Hacker News new | ask | show | jobs
by sbjs 1067 days ago
This is the most unreadable code I may have ever seen. Congrats on successfully writing it and getting it to work.
2 comments

Try the J source code, like https://github.com/jsoftware/jsource/blob/master/jsrc/v.c

  F1(jttable){A z,zz;I r,wr;
   F1PREFIP;ARGCHK1(w);
   // We accept the pristine calculations from ravel
   wr=AR(w); r=(RANKT)jt->ranks; r=wr<r?wr:r;  // r=rank to use
   //  obsolete  RZ(IRSIP1(w,0L,r-1<0?0:r-1,jtravel,z));  // perform ravel on items
   RZ(IRSIP1(w,0L,r-((UI)r>0),jtravel,z));  // perform ravel on items
   R r?z:IRSIP1(z,0L,0L,jtravel,zz);  // If we are raveling atoms, do it one more time on atoms
  } // ,."r y
Quoting https://corecursive.com/065-competitive-coding-with-conor-ho... :

> Yeah. I started a project a couple months ago. I’m slowly porting that code base, the J source code to C++ 20. And yeah, I think there should be a name for these types of code bases, because it’s not C, it’s like a macro variant of C, where it’s a CDSL, where 80% of your “library” is macros. I did a search, there’s 10,000 macros in the source code, and those macros are used like functions.

Yea it's very hard to read. I'm surprised that people are actually can follow the flow and can understand dirty tricks.

The most unreadable code would be the code that was intentionally obfuscated. Here I at least try to pretend that it is readable in some parts.

Thanks for kind words.