Re: [racket-users] Bitmaps and Canvas sizes

2018-08-11 Thread David Vanderson
Usually you adjust the drawing context's scale. Something like (untested): (define bm (read-bitmap ...)) (define dc (send image-box get-dc)) (define t (send dc get-transformation)) ; save old scale (send dc scale (/ (send image-box get-width) (send bm get-width)) (/ (send image-box

[racket-users] Bitmaps and Canvas sizes

2018-08-11 Thread silverfire675
(define image-box (new canvas% [parent frame] [min-width 300] [min-height 300])) I'm still trying to figure out how the racket/gui library works but I'm having some difficulty understanding how to have an image fill a canvas. I'd like for instance to have a canvas in my gui that

[racket-users] Re: Question about style

2018-08-11 Thread Andrew J
I typically use either threading or composition... (require threading) (define (foo x) (~> x f g h bar)) or (define (foo x) ((compose bar h g f) x) A. On Sunday, 12 August 2018 00:11:19 UTC+10, Robert Heffernan wrote: > > Dear all, > > I am new to Racket and only slightly less

Re: bug#30680: [racket-users] Using Racket's raco on on Guix(SD)

2018-08-11 Thread Christopher Lemmer Webber
Timothy Sample writes: > Christopher Lemmer Webber writes: > >> Konrad Hinsen writes: >> >>> In my tests, all packages ended up working, but performance is indeed >>> worse than with a Racket installation outside of Guix. >>> >>> It would be nice if someone with more knowledge of Racket

Re: [racket-users] C level bit manipulation - Racket Manifesto

2018-08-11 Thread Sam Tobin-Hochstadt
There are basically two differences between the `unsafe-lsb` function in Racket and the C one: - the Racket calling convention vs the C calling convention - the instruction used to perform the LSB calculation For a variety of reasons Racket's function calling convention is more heavyweight than

Re: [racket-users] Question about style

2018-08-11 Thread Deren Dohoda
> > > > My question is: is the way I'm writing things considered to be bad > style? It feels like a hangover from more imperative-style programming > & the inclination to do one thing "per line". On the other hand, it > often helps readability. > I invariably write my code like this. I just

Re: [racket-users] Do I need macros to flag unbound identifiers as failing unit tests?

2018-08-11 Thread Matthew Butterick
> On Aug 11, 2018, at 9:00 AM, Sage Gerard wrote: > > I'm starting to think writing these kind of exercises in a friendly way is > only possible with macros, but before I go that far, is it possible for me to > catch a module-level unbound identifier error and print a rackunit failure >

Re: [racket-users] Do I need macros to flag unbound identifiers as failing unit tests?

2018-08-11 Thread Shu-Hung You
Would convert-syntax-error and convert-compile-time-error work? Sure they are macros, but wrapped up in a nice way. https://docs.racket-lang.org/syntax/macro-testing.html On Sat, Aug 11, 2018 at 11:00 AM, Sage Gerard wrote: > Hi all, > > Still working the koans project and am hitting a design

[racket-users] Do I need macros to flag unbound identifiers as failing unit tests?

2018-08-11 Thread Sage Gerard
Hi all, Still working the koans project and am hitting a design snag. My expected UX is that you clone the repo, run racket koans/all.rkt, and then see nothing but failing unit tests for you to fix. But since some exercises have unbound module identifiers

Re: [racket-users] Re: Question about style

2018-08-11 Thread Shu-Hung You
For small expressions it probably does not matter, but suitably naming intermediate expressions is definitely a good approach as it `explains' the code. Also, replacing let* by define can reduce nesting level. These 2 points are suggested in the style guide 4.2 and 4.4:

Re: [racket-users] Using Racket's raco on on Guix(SD)

2018-08-11 Thread Christopher Lemmer Webber
Konrad Hinsen writes: > On 22/05/2018 15:42, Christopher Lemmer Webber wrote: > >> Unfortunately when I try to install packages with "raco pkg install" >> I get errors like the following: > > I filed a bug report about this problem a while ago: > >

[racket-users] Re: Question about style

2018-08-11 Thread Wolfgang Hukriede
My advice would be to follow your own taste. But drop the brackets. On Saturday, August 11, 2018 at 4:11:19 PM UTC+2, Robert Heffernan wrote: > > Dear all, > > I am new to Racket and only slightly less new to scheme & scheme-like > languages. > > I have noticed myself often doing something

[racket-users] Question about style

2018-08-11 Thread Bob Heffernan
Dear all, I am new to Racket and only slightly less new to scheme & scheme-like languages. I have noticed myself often doing something like the following: (define (foo x) (let* ([y (f x)] [z (g y)] [p (h z)]) (bar p))) Which could, of course, be written as (define (foo

[racket-users] application idea: home "cloud" server services in racket

2018-08-11 Thread Neil Van Dyke
Want to work on "libre" privacy-respecting applications in Racket, but would rather work on servers, than on handheld/desktop apps, right now? It would be good to have a home/family (or small business?) "cloud" server that one can run at home, and customize in Racket. Perhaps in the spirit

[racket-users] C level bit manipulation - Racket Manifesto

2018-08-11 Thread 'Paulo Matos' via Racket Users
Hi, In http://felleisen.org/matthias/manifesto/, you can read: "In support, Racket offers protection mechanisms to implement a full language spectrum, from C-level bit manipulation to soundly typed extensions." What are we talking about here when we mention C-level bit manipulation? Is this