Open lynn opened 6 years ago
I considered a hacky solution for mapping structures back when I added prefixes and suffixes. It would be <atom><nilad><quick>
and the nilad would signal the type of structure to map over. It would be similar to ;.
from J
In that sense, a quick with syntax (A)(B)(Q)
, where Q is the quick, that would be equivalent to (A)€(B)/(C)
, where C is one of ¤$¥
corresponding to the arity of A, would be useful too, at least empirically.
@GolfingSuccess Can you share some examples demonstrating how that would be useful? I'm intrigued.
@lynn My newest example as of writing this. Dḟ0P+Ʋ⁸С€f/
can be written as Dḟ0P+Ʋ⁸Сf(Q)
instead, if Q is single-byte. Oh, and, if we want (A)Ѐ(B)/(C)
too, we could make (A)(B)(ÐQ)
. As a double-byte (Ð-) quick, I think it will lose its usefulness by a big factor.
I've implemented all of the constant nilads. https://github.com/DennisMitchell/jellylanguage/commit/aeeadda652d857dbd352592ffdf723e3aada4cc4
)
, Ƈ
, Ɱ
, and Ƭ
are now aliases for µ€
, Ðf
, Ѐ
, and ÐĿ
. https://github.com/DennisMitchell/jellylanguage/commit/26ac6389934006e750e2ce8a83f75f8b55578d32
§
and Ä
have been implemented as potential replacements for S€
and +\
. They vectorize at depth 1. https://github.com/DennisMitchell/jellylanguage/commit/83efa29aa73907fc5e273e94c81def8f35917d04
These atoms along with several more nilads have been added. beb17f3
Œd
( UŒD
)
Œḍ
(ŒḌU
)
ŒH
(œs2
)
œP
(Ṭœp
)
œṖ
(Ṭœṗ
or Ṭk
)
Here is an updated list with implemented tokens at the bottom.
Putting this here, so it doesn't get lost and forgotten in the Jelly chatroom history:
I used SE Data Explorer to gather a corpus of Jelly source code lines, on which I performed some frequency analysis, resulting in
These lists gave me an idea of which common phrases deserve a 2-byte (or even 1-byte) alias. I compiled a big list of ideas for new atoms and quicks inspired by them. Feel free to comment on their merit or implementation here.
Some thoughts that came out of this in the chatroom:
µ€
, because it’s ridiculously common.Ѐ
andÐf
and some others should have really been one byte, but it isn’t too late to make aliases for them.€
is by far the most common character in Jelly code, which is maybe surprising given that Jelly has automatic vectorization. We might want a 1-byte alias forS€
, which comes up very often. We might also want to make a bunch of quicks that are short for “get all (blah) and map over them”, e.g.□ÐP
could be short forŒP□€
.ẏ
andŜ
, making room for a new monadic atomŜ
while retaining backwards compatibility.