[racket-users] Re: [ANNOUNCE] New package typed-compose
Nice package. I don't have an account and don't know how to do pull request on Marvid thing, but I suggest making a macro generating `compose-n` for arbitrary (statically known) n, and export it along side with the predefined compose-n functions, something along these lines: #lang typed/racket/base (provide make-compose compose-3 compose-4) (require (for-syntax racket/base racket/match racket/list racket/syntax syntax/parse)) (define-for-syntax (make-compose-type n) (with-syntax* ([(t ...) (generate-temporaries (make-list n 't))] [a (generate-temporary 'a)] [(_ ... t₀) #'(a t ...)] [(F ...) (let step ([u #'a] [ts (syntax->list #'(t ...))]) (match ts ['() '()] [(cons t ts*) (cons #`(#,t → #,u) (step t ts*))]))]) #'(∀ (a t ...) (F ... → t₀ → a (define-syntax make-compose (syntax-parser [(_ n:nat) (with-syntax* ([(f ...) (generate-temporaries (make-list (syntax-e #'n) 'f))] [x (generate-temporary 'x)] [T (make-compose-type (syntax-e #'n))] [body (foldr (λ (fᵢ res) #`(#,fᵢ #,res)) #'x (syntax->list #'(f ...)))]) #'(ann (λ (f ...) (λ (x) body)) T))])) (define compose-3 (make-compose 3)) (define compose-4 (make-compose 4)) ;; and so on On Monday, January 4, 2021 at 12:52:11 PM UTC-8 unlimitedscolobb wrote: > Hello, > > I am glad to announce typed-compose, a small package defining some > utilities for composing functions in Typed Racket: > > https://pkgd.racket-lang.org/pkgn/package/typed-compose > > Typed Racket's compose only takes two arguments, because in general it is > difficult to specify that the return types and the argument types should be > the same for two successive functions in the argument list. This package > defines some further utilities to allow compose-ing more than two > functions more comfortable in Typed Racket. > > This is my first ever Racket package, so I'm taking all kinds of feedback. > > - > 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 racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/75c18da4-1403-4f70-8c58-08511d21c71an%40googlegroups.com.
[racket-users] Racket meet-up
Thank you to everyone who joined the racket meet-up today. Record numbers! Next one is 6th Feb -- -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAGHj7-JXFvzY8sAhV%3DpD6K5S7ZeYNeiaonrOSR7XBuuYMrJfow%40mail.gmail.com.
Re: [racket-users] GUI button% string label keyboard mnemonics
On 1/9/2021 3:20 AM, Dominik Pantůček wrote: > Maybe a stupid question ... > > Is "close-icon" the name of the bitmap or a function that creates a > bitmap? I am using images/icons/misc: https://docs.racket-lang.org/images/Icons.html?q=close-icon#%28def._%28%28lib._images%2Ficons%2Fmisc..rkt%29._close-icon%29%29 So it generates a bitmap% in the end. > Have you tried: > > (new button% (label close-icon "" 'left) ...) > Just out of curiosity right now and no, the button% does not accept procedure to be a part of that list. Unfortunately, I'm not well versed in Racket's GUI library - I have done a lot of GUI work in C and C++. In the OS graphics [X, GDI, etc], the button and the icon are separate objects: e.g., deleting the button will not also delete an icon attached to it, so if the icon doesn't have its own handle, you'll lose it and have a resource leak. These things often are handled at higher level by the graphics libraries - and Racket may do that [I don't know] - but my first thought would be to name the icon separately, and then pass the name to the button constructor. E.g., (define my-icon (close-icon)) (new button% (label my-icon "" 'left) ...) I'm thinking that the button isn't functioning correctly because it isn't being constructed improperly. Theoretically the reference to the icon should be the same regardless, but a lot of the library is macro code and who knows what it really expects. When in doubt I try to simplify. YMMV, George -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/2e87e4e8-a576-46e2-0c62-536dac872cab%40comcast.net.
Re: [racket-users] GUI button% string label keyboard mnemonics
> Maybe a stupid question ... > > Is "close-icon" the name of the bitmap or a function that creates a > bitmap? I am using images/icons/misc: https://docs.racket-lang.org/images/Icons.html?q=close-icon#%28def._%28%28lib._images%2Ficons%2Fmisc..rkt%29._close-icon%29%29 So it generates a bitmap% in the end. > Have you tried: > > (new button% (label close-icon "" 'left) ...) > Just out of curiosity right now and no, the button% does not accept procedure to be a part of that list. Dominik -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/971cfa8f-739c-96af-29f2-e243bfc35bdb%40trustica.cz.