Function.fz
# This file is part of the Fuzion language implementation.
#
# The Fuzion language implementation is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, version 3 of the License.
#
# The Fuzion language implementation is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with The
# Fuzion language implementation. If not, see <https://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------
#
# Tokiwa Software GmbH, Germany
#
# Source code of Fuzion standard library feature Function
#
# Author: Fridtjof Siebert (siebert@tokiwa.software)
#
# -----------------------------------------------------------------------
# Function -- generic function with arbitrary number of arguments and result
#
# R is the result type of the function, A are the argument types of the function
#
public Function(public R type,
public A type...) ref is
# call this function on given arguments a...
#
public call(a A) R => abstract
# NYI: would be nice to have schönfinkeling defined here, could work like this:
#
# curry(x A.0) Function(R, A.1...) is
# curried Function(R, A1...) is
# call(a A1...) is Function.this.call x a...
# curried
#
# --or, with different syntax sugar--
#
# curry(x A.0) R->A.1... is x,a... -> call x a...
#
# where A.1... is the tail of type argument A (might be empty), and A.0 is the first element,
# void (or unit?) if it does not exist.
last changed: 2024-03-07