# Functions and Generics These examples cover higher-level function features that are already usable in the H-Series subset. ## Function overloading Source file: `guppy_examples/guppy-features/supported/function-overloading.py` ```{literalinclude} ../../../guppy_examples/guppy-features/supported/function-overloading.py :language: python ``` ## First-class functions Source file: `guppy_examples/guppy-features/supported/first-class-functions.py` ```{literalinclude} ../../../guppy_examples/guppy-features/supported/first-class-functions.py :language: python ``` ## Higher-order functions Source file: `guppy_examples/guppy-features/supported/higher-order-functions.py` ```{literalinclude} ../../../guppy_examples/guppy-features/supported/higher-order-functions.py :language: python ``` ## Function type annotations Source file: `guppy_examples/guppy-features/supported/function-type.py` ```{literalinclude} ../../../guppy_examples/guppy-features/supported/function-type.py :language: python ``` ## Generics Source file: `guppy_examples/guppy-features/supported/generics.py` ```{literalinclude} ../../../guppy_examples/guppy-features/supported/generics.py :language: python ``` This example manipulates its generic arrays under `@guppy.comptime`. Fixed-size generic arrays may also be used in ordinary `@guppy` functions and follow the usual [array rules](arrays.md). ## Protocols Source file: `guppy_examples/guppy-features/supported/protocol.py` ```{literalinclude} ../../../guppy_examples/guppy-features/supported/protocol.py :language: python ```