# What is an uninvokable procedure -- and how/why?

**URL:** <https://racket.discourse.group/t/what-is-an-uninvokable-procedure-and-how-why/1085>\
**Category:** General\
**Created:** [June 16, 2022, 1:59pm UTC](https://racket.discourse.group/t/what-is-an-uninvokable-procedure-and-how-why/1085 "2022-06-16T13:59:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![greghendershott](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/greghendershott/32/98_2.png) [@greghendershott](https://racket.discourse.group/u/greghendershott)\
**Post date:** [June 16, 2022, 1:59pm UTC](https://racket.discourse.group/t/what-is-an-uninvokable-procedure-and-how-why/1085/1 "2022-06-16T13:59:28Z")

</div>

Reading [TIL: Partial application and currying aren't the same](https://racket.discourse.group/t/til-partial-application-and-currying-arent-the-same/1082) made me look at the implementation of `curry`.

A helper function it uses:

```scheme
  ; arity-mask? -> (or/c exact-nonnegative-integer? +inf.0 #f)
  ;
  ; Calculates the maximum number of arguments a function with the given arity may be applied to. If
  ; an unbounded number of arguments are permitted, returns +inf.0. If no number of arguments is valid
  ; (that is, the procedure is uninvokable), returns #f.
  (define (arity-upper-bound mask)
    (cond
      [(eqv? mask 0) #f]
      [(negative? mask) +inf.0]
      [else (sub1 (integer-length mask))]))

```

On first read, I nodded along. A minute later... wait. What exactly is an "uninvokable procedure", for which no number of arguments is valid (not even zero)?

It sounds like a procedure that can't be invoked/called/applied -- that doing so is an error.

Is that correct? If so, how do you create such a procedure, and why would you?

---

<div class="post-metadata">

**Author:** ![greghendershott](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/greghendershott/32/98_2.png) [@greghendershott](https://racket.discourse.group/u/greghendershott)\
**Post date:** [June 16, 2022, 2:13pm UTC](https://racket.discourse.group/t/what-is-an-uninvokable-procedure-and-how-why/1085/2 "2022-06-16T14:13:57Z")

</div>

It looks like _how_ you can create one using `procedure-reduce-arity` (or the `-mask` flavor). Still not sure about the why.

---

<div class="post-metadata">

**Author:** ![samth](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samth/32/3_2.png) [@samth](https://racket.discourse.group/u/samth)\
**Post date:** [June 16, 2022, 2:13pm UTC](https://racket.discourse.group/t/what-is-an-uninvokable-procedure-and-how-why/1085/3 "2022-06-16T14:13:57Z")

</div>

Here's an example:

```scheme
(define f (case-lambda))

```

---

<div class="post-metadata">

**Author:** ![greghendershott](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/greghendershott/32/98_2.png) [@greghendershott](https://racket.discourse.group/u/greghendershott)\
**Post date:** [June 16, 2022, 2:24pm UTC](https://racket.discourse.group/t/what-is-an-uninvokable-procedure-and-how-why/1085/4 "2022-06-16T14:24:36Z")

</div>

Thanks for that example!

Naively I would have guessed instead that `(case-lambda)` is an error, and there's no need for such a thing as an uninvokable procedure.
