Skip to content

Commit

Permalink
Add IList to the list of exports of the funml package
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinitto committed Mar 17, 2023
1 parent 7817cac commit 555f6c8
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 33 deletions.
24 changes: 0 additions & 24 deletions docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,6 @@ Types
- MLType
- Operation

Lists
--

::: funml.data.lists
options:
members:
- IList

Enums
--

::: funml.data.enum
options:
members:
- Enum

Records
--

::: funml.data.records
options:
members:
- Record

Errors
===

Expand Down
3 changes: 2 additions & 1 deletion funml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
is_some,
)
from .data.records import record, to_dict, Record
from .data.lists import l, imap, ifilter, ireduce
from .data.lists import l, imap, ifilter, ireduce, IList
from .pipeline import execute
from .json import to_json, from_json

Expand All @@ -39,6 +39,7 @@
"Enum",
"Option",
"Result",
"IList",
"if_ok",
"if_err",
"if_some",
Expand Down
6 changes: 3 additions & 3 deletions funml/data/lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
value = add_9_transform(list1)
# iterating data using head and
def print_head(v: ml.data.lists.IList) -> ml.data.lists.IList:
def print_head(v: ml.IList) -> ml.IList:
print(v.head)
return v.tail
Expand All @@ -47,15 +47,15 @@ def l(*args: Any) -> "IList":
Creates a list of items of any type, that cannot be changed
once created. It can only be used to create other lists, using methods on it like
- [`+`][funml.data.lists.IList.__add__] - to combine two separate lists into a new one containing elements of both
- [`+`][funml.IList.__add__] - to combine two separate lists into a new one containing elements of both
- [`imap(fn)`][funml.imap] - to create a new list with each element transformed according to the given function `fn`
- [`filter(fn)`][funml.ifilter] - to return a new list containing only elements that conform to the given function `fn`
Args:
args: the items that make up the list
Returns:
An immutable list, [`IList][funml.data.lists.IList], containing the items passed to it.
An immutable list, [`IList][funml.IList], containing the items passed to it.
Example:
```python
Expand Down
4 changes: 1 addition & 3 deletions funml/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
"""
import inspect
import json
import typing
from typing import Any, TypeVar, Type, Mapping, Tuple, Union, Dict

from funml import Enum, Record
from funml.data.lists import IList
from funml import Enum, Record, IList
from funml.utils import right_pad_list, extract_type


Expand Down
3 changes: 1 addition & 2 deletions tests/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import pytest

from funml import l, imap, ifilter, ireduce, to_json, from_json
from funml.data.lists import IList
from funml import l, imap, ifilter, ireduce, to_json, from_json, IList
from tests import conftest


Expand Down

0 comments on commit 555f6c8

Please sign in to comment.