DennisMitchell / jellylanguage

Jelly is a recreational programming language inspired by J.
MIT License
862 stars 45 forks source link

Atom/quick ideas based on a Jelly corpus #69

Open lynn opened 6 years ago

lynn commented 6 years ago

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:

miles-cg commented 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

GolfingSuccess commented 6 years ago

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 commented 6 years ago

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

GolfingSuccess commented 6 years ago

@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 commented 6 years ago

I've implemented all of the constant nilads. https://github.com/DennisMitchell/jellylanguage/commit/aeeadda652d857dbd352592ffdf723e3aada4cc4

DennisMitchell commented 6 years ago

), Ƈ, , and Ƭ are now aliases for µ€, Ðf, Ѐ, and ÐĿ. https://github.com/DennisMitchell/jellylanguage/commit/26ac6389934006e750e2ce8a83f75f8b55578d32

DennisMitchell commented 6 years ago

§ and Ä have been implemented as potential replacements for S€ and +\. They vectorize at depth 1. https://github.com/DennisMitchell/jellylanguage/commit/83efa29aa73907fc5e273e94c81def8f35917d04

dylannrees commented 6 years ago

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.