hackett icon indicating copy to clipboard operation
hackett copied to clipboard

What is the type signature of `apply`?

Open AnthonyJacob opened this issue 8 years ago • 1 comments

Scheme (and possibly racket) has function called apply and list. Will these function also be available in hackett? What about their type signatures?

Note:

Even though apply takes a list as an argument in scheme it would make much more sense to take a tuple as an argument. There should be also a tuple variant of list. Also foo and apply foo . tuple should be equal.

AnthonyJacob avatar Mar 19 '17 12:03 AnthonyJacob

It’s unlikely that either of these will exist as functions, but it’s quite possible they will exist as forms. The list form is already available as [ square brackets ], but as you mention, homogenous lists probably aren’t what you’re looking for, anyway. Tuples (of arbitrary size) are not currently implemented, but they are planned.

Addressing apply is a little trickier. Implementing it as a macro probably wouldn’t be too hard, but that would restrict higher-order usage. It’s possible that it could be implemented more cleverly, though, with the use of a special Tuple typeclass and some clever macro machinery.

lexi-lambda avatar Mar 21 '17 23:03 lexi-lambda