(no title)
leprechaun1066 | 7 months ago
Usually when someone solves problems with q, they don't use the way one would for Python/Java/C/C++/C#/etc.
This is probably a poor example, if I asked someone to write a function to create an nxn identity matrix for a given number the non-q solution would probably involve some kind of nested loop that checks if i==j and assigns 1, otherwise assigns 0.
In q you'd still check equivalence, but instead of looping, you generate a list of numbers as long as the given dimension and then compare each item of the list to itself:
{x=/:x:til x}3
An LLM that's been so heavily trained on an imperative style will likely struggle to solve similar (and often more complex) problems in a standard q manner.
wat10000|7 months ago
anticensor|7 months ago
gabiteodoru|7 months ago
leprechaun1066|7 months ago
I think this form might be a bit easier: {(x,x)#(x*x)#1,x#0}