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

Ideas for new operators #22

Open
18 of 43 tasks
dloscutoff opened this issue May 27, 2021 · 1 comment
Open
18 of 43 tasks

Ideas for new operators #22

dloscutoff opened this issue May 27, 2021 · 1 comment
Labels
brainstorming Less of an issue, more of a place to kick around ideas. help wanted

Comments

@dloscutoff
Copy link
Owner

dloscutoff commented May 27, 2021

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)
  • Random shuffle (SH)
  • Various triangular matrices
  • Reversed identity matrix (RY, by analogy with EY?)
  • Euclidean norm (ED for EuclideanDistance, or HY for HYpotenuse?)
  • Dot product (DP)
  • Convolution (CV, maybe also VT for ConvolutionTrimmed to the size of the bigger input)
  • Log base 2 and base 10 (LB for LogBinary, LD for LogDecimal)
@dloscutoff dloscutoff added brainstorming Less of an issue, more of a place to kick around ideas. and removed enhancement labels Jul 3, 2021
@mathcat4
Copy link

mathcat4 commented Jan 4, 2023

  • Factors
  • Is prime?
  • Prime factors
  • Combinations with replacement
  • Combinations without replacement
  • All subsets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
brainstorming Less of an issue, more of a place to kick around ideas. help wanted
Projects
None yet
Development

No branches or pull requests

2 participants