tvl-depot/users/sterni/nix
sterni ad9b08e43d feat(sterni/nix/lists): implement transpose
This function is inspired by BQN's [⍉] though it is much less elegant
since Nix lacks multi-dimensional arrays. I thought this would be useful
to to avoid multiple `map`s over a single list if we want to return
multiple, separate values from it:

  transpose (builtins.map (x: [ (calcA x) (calcB x) ]) myList)

  # => [ [ (calcA a) … ] [ (calcB a) … ] ]

While this is quite elegant, it turns out that it is faster to write out
multiple maps:

  [ (builtins.map calcA myList) (builtins.map calcB myList) ]

[⍉]: https://mlochbaum.github.io/BQN/doc/transpose.html

Change-Id: Ic333c33af38ab03573b215c9696d75caf2ee18e7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11113
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2024-03-10 18:05:32 +00:00
..
build/buildGopherHole feat(sterni/lv): interim gopher page 2022-11-26 15:38:28 +00:00
char refactor(users/sterni/nix): move generic number operation into num 2023-08-09 12:12:47 +00:00
float feat(sterni/nix): add trivial float library 2023-08-09 12:12:47 +00:00
flow style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
fun refactor(sterni/nix/fun): key can also be an int 2022-10-23 21:08:52 +00:00
html chore(3p/sources): Bump channels & overlays 2022-09-28 08:02:31 +00:00
int refactor(nix/sterni/int): rename div & mod to quot & rem 2023-08-09 12:12:47 +00:00
list feat(sterni/nix/lists): implement transpose 2024-03-10 18:05:32 +00:00
misc feat(sterni/nix/misc): predicate to check if isRestrictedEval 2022-06-01 10:30:37 +00:00
num feat(sterni/nix): add trivial float library 2023-08-09 12:12:47 +00:00
string chore: remove comments formerly meant for alignment 2023-05-31 10:55:07 +00:00
url style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
utf8 refactor(users/sterni/nix): move generic number operation into num 2023-08-09 12:12:47 +00:00