Hi there,

  This is my first post, pardon my ignorance. I have been using a homemade 
macro to compose functions together, but still allow semi-currying of 
functions (with lambdas) to keep control of the parameters :

(define-syntax (composex stx)
  ; macro to compose functions passing an 'x' parameter
  (syntax-case stx ()
    ((_ f1 ...)
     (with-syntax ([x-var (datum->syntax stx 'x)])
       #'(compose1 (λ (x-var) f1) ...)))))
; unit test
(check-equal? ((composex (string-replace x " " "-")
                         (string-downcase x)
                         (string-trim x)) "Hello World")
              "hello-world")


I often use this or (apply composex (reverse v)) to keep function 
applications in order.

Can you comment on this? Do you think this could be part of the language?

Cheers,

Dexter

P.S. For use in the wild, see provide-generator. Makes generate-provide more 
readable :
https://github.com/DexterLagan/provide-generator

-- 
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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to