DennisMitchell / jellylanguage

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

Add "extremes" atoms (ÐṂ and ÐṀ) #21

Closed lynn closed 7 years ago

lynn commented 7 years ago

Description

ÇÐṀ is short for Ç€M$ị$. It returns all the elements that have maximal Ç values, i.e.

[x for x in z if Ç(x) == max(map(Ç, z))]

ÐṂ does the opposite, keeping all the elements that have minimal Ç values.

Examples

LÐṀ returns all strings in a list that have maximal length within that list.

The resulting link auto-range-ifies its input: 105DL$ÐṀ returns [100, 101, 102, 103, 104, 105].