Re: [racket-users] How to apply side effects to all elements in a list

2017-03-22 Thread Matthias Felleisen
Yes! John just taught you how to fish. > On Mar 22, 2017, at 3:51 PM, 'John Clements' via Racket Users > wrote: > > >> On Mar 22, 2017, at 12:45 PM, Angus wrote: >> >> I am a bit stuck on rendering images in a list. >> >> Here is my

Re: [racket-users] refactoring help/tools?

2017-03-22 Thread Daniel Feltey
I think I've finally got something working within DrRacket so I've just pushed a change to check-syntax[1] which adds a `Remove Unused Requires` right-click menu item to DrRacket which will remove all requires which check-syntax marks as unused. If you're using DrRacket from github, I'd

Re: [racket-users] How to apply side effects to all elements in a list

2017-03-22 Thread Daniel Prager
Hi Angus Usually it helps to start by getting something simple to work and then little-by-little adding more. E.g. Here's a working example with squares instead of bears, and limited to just varying rotation ... #lang racket (require 2htdp/image) (define blue-square (square 25 'solid 'blue))

[racket-users] LibrePlanet 2017 this weekend

2017-03-22 Thread Neil Van Dyke
Sorry for the short notice[*], but the FSF's major LibrePlanet conference is this weekend at MIT. Some of the talks look potentially relevant to Racketeers, like "The Lisp machine and GNU" and "The set of programmers: How math restricts us". Would be good to have some Racket presence there,

Re: [racket-users] How to apply side effects to all elements in a list

2017-03-22 Thread Alex Knauth
> On Mar 22, 2017, at 12:51 PM, 'John Clements' via Racket Users > wrote: > >> On Mar 22, 2017, at 12:45 PM, Angus wrote: >> >> render-bear works but I can't get render-bears to work. What am I doing >> wrong? Any hints? > > Rendering

Re: [racket-users] How to apply side effects to all elements in a list

2017-03-22 Thread Sam Caldwell
2thdp/image isn't effectful; images are values. You need to combine the image you get from rendering one bear with the image you get from rendering the rest of the list. You can do so using one of the combiners provided by the library: (combiner-of-choice (render-bear (first bears))

Re: [racket-users] How to apply side effects to all elements in a list

2017-03-22 Thread 'John Clements' via Racket Users
> On Mar 22, 2017, at 12:45 PM, Angus wrote: > > I am a bit stuck on rendering images in a list. > > Here is my code below. > > (require 2htdp/image) > > (define-struct bear-state (x y rotation size)) > > (define MTS (empty-scene WIDTH HEIGHT)) > > BEAR-IMAGE is just

[racket-users] How to apply side effects to all elements in a list

2017-03-22 Thread Angus
I am a bit stuck on rendering images in a list. Here is my code below. (require 2htdp/image) (define-struct bear-state (x y rotation size)) (define MTS (empty-scene WIDTH HEIGHT)) BEAR-IMAGE is just a graphic - of a bear. (define (render-bear b) (place-image (scale (bear-state-size b)

Re: [racket-users] syntax-parse: using expr/c with ~optional

2017-03-22 Thread Dupéron Georges
> (prefix 6 5 4) raises the same error as before, and the definition of > prefix/parse complains "syntax-parse: duplicate attribute in: tail". This is because ~or behaves differently under ellipses, and nested ~or are just inlined. Your code for prefix/parse is therefore equivalent to (~or alt1

Re: [racket-users] How to store a list (or struct...) in SQL and extract again as original Racket value

2017-03-22 Thread Philip McGrath
To work with strings for the database, do something like this: (define (serialize-to-string v) (with-output-to-string (λ () (write (serialize v) (define (deserialize-from-string str) (with-input-from-string str (λ () (deserialize (read) On Tuesday, March 21, 2017 at 8:52:55 PM