On Wed, Dec 09, 2020 at 10:16:16PM -0800, unlimitedscolobb wrote:
> On Wednesday, December 9, 2020 at 11:50:26 PM UTC+1 Ben Greenman wrote:
> 
> > > If the answer is no, is there any interest in including these three 
> > > functions (as well as compose-5, 6, 7, 8) into Typed Racket? 
> >
> > I think these would be excellent in a package. 
> >
> > A package for compose-n and compose-3 to like 10 or 20?
> 
> I'm still not sure about how high the granularity of packages may get in 
> Racket, but I'd like to share these functions, because they feel very 
> useful to me.
>  
> 
> > Someday later, perhaps poly dots and #:rest-star can combine to 
> > improve the built-in type. 
> >
> 
> >From my naive viewpoint, I don't really see other natural ways of improving 
> the type of compose other than what I wrote, the problem being that writing 
> the type for arbitrary-arity composition would require specifying equality 
> between the return type of every function and the argument type of the 
> preceding one.  I'm not sure even Coq and Agda have that facility directly, 
> certainly not Haskell or Idris to the best of my knowledge.  I don't expect 
> them to go beyond binary compose, because it's sufficient to do any 
> compositions.  It's that in Racket I find writing chains of nested compose 
> calls somewhat clunky.
> 
> I'm not sure whether macros could be of use here.  I'll give it a think.

Idea:  Have a look at parendown 
https://docs.racket-lang.org/parendown/index.html

It would let you write
  (compose f 
    (compose g
      (compose h k)))
as
  (  compose f
  #/ compose g
  #/ compose h k
  )

Which at least cuts down on the heavy indentation and parenthesis pile-up.

A macro might be able to generate either of the above from 
  (comp f g h k)
.

-- hendrik

> 
> -
> Sergiu
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/d0eacc64-c11b-4edd-aa38-c62c15494c06n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20201210164936.elqk6qsc76yhn4wc%40topoi.pooq.com.

Reply via email to