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

Atom/quick ideas based on a Jelly corpus #69

Open
lynn opened this issue May 10, 2018 · 8 comments
Open

Atom/quick ideas based on a Jelly corpus #69

lynn opened this issue May 10, 2018 · 8 comments

Comments

@lynn
Copy link
Contributor

lynn commented May 10, 2018

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:

  • We probably want a new chain separator for µ€, 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 for S€, 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□€.
  • Dennis considered amending the Jelly SBCS with aliases that free up more room for 1-byte monads. For example, 0xF8 could be represented by both and Ŝ, making room for a new monadic atom Ŝ while retaining backwards compatibility.
@miles-cg
Copy link
Contributor

miles-cg commented May 10, 2018

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

@GolfingSuccess
Copy link
Contributor

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.

@lynn
Copy link
Contributor Author

lynn commented May 11, 2018

@GolfingSuccess Can you share some examples demonstrating how that would be useful? I'm intrigued.

@GolfingSuccess
Copy link
Contributor

@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.

@DennisMitchell
Copy link
Owner

DennisMitchell commented May 11, 2018

I've implemented all of the constant nilads. aeeadda

@DennisMitchell
Copy link
Owner

), Ƈ, , and Ƭ are now aliases for µ€, Ðf, Ѐ, and ÐĿ. 26ac638

@DennisMitchell
Copy link
Owner

DennisMitchell commented May 11, 2018

§ and Ä have been implemented as potential replacements for S€ and +\. They vectorize at depth 1. 83efa29

@dylannrees
Copy link
Contributor

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.

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

5 participants