fix(maths): scale-minmax-table fails on current Nu (undefined column2, deprecated merge)#1265
Merged
fdncred merged 1 commit intoJul 2, 2026
Conversation
…, deprecated merge)
scale-minmax-table has been broken as a standalone module command since
it was added: it calls `column2`, which is defined only in
sourced/misc/nu_defs.nu (an unrelated personal-dotfiles file) rather
than in this module. It only ever worked in a shell where that file
happened to already be sourced separately.
Separately, current Nu's `merge` no longer accepts the closure form
`merge {$it}` used here -- `merge` now takes a `record`/`table` value
directly (see `help merge`), so this also fails to parse on anything
recent regardless of the column2 issue.
Fixes:
- Add a local `column2` helper (same implementation as
sourced/misc/nu_defs.nu) so the module doesn't depend on unrelated
files being sourced first.
- `merge {$it}` -> `merge $it`.
Verified on Nu 0.113.1: the whole module now parses, and
`[[a b]; [1 10] [2 20] [3 30]] | scale-minmax-table 0 1` produces the
correct per-column min-max scaling. Also spot-checked root, croot, and
delta still work unchanged.
There was a problem hiding this comment.
Pull request overview
Fixes scale-minmax-table in the maths module so it works on current Nushell by removing an implicit dependency on an unrelated sourced file and updating a now-invalid merge syntax.
Changes:
- Added a local (non-exported)
column2helper to makescale-minmax-tableself-contained. - Updated
merge {$it}tomerge $itto match current Nushellmergeparsing/usage.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2 tasks
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's broken
scale-minmax-tableinmodules/maths/math_functions.nufails on current Nu (tested on 0.113.1) for two independent reasons:column2is undefined in this module. It's only defined insourced/misc/nu_defs.nu(an unrelated personal-dotfiles file elsewhere in this repo).scale-minmax-tablecalls it without importing or defining it locally, so it only ever worked in a shell session wherenu_defs.nuhappened to already be sourced separately. As a standalone module command, it's always been broken.merge {$it}is no longer valid.mergeused to accept a closure form; current Nu'smergetakes arecord/tablevalue directly (seehelp merge). This fails to parse on recent Nu regardless of thecolumn2issue.Fix
column2helper (same implementation as the one insourced/misc/nu_defs.nu) so this module doesn't depend on an unrelated file being sourced first.merge {$it}->merge $it.How I found this
I was evaluating this module as a candidate seed package for an unrelated project's package registry and ran it against a real Nu 0.113.1 instead of trusting the source — it failed to parse. Diagnosed both root causes from there.
Verification
On Nu 0.113.1:
[[a b]; [1 10] [2 20] [3 30]] | scale-minmax-table 0 1produces correct per-column min-max scaling:root,croot, anddeltain the same file still produce correct output, unaffected by this change.