Skip to content

Commit f4040ca

Browse files
author
Sylvain MARIE
committed
Updated usage page to reflect the submodules change
1 parent 1965386 commit f4040ca

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

docs/usage.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ For convenience, `mini_lambda` comes bundled with the following predefined input
2525
* boolean/int/float numbers: `b` / `i`, `j`, `n` / `x`, `y`
2626
* lists/mappings: `l` / `d`
2727
* callables: `f`
28-
* numpy arrays (if numpy is present): `X`, `Y`, `M` (from `mini_lambda.numpy`)
29-
* pandas dataframes (if pandas is present): `df` (from `mini_lambda.pandas`)
28+
* numpy arrays (if numpy is present): `X`, `Y`, `M` (from `mini_lambda.vars.numpy_`)
29+
* pandas dataframes (if pandas is present): `df` (from `mini_lambda.vars.pandas_`)
3030

3131

3232
## Lambda Expressions vs Lambda Functions
@@ -149,7 +149,9 @@ or through provided workarounds :
149149
```python
150150
from mini_lambda import b, i, s, l, x
151151
from mini_lambda import Slice, Get, Not, In, And
152-
from mini_lambda import Iter, Repr, Format, Len, Int, Any, Log, DDecimal
152+
from mini_lambda import Iter, Repr, Str, Len, Int, Any
153+
from mini_lambda.symbols.math_ import Log
154+
from mini_lambda.symbols.decimal_ import DDecimal
153155
from math import log
154156
from decimal import Decimal
155157

@@ -177,7 +179,7 @@ expr = repr(l) # fails
177179
expr = Repr(l) # OK
178180
# formatting with the variable in the args
179181
expr = '{} {}'.format(s, s) # fails
180-
expr = Format('{} {}', s, s) # OK
182+
expr = Str.format('{} {}', s, s) # OK
181183
# sizing
182184
expr = len(l) # fails
183185
expr = Len(l) # OK
@@ -346,7 +348,7 @@ Classes can be entirely made lambda-friendly at once. This will convert the cons
346348

347349
```python
348350
from mini_lambda import _, make_lambda_friendly_class
349-
from mini_lambda.numpy import X
351+
from mini_lambda.vars.numpy_ import X
350352
import numpy as np
351353
import pandas as pd
352354

@@ -363,7 +365,7 @@ Actually the `Constant()` (alias `C()` or `make_lambda_friendly()`) function tha
363365

364366
```python
365367
from mini_lambda import _, C
366-
from mini_lambda.numpy import X
368+
from mini_lambda.vars.numpy_ import X
367369
import numpy as np
368370
import pandas as pd
369371

@@ -381,7 +383,11 @@ str(all_at_once) # 'print(DataFrame(X).transpose())'
381383
For convenience all of the [built-in functions](https://docs.python.org/3/library/functions.html) as well as constants, methods and classes from the `math.py` and `decimal.py` modules are provided in a lambda-friendly way by this package. The naming rule is to capitalize lower-case names, and for already capitalized names to duplicate the first letter:
382384

383385
```python
384-
from mini_lambda import DDecimal # Decimal class
385-
from mini_lambda import Print # print() function
386-
from mini_lambda import Pi # math.pi constant
386+
# builtins are available at pkg root
387+
from mini_lambda import Print
388+
389+
# all other symbols are in ther appropriate 'symbols' submodule
390+
from mini_lambda.symbols.builtins import Print # print() function
391+
from mini_lambda.symbols.math_ import Pi # math.pi constant
392+
from mini_lambda.symbols.decimal_ import DDecimal # Decimal class
387393
```

0 commit comments

Comments
 (0)