<div dir="ltr">If you're writing a higher-order tool like curry or negate, and want to produce a meaningful arity for its result, you're going to need some explicit representation of arity to manipulate, e.g. subtract one from every number in the list after partially applying to a single argument. Once users are manipulating the value, you either need to accept non-normalized inputs, or you need an abstract datatype to encapsulate the whole thing that enforces normalization. Since we already have list-based arities in our interfaces, I continued with the interface as it was. I did think of combining the two arity-includes? functions, I wasn't sure whether the extra overloading would make things clearer or more confused. I can see doing it either way.<br>
</div><div class="gmail_extra"><br clear="all"><div>Carl Eastlund</div>
<br><br><div class="gmail_quote">On Thu, Apr 11, 2013 at 11:33 AM, Eli Barzilay <span dir="ltr"><<a href="mailto:eli@barzilay.org" target="_blank">eli@barzilay.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
OK, that's a valid use case -- but isn't it better for both of these<br>
uses to just use some combinator for arities that generates a properly<br>
normalized arity instead of constructing lists and explicitly<br>
normalizing them?<br>
<br>
It's just that the interface looks very complex now. Some obvious<br>
things:<br>
<br>
* `procedure-arity-includes?' vs `arity-includes?'<br>
(but it's the second that compares two procedures... I'd just make<br>
the first accept a procedure to avoid this unfortunate naming.)<br>
<br>
* `normalize-arity', `normalized-arity?', `arity=?'<br>
(go away with a combinator, the last one gets replaced with<br>
`equal?')<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
A few minutes ago, Carl Eastlund wrote:<br>
> If we want people to be able to create higher-order functions with<br>
> precise arities via procedure-reduce-arity, for instance, we need to<br>
> provide tools for manipulating arity values. Manipulating them is<br>
> also useful for producing error messages that describe the arity of<br>
> procedure values. I don't see any reason to close this stuff off,<br>
> when it's the one useful, non-opaque aspect of procedure values.<br>
><br>
> Carl Eastlund<br>
><br>
> On Thu, Apr 11, 2013 at 11:13 AM, Eli Barzilay <<a href="mailto:eli@barzilay.org">eli@barzilay.org</a>> wrote:<br>
><br>
> Is there a real need to make this whole thing a public interface? I'd<br>
> think that a general direction is to move away from making it public<br>
> (ie, remove the ability to create an arity value), and this seems to<br>
> add a pretty big chunk of stuff in the opposite direction.<br>
><br>
> About two weeks ago, <a href="mailto:cce@racket-lang.org">cce@racket-lang.org</a> wrote:<br>
> > cce has updated `master' from 6e40caa7e2 to df00bbb194.<br>
> > <a href="http://git.racket-lang.org/plt/6e40caa7e2..df00bbb194" target="_blank">http://git.racket-lang.org/plt/6e40caa7e2..df00bbb194</a><br>
> ><br>
> > =====[ 7 Commits ]======================================================<br>
> > Directory summary:<br>
> > 21.0% collects/racket/private/<br>
> > 21.5% collects/racket/<br>
> > 26.4% collects/scribblings/reference/<br>
> > 30.9% collects/tests/racket/<br>
> ><br>
> > ~~~~~~~~~~<br>
> ><br>
> > 59b1e32 Carl Eastlund <<a href="mailto:cce@racket-lang.org">cce@racket-lang.org</a>> 2013-03-30 11:45<br>
> > :<br>
> > | Changed normalize-arity to coalesce arity-at-least with adjacent<br>
> numbers.<br>
> > |<br>
> > | For instance, (normalize-arity (list 1 (arity-at-least 2))) now<br>
> produces<br>
> > | (arity-at-least 1). The implementation and the tests for<br>
> normalize-arity both<br>
> > | reflect this change. The randomized tests now also check that the<br>
> output<br>
> > | represents the same arity as the input.<br>
> > :<br>
> > M collects/racket/private/norm-arity.rkt | 82 +++++++++++++---------<br>
> > M collects/tests/racket/basic.rktl | 112<br>
> +++++++++++++++++++++++++-----<br>
> ><br>
> > ~~~~~~~~~~<br>
> ><br>
> > e356c66 Carl Eastlund <<a href="mailto:cce@racket-lang.org">cce@racket-lang.org</a>> 2013-03-30 11:49<br>
> > :<br>
> > | Re-provide normalize-arity from racket/function.<br>
> > :<br>
> > M collects/racket/function.rkt | 4 ++--<br>
> ><br>
> > ~~~~~~~~~~<br>
> ><br>
> > 4dd011a Carl Eastlund <<a href="mailto:cce@racket-lang.org">cce@racket-lang.org</a>> 2013-03-30 15:49<br>
> > :<br>
> > | Added documentation for normalize-arity.<br>
> > :<br>
> > M collects/scribblings/reference/procedures.scrbl | 42<br>
> ++++++++++++++++++----<br>
> ><br>
> > ~~~~~~~~~~<br>
> ><br>
> > 636f8a9 Carl Eastlund <<a href="mailto:cce@racket-lang.org">cce@racket-lang.org</a>> 2013-03-30 21:04<br>
> > :<br>
> > | Moved normalized-arity?, arity=?, and arity-includes? into racket/<br>
> function.<br>
> > :<br>
> > M collects/racket/function.rkt | 94<br>
> +++++++++++++++++++++++++++++++++++-<br>
> > M collects/tests/racket/basic.rktl | 96<br>
> +------------------------------------<br>
> ><br>
> > ~~~~~~~~~~<br>
> ><br>
> > aaa99d5 Carl Eastlund <<a href="mailto:cce@racket-lang.org">cce@racket-lang.org</a>> 2013-03-30 21:05<br>
> > :<br>
> > | Documented normalized-arity?, arity=?, and arity-includes?.<br>
> > :<br>
> > M collects/scribblings/reference/procedures.scrbl | 87<br>
> +++++++++++++++++++---<br>
> ><br>
> > ~~~~~~~~~~<br>
> ><br>
> > f509420 Carl Eastlund <<a href="mailto:cce@racket-lang.org">cce@racket-lang.org</a>> 2013-03-30 17:12<br>
> > :<br>
> > | Removed unnecessary duplication of normalize-arity.<br>
> > :<br>
> > M collects/tests/racket/fixnum.rktl | 21 ++-------------------<br>
> ><br>
> > ~~~~~~~~~~<br>
> ><br>
> > df00bbb Carl Eastlund <<a href="mailto:cce@racket-lang.org">cce@racket-lang.org</a>> 2013-03-31 10:34<br>
> > :<br>
> > | Updated contracts for arity-related functions.<br>
> > |<br>
> > | Added contract checking to arity=?, arity-includes?, and<br>
> normalized-arity.<br>
> > | Removed contract checking from normalize-arity to make it a total<br>
> predicate.<br>
> > | Updated documentation for normalize-arity to reflect this change.<br>
> > :<br>
> > M collects/racket/function.rkt | 21<br>
> ++++++++++++++++-----<br>
> > M collects/racket/private/norm-arity.rkt | 2 ++<br>
> > M collects/scribblings/reference/procedures.scrbl | 13 ++++++-------<br>
><br>
> --<br>
> ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:<br>
> <a href="http://barzilay.org/" target="_blank">http://barzilay.org/</a> Maze is Life!<br>
><br>
<br>
--<br>
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:<br>
<a href="http://barzilay.org/" target="_blank">http://barzilay.org/</a> Maze is Life!<br>
<br>
</div></div></blockquote></div><br></div>