{"id":9755,"library":"fnc","title":"fnc - Functional Programming Utilities","description":"fnc is a Python library that provides functional programming utilities, primarily focusing on working with generators and iterable data. It offers curried versions of common functions like `map`, `filter`, and `pipe` for a more declarative style. The current version is 0.5.3, released in October 2021, and the project is in a maintenance mode with infrequent updates.","status":"maintenance","version":"0.5.3","language":"python","source_language":"en","source_url":"https://github.com/dgilland/fnc","tags":["functional programming","generators","iterators","pipe","curry","utilities"],"install":[{"cmd":"pip install fnc","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"wrong":"from fnc import pipe","symbol":"pipe","correct":"from fnc import pipe"},{"symbol":"compose","correct":"from fnc import compose"},{"symbol":"filter","correct":"from fnc import filter"}],"quickstart":{"code":"from fnc import pipe, map, filter, take\n\ndata = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n\n# Example 1: Use pipe for a functional chain\nresult_pipe = pipe(\n    data,\n    map(lambda x: x * 2),     # Double each number\n    filter(lambda x: x > 10), # Keep only numbers greater than 10\n    take(3),                  # Take the first 3 results\n    list                      # Materialize the generator into a list\n)\n\nprint(f\"Result with pipe: {result_pipe}\") # Expected: [12, 14, 16]\n\n# Example 2: Curried map and filter manually\ndouble = map(lambda x: x * 2)\nodd = filter(lambda x: x % 2 != 0)\n\nprocessed_data = double(odd(data)) # Apply odd filter, then double\nprint(f\"Manual curried chain: {list(processed_data)}\") # Expected: [2, 6, 10, 14, 18]\n","lang":"python","description":"Demonstrates the use of `pipe` for chaining functional operations and how curried functions like `map` and `filter` are applied."},"warnings":[{"fix":"When importing `fnc.map` or `fnc.filter`, either alias them (e.g., `from fnc import map as fnc_map`) or ensure you understand their curried nature and use them accordingly, typically within a `pipe` call or by first applying the function argument.","message":"fnc's `map` and `filter` conflict with Python's built-in `map` and `filter`. The `fnc` versions are curried, meaning they expect to be called with arguments in stages (e.g., `map(func)(iterable)` or used within `pipe`), unlike the built-in versions which expect `map(func, iterable)`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Append `.list()` or `list()` around the final operation in your functional chain to materialize the results. Example: `pipe(data, ..., list)` or `list(some_fnc_operation(data))`.","message":"Most `fnc` utilities return generators or iterators. For immediate evaluation and to see concrete results, you must explicitly convert them to a list, tuple, or other materializable collection (e.g., `list(result)`).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be aware that new issues or Python version incompatibilities might not be addressed immediately. It's generally stable for Python 3.6+, but extensive testing with newer Python versions is recommended for critical applications.","message":"The `fnc` library is in maintenance mode; the last release (0.5.3) was in 2021. While stable, active development and new features are not frequent. Consider this for long-term project planning or if cutting-edge functional features are required.","severity":"gotcha","affected_versions":"0.5.3 and previous"}],"env_vars":null,"search_vec":"'0.5.3':45 '2021':49 'common':29 'current':42 'curri':26,66 'data':23 'declar':39 'filter':33 'fnc':1,5 'focus':16 'function':2,12,30,61 'generat':20,63 'infrequ':59 'iter':22,64 'librari':9 'like':31 'mainten':56 'map':32 'mode':57 'octob':48 'offer':25 'pipe':35,65 'primarili':15 'program':3,13,62 'project':52 'provid':11 'python':8 'releas':46 'style':40 'updat':60 'util':4,14,67 'version':27,43 'work':18","created_at":"2026-04-17T01:20:33.160519+00:00","updated_at":"2026-04-17T01:20:33.160519+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nImportError: cannot import name 'pipe' from 'fnc' (/tmp/tmp4jda3fc1/venv/lib/python3.12/site-packages/fnc/__init__.py)"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.5.3","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/dgilland/fnc","docs":null,"changelog":null,"pypi":"https://pypi.org/project/fnc/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}