You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is a place to brainstorm potentially useful new operators. Most of these, if they are implemented, will become 2-uppercase-letter operators; some will be 2-byte symbolic operators. Feel free to make suggestions in the comments. Also, if you see an idea you like, feel free to implement it and make a pull request!
Chop: split an iterable into n chunks of (roughly) equal size; unary version splits into two chunks (CH, or possibly >< because it's the converse of <>)
Flatten List (FL for flattening one level, FA for FlattenAll)
Map and flatten (MF)
Filter-enumerate: filters an iterable, but the first argument to the function is the index of the element and the second is the element itself (FE)
Filter-unpack: filters an iterable, but the arguments to the function are the elements of each element rather than the element itself (FU)
Filter negated: keeps elements for which the function returns a falsey value (FN)
Filter and join (FJ)
Filter and flatten (FF)
Filter indexes: like FE, but returns a list of indexes instead of a list of elements (FX)
Take-while and drop-while (TW and DW)
Fold on function (FO for [left] Fold, FR for FoldRight)
Iterate function (IW for Iterate While truthy, IU for Iterate Until truthy, IQ for Iterate while uniQue)
Pad with spaces (LS for LeftSpace, RS for RightSpace, BS for BothSpace; or PL for PadLeft, PR for PadRight, PC for PadCentered)
Left-pad with zeros (LZ for LeftZero; or ZP for ZeroPad)
Base-conversion operator that takes a width and left-pads with zeros
Pad with arbitrary character
Wrap in parentheses (WP? or PN or PT for PareNThesize?)
Bit-length (how many bits are in the binary representation of a number) (BL)
Rotate iterable left/right
Title-case (capitalize first letter of each run of letters) (TC)
Initial caps (capitalize first letter of string) (IC)
Round up, down, toward zero, to nearest (>| for round up, |< for round down, RZ for RoundZero, RN for RoundNearest)
Keyed versions of MN and MX, analogous to SK (NK for MinKey, MK for MaxKey)
String versions of MN and MX, analogous to SS (MS isn't available, so maybe LS for LeastString and GS for GreatestString)
Sort in descending order (DN for DescendingNumeric, DS for DescendingString)
Sort keyed in descending order (DK)
Trim list (does the same thing as TM but works on Lists instead of Scalars) (TL)
Join on list/element (concatenate list or insert element between consecutive elements of list) (JL and JE)
Wrap in list (unary, binary, and maybe ternary versions) (WL or maybe WS for WrapSingleton, WP for WrapPair, WT for WrapTriple--maybe WL has unary and binary versions, but then there's also WS that's only unary?)
Cartesian power (CW, or maybe CE by analogy to E for Exponential)
Power set, i.e. list of all subsets (PS)
A version of Z that, given a list of strings, pads with spaces and returns a list of strings rather than a list of lists of characters (ZJ for ZipJoin, by quasi-analogy to MJ)
Versions of zip and weave that cycle the shorter list(s) (ZC and WC)
A version of HV that rounds up instead of down (HU)
Non-cyclically-indexing version of @ (returns nil when out of bounds; possibly extends iterable when out of bounds as an lvalue) (maybe EA for ElementAt, IA for ItemAt, or AI for AtIndex?)
One-based indexing (\@, with a unary version that gets the last element)
This issue is a place to brainstorm potentially useful new operators. Most of these, if they are implemented, will become 2-uppercase-letter operators; some will be 2-byte symbolic operators. Feel free to make suggestions in the comments. Also, if you see an idea you like, feel free to implement it and make a pull request!
CH
, or possibly><
because it's the converse of<>
)FL
for flattening one level,FA
for FlattenAll)MF
)FE
)FU
)FN
)FJ
)FF
)FE
, but returns a list of indexes instead of a list of elements (FX
)TW
andDW
)FO
for [left] Fold,FR
for FoldRight)IW
for Iterate While truthy,IU
for Iterate Until truthy,IQ
for Iterate while uniQue)LS
for LeftSpace,RS
for RightSpace,BS
for BothSpace; orPL
for PadLeft,PR
for PadRight,PC
for PadCentered)LZ
for LeftZero; orZP
for ZeroPad)WP
? orPN
orPT
for PareNThesize?)BL
)TC
)IC
)>|
for round up,|<
for round down,RZ
for RoundZero,RN
for RoundNearest)MN
andMX
, analogous toSK
(NK
for MinKey,MK
for MaxKey)MN
andMX
, analogous toSS
(MS
isn't available, so maybeLS
for LeastString andGS
for GreatestString)DN
for DescendingNumeric,DS
for DescendingString)DK
)TM
but works on Lists instead of Scalars) (TL
)JL
andJE
)WL
or maybeWS
for WrapSingleton,WP
for WrapPair,WT
for WrapTriple--maybeWL
has unary and binary versions, but then there's alsoWS
that's only unary?)CW
, or maybeCE
by analogy toE
for Exponential)PS
)Z
that, given a list of strings, pads with spaces and returns a list of strings rather than a list of lists of characters (ZJ
for ZipJoin, by quasi-analogy toMJ
)ZC
andWC
)HV
that rounds up instead of down (HU
)@
(returns nil when out of bounds; possibly extends iterable when out of bounds as an lvalue) (maybeEA
for ElementAt,IA
for ItemAt, orAI
for AtIndex?)\@
, with a unary version that gets the last element)SH
)RY
, by analogy withEY
?)ED
for EuclideanDistance, orHY
for HYpotenuse?)DP
)CV
, maybe alsoVT
for ConvolutionTrimmed to the size of the bigger input)LB
for LogBinary,LD
for LogDecimal)The text was updated successfully, but these errors were encountered: