Earlier quoted context omitted.
I agree with you, though in the q world people tend to take it to the extreme, like packing a whole function into a single line rather than a single screen. Here's a ticker plant standard script from KX themselves; I personally find this density makes it harder to read, and when reading it I put it into my text editor and split semicolon-separated statements onto different lines: https://github.com/KxSystems/kdb-tick…
When Q folks try to write C: https://github.com/kparc/ksimple
Don't Force Your LLM to Write Terse [Q/Kdb] Code: An Information Theory Argument
11–20 of 56 posts
Re: Don't Force Your LLM to Write Terse [Q/Kdb] Code: An Information Theory Argument
#12Re: Don't Force Your LLM to Write Terse [Q/Kdb] Code: An Information Theory Argument
#13Is this... just to be clever? Why not
(!x)=/:!x
aka. the identity matrix is defined as having ones on the diagonal? Bonus points AI will understand the code better.Re: Don't Force Your LLM to Write Terse [Q/Kdb] Code: An Information Theory Argument
#14> Let’s start with an example: (2#x)#1,x#0 is code from the official q phrasebook for constructing an x-by-x identity matrix. Is this... just to be clever? Why not (!x)=/:!x aka. the identity matrix is defined as having ones on the diagonal? Bonus points AI will understand the code better.
Some brief notations make sense. Consider, say, einsum: "ij->ji" elegantly expresses a whole operation in a way that exposes the underlying symmetry of the domain. I don't think q's line noise style (or APL for that matter) is similarly exposing any deeper structure.
Re: Don't Force Your LLM to Write Terse [Q/Kdb] Code: An Information Theory Argument
#15> Let’s start with an example: (2#x)#1,x#0 is code from the official q phrasebook for constructing an x-by-x identity matrix. Is this... just to be clever? Why not (!x)=/:!x aka. the identity matrix is defined as having ones on the diagonal? Bonus points AI will understand the code better.
Re: Don't Force Your LLM to Write Terse [Q/Kdb] Code: An Information Theory Argument
#16> I think the aesthetic preference for terseness should give way to the preference for LLM accuracy, which may mean more verbose code From what I understand, the terseness of array languages (Q builds on K) serves a practical purpose: all the code is visible at once, without the reader having to scroll or jump around. When reviewing an LLM's output, this is a quality I'd appreciate.
I agree with you, though in the q world people tend to take it to the extreme, like packing a whole function into a single line rather than a single screen. Here's a ticker plant standard script from KX themselves; I personally find this density makes it harder to read, and when reading it I put it into my text editor and split semicolon-separated statements onto different lines: https://github.com/KxSystems/kdb-tick…
{m:(x,x)#til x*x; r:til[x]-x div 2; 2(flip r rotate')/m}
generates magic squares of odd size, and the method is much clearer. This isn't even golfed as the variables have been left.Re: Don't Force Your LLM to Write Terse [Q/Kdb] Code: An Information Theory Argument
#17The bigger issue is that LLMs haven’t had much training on Q as there’s little publically available code. I recently had to try and hack some together and LLMs couldn’t string simple pieces of code together. It’s a bizarre language.
I don't think that's the biggest problem. I think it's the tokenizer: it probably does a poor job with array languages.
Re: Don't Force Your LLM to Write Terse [Q/Kdb] Code: An Information Theory Argument
#18> I think the aesthetic preference for terseness should give way to the preference for LLM accuracy, which may mean more verbose code From what I understand, the terseness of array languages (Q builds on K) serves a practical purpose: all the code is visible at once, without the reader having to scroll or jump around. When reviewing an LLM's output, this is a quality I'd appreciate.
Perl and line noise also share these properties. Don’t particularly want to read straight binary zip files in a hex editor, though. Human language has roughly, say, 36% encoding redundancy on purpose . (Or by Darwinian selection so ruthless we might as well call it "purpose".)
Re: Don't Force Your LLM to Write Terse [Q/Kdb] Code: An Information Theory Argument
#19Earlier quoted context omitted.
I agree with you, though in the q world people tend to take it to the extreme, like packing a whole function into a single line rather than a single screen. Here's a ticker plant standard script from KX themselves; I personally find this density makes it harder to read, and when reading it I put it into my text editor and split semicolon-separated statements onto different lines: https://github.com/KxSystems/kdb-tick…
When Q folks try to write C: https://github.com/kparc/ksimple
//!malloc
f(a,y(x+2,WS+=x;c*s=malloc(y);*s++=0;*s++=x;s)) //!
Reminds me a bit of both the IOCCC and 70s Unix C from before anyone knew how to write C in a comprehensible way. But the above is ostensibly production code and the file was last updated six months ago.Is there some kind of brain surgery you have to undergo when you accept the q license that damages the part of the brain that perceives beauty?
Re: Don't Force Your LLM to Write Terse [Q/Kdb] Code: An Information Theory Argument
#20Asking humans to change for the sake of LLMs is an utterly indefensible position. If humans want terse code, your LLM better cope or go home.