Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider describing how K treats whitespace #31

Open
hmkemppainen opened this issue Mar 23, 2024 · 1 comment
Open

Consider describing how K treats whitespace #31

hmkemppainen opened this issue Mar 23, 2024 · 1 comment

Comments

@hmkemppainen
Copy link
Contributor

hmkemppainen commented Mar 23, 2024

I was just reading about ': in more adverbs:

x ': y Window

Symbol: ':

Args: int ': array

Note how the syntax is written with a space separating the function/adverb from its args. I didn't pay much attention to this in the past, since I assumed it's just a stylistic thing and that the interpreter wouldn't care about it either way.

This assumption seems right for functions as well as function-adverb pairs where there is no space between the function and adverb:

 1-!5
1 0 -1 -2 -3

 1 - !5
1 0 -1 -2 -3
 1 2 3!'3 4 5
0 0 2

 1 2 3 !' 3 4 5
0 0 2

Window is different. I guess syntactically 3 is supposed to take the position of a function, and I guess the interpreter would expect the adverb (if any) to follow immediately, without a space:

 3':!5
(0 1 2
 1 2 3
 2 3 4)

 3 ': !5
'nyi
 3 ': !5
   ^

Trying other adverbs with a space also yields interesting results that are difficult to interpret with the information given so far:

 -\!5
0 -1 -3 -6 -10

 - \!5
0 1 2 3 4
0 -1 -2 -3 -4
 +\!5
0 1 3 6 10

 + \!5
0 1 2 3 4
,0 1 2 3 4
 2\123
1 1 1 1 0 1 1

 2 \123
123
'rank
 ��
   ^

 2 \ 123
123
'rank
 2 \ 123
  ^
@razetime
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants