1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 06:37:46 +00:00
Commit graph

5 commits

Author SHA1 Message Date
Ian Manske
dee0e7efcd
Fix typos (#982) 2024-11-21 23:51:05 -05:00
Antoine Stevan
6aa2700730
add ways-to-add-up-to to "math" module (#874)
at my job, i studied very quickly something that involved computing all
the ways one can build a positive integer from the addition of other
positive integers.

enters the `ways-to-add-up-to` command i've written and added to the
`math` module in this PR.

## example
`ways-to-add-up-to 4` will be `[[1, 1, 1, 1], [1, 1, 2], [1, 3], [2, 2],
[4]]]` because $4$
can be obtained as follows:

$$ 1 + 1 + 1 + 1 $$

$$ 1 + 1 + 2 = 1 + 2 + 1 = 2 + 1 + 1 $$

$$ 1 + 3 = 3 + 1 $$

$$ 2 + 2 $$

$$ 4 $$

> **Note**  
> $1 + 1 + 2$ and $1 + 2 + 1$ are considered the same because addition
is _commutative_ and thus only `[1, 1, 2]` will be returned
2024-07-21 06:55:45 -05:00
Maxim Uvarov
afde2592a6
use typos for corrections (#833)
I used [typos](https://github.com/crate-ci/typos/).
I manually checked all the corrections and they seem safe to me.
There are still some left, but those in this PR are good
2024-05-08 06:47:54 -05:00
Antoine Stevan
9d21cd5cd3
Add cartesian product to math module (#624)
related to
- https://github.com/nushell/nushell/pull/10383

this PR resurrects the `cartesian product` command from
https://github.com/nushell/nushell/pull/10383 and adds it to the `maths`
module of the `nu_scripts`:
- a new `cartesian product` command
- some unit tests for it

## use the command
i've installed the `nu_scripts` with `nupm`, thus i'm able to do
```nushell
use nu-scripts/modules/maths/math_functions.nu "cartesian product"
cartesian product ...
```

## run the tests
from the root of the `nu_scripts`, checked out on this PR, run
```nushell
use std; std testing run-tests --path modules/maths/ --test cartesian_product
```
2023-09-30 09:46:04 -05:00
Mel Massadian
c47ccd42b8
refactor: (#418)
* refactor:  move in one commit

Eveything in modules should probably be changed to `exported` defs.
The idea is to move everything first to keep proper history.

* refactor: 📝 add modules readme (wip)

* refactor:  small move

* refactor: 📝 changed nestring, updated modules readme

* refactor: 📝 to document or not to document

* fix: 🐛 themes

replaced the template to use `main` and regenerated them
from lemnos themes.

* Revert "fix: 🐛 themes"

This reverts commit 4918d3633c8d2d81950a0ed0cfd9eb84241bc886.

* refactor:  introduce sourced

- Created a source `root` in which sourcable demos are stored.
  Some might get converted to modules later on.
- Moved some files to bin too.

* fix: 🐛 fehbg.nu

* fix: 🐛 modules/after.nu

* moved some other stuff around

---------

Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2023-04-25 17:56:25 -05:00