DennisMitchell / jellylanguage

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

Even/odd quicks and atoms #80

Closed dylannrees closed 6 years ago

dylannrees commented 6 years ago

Ðo Apply to odd indices. Ðe Apply to even indices. Œo Get elements at odd indices. Œe Get elements at even indices. Œḃ Bit complement. (z+1) % 2 ŒỊ Not insignificant. abs(z) > 1

The last two would only save a byte if they need to be a single link (ḂC$, ỊC$), but I've found myself use each of those a couple times.

DennisMitchell commented 6 years ago

The first four should probably look a bit more related. Since we recently added Œœ for odd-even, I'd say we use Œo and Œe for odd and even, and consequently Ðo and Ðe for the corresponding quicks.

The last two sound useful, but I wonder if a single-byte not quick would be worth it. It would vectorize at the same depth as the underlying link, so and would be and , which we also do not have as built-ins.

dylannrees commented 6 years ago

Caught a bug in even indices quick and made the changes you suggested.

I don't think the not quick ɲ vectorizes at the depth of the link it consumes since I used the ¬ atom to do the call. How can that vectorization behavior be accomplished in a quick?

DennisMitchell commented 6 years ago

I'm not sure about the ɲ quick yet. Could you keep the first four for now, so I can merge them?