Re: [racket-users] Speeding up graphics / moving away from 2htdp/image

2017-04-25 Thread Vishesh Yadav
Are you repeatedly generating image for an animation inside an event loop? Depending on the kind of program `freeze` from 2htdp/image may help if you haven't tried already. For example this[1] program renders faster with freeze both in RacketScript and 2htdp/image. [1]

[racket-users] Re: Speeding up graphics / moving away from 2htdp/image

2017-04-25 Thread Alex Harsanyi
On Wednesday, April 26, 2017 at 12:09:54 PM UTC+8, Daniel Prager wrote: > Much as I enjoy making images using 2htdp/image it does get a tad slow as > complexity increases. > > I currently have a program in which I generate images in 2htdp/image and > translate them into bitmap%s per racket/gui

Re: [racket-users] Speeding up graphics / moving away from 2htdp/image

2017-04-25 Thread WarGrey Gyoudmon Ju
Hi Daniel, I have a functional bitmap library[1] as a part of my CSS engine. This library is inspired by the official pict-lib and flomap(images-lib), and handles bitmap% directly. I don't think it is efficient enough since every functional operation creates another bitmap%. Here I recommend you

[racket-users] Re: Best way to write run-once-and-cache functions?

2017-04-25 Thread Alex Harsanyi
On Wednesday, April 26, 2017 at 12:12:26 PM UTC+8, David K. Storrs wrote: > > I could do it with a parameter but that's only sweeping the above ugliness > under the rug: > > (define conf (make-parameter #f)) > > (define (read-conf) >    (or (conf) > (begin >    (conf

Re: [racket-users] Best way to write run-once-and-cache functions?

2017-04-25 Thread Jon Zeppieri
I don't know that there's a right way, but if your functions are nullary, then promises are a decent fit: (define conf (delay (with-input-from-file ...))) Then just (force conf) whenever you want the value. On Wed, Apr 26, 2017 at 12:12 AM, David Storrs wrote: >

Re: [racket-users] Best way to write run-once-and-cache functions?

2017-04-25 Thread Philip McGrath
In this very simple case, I would probably not define a function at all, just something like (define conf (with-input-from-file "db.conf" read-json)) You may also find yourself wanting define-runtime-path from racket/runtime-path. On Tue, Apr 25, 2017 at 11:12 PM, David Storrs

[racket-users] Best way to write run-once-and-cache functions?

2017-04-25 Thread David Storrs
Reading configuration files is a good example of a run-once function. It's effectively self-memoizing -- it should run once, cache its result, and on future calls just return the cached value. I could pull in https://docs.racket-lang.org/memoize/index.html or

[racket-users] Speeding up graphics / moving away from 2htdp/image

2017-04-25 Thread Daniel Prager
Much as I enjoy making images using 2htdp/image it does get a tad slow as complexity increases. I currently have a program in which I generate images in 2htdp/image and translate them into bitmap%s per racket/gui and render on canvas%'s via a dc. Speed has become sluggish and I'm going to need

Re: [racket-users] Setting parameters between files does not work as expected

2017-04-25 Thread David Storrs
Thanks Ryan, I had forgotten that those were there. ​ -- 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

Re: [racket-users] Re: Proper non-tail recursion?

2017-04-25 Thread Jay McCarthy
+1 to Robby's idea :P On Tue, Apr 25, 2017 at 9:50 PM, Robby Findler wrote: > "..., Hooray!" ? :) > > Robby > > On Tue, Apr 25, 2017 at 8:46 PM Jordan Johnson wrote: >> >> On Apr 25, 2017, at 6:09 PM, Matthias Felleisen

Re: [racket-users] Re: Proper non-tail recursion?

2017-04-25 Thread Robby Findler
"..., Hooray!" ? :) Robby On Tue, Apr 25, 2017 at 8:46 PM Jordan Johnson wrote: > On Apr 25, 2017, at 6:09 PM, Matthias Felleisen > wrote: > > While I am at it, let me advocate PITCH as the slogan for Proper > Implementation of Tail Calls. (Where

Re: [racket-users] Re: Proper non-tail recursion?

2017-04-25 Thread Jordan Johnson
On Apr 25, 2017, at 6:09 PM, Matthias Felleisen wrote: > While I am at it, let me advocate PITCH as the slogan for Proper > Implementation of Tail Calls. (Where does the H come from? I added it to make > a complete word.) Proper Implementation of Tail Call Handling? :)

Re: [racket-users] Re: Proper non-tail recursion?

2017-04-25 Thread Matthias Felleisen
Brendan, you’re correct in attributing the idea that the proper implementation of tail calls is far less important to the Scheme and Racket community. Dybvig expressed this idea first in a talk titled a Bag of Hacks in the early 90s. Matthew then at some point said that the true goal is to

[racket-users] Re: Proper non-tail recursion?

2017-04-25 Thread brendan
Good points: It wasn't strictly true to say that you can make non-tail calls "without fear." Rather, your memory for continuation frames is shared with, and just as large as, any other kind of data. -- You received this message because you are subscribed to the Google Groups "Racket Users"

Re: [racket-users] Proper non-tail recursion?

2017-04-25 Thread Robby Findler
Ah, lucky you. This is not a "stack overflow". This is a "all of memory overflow". The cool thing about racket is that there is not separate limit on some mysterious PL-internal data structure called a "stack". Robby On Tue, Apr 25, 2017 at 6:13 PM Matthew Butterick wrote: > >

Re: [racket-users] Proper non-tail recursion?

2017-04-25 Thread Jon Zeppieri
On Tue, Apr 25, 2017 at 6:37 PM, brendan wrote: > Scheme implementations are required to have proper tail recursion. Racket > goes further and lets the programmer make recursive calls from any position > without fear because, to paraphrase Dr. Flatt, it's the 21st century

Re: [racket-users] Proper non-tail recursion?

2017-04-25 Thread Matthew Butterick
> On Apr 25, 2017, at 4:05 PM, brendan wrote: > > Indeed; I should have clarified that I didn't mean only recursion per se. Not > the first time I've stumbled on that misnomer. > > On Tuesday, April 25, 2017 at 6:53:59 PM UTC-4, Robby Findler wrote: >> I think the

Re: [racket-users] Proper non-tail recursion?

2017-04-25 Thread 'John Clements' via Racket Users
> On Apr 25, 2017, at 4:05 PM, brendan wrote: > > Indeed; I should have clarified that I didn't mean only recursion per se. Not > the first time I've stumbled on that misnomer. Forgive me. In that case, I’m not sure exactly what property it is you’re looking for a name

Re: [racket-users] Proper non-tail recursion?

2017-04-25 Thread brendan
Indeed; I should have clarified that I didn't mean only recursion per se. Not the first time I've stumbled on that misnomer. On Tuesday, April 25, 2017 at 6:53:59 PM UTC-4, Robby Findler wrote: > I think the question is about non-tail calls and limits on them.  > > > Robby > > > > On Tue,

Re: [racket-users] Proper non-tail recursion?

2017-04-25 Thread Robby Findler
I think the question is about non-tail calls and limits on them. Robby On Tue, Apr 25, 2017 at 5:52 PM 'John Clements' via Racket Users < racket-users@googlegroups.com> wrote: > > > On Apr 25, 2017, at 3:37 PM, brendan wrote: > > > > Scheme implementations are required to

Re: [racket-users] Proper non-tail recursion?

2017-04-25 Thread 'John Clements' via Racket Users
> On Apr 25, 2017, at 3:37 PM, brendan wrote: > > Scheme implementations are required to have proper tail recursion. Racket > goes further and lets the programmer make recursive calls from any position > without fear because, to paraphrase Dr. Flatt, it's the 21st

[racket-users] Proper non-tail recursion?

2017-04-25 Thread brendan
Scheme implementations are required to have proper tail recursion. Racket goes further and lets the programmer make recursive calls from any position without fear because, to paraphrase Dr. Flatt, it's the 21st century and stack overflows should not be a thing. My questions are: Is there a name

Re: [racket-users] Setting parameters between files does not work as expected

2017-04-25 Thread Ryan Culpepper
You might be interested in `dsn-connect` and the `data-source` structure (http://docs.racket-lang.org/db/connect.html#%28part._.Data_.Source_.Names%29). Ryan On 4/25/17 8:18 PM, David Storrs wrote: Great. Thanks, Phillip! On Tue, Apr 25, 2017 at 2:14 PM, Philip McGrath

Re: [racket-users] Any work on demo.racket-lang.org?

2017-04-25 Thread Tim Brown
Matthew, I’m no lawyer, but... On Tuesday, April 25, 2017 at 4:45:29 PM UTC+1, Matthew Butterick wrote: > PS about Rosetta Code generally. As a user, its utility is hugely > undermined by the fact that I can't take code from the site and easily > adapt / reuse it (at least, if I want to comply

[racket-users] [Call for Tutorials] CUFP 2017

2017-04-25 Thread Runhang Li
Call for Tutorials Commercial Users of Functional Programming (CUFP) 2017 September 7th-9th, 2017, Oxford, United Kingdom Co-located with International Conference on Functional Programming (ICFP) Dear Racket

Re: [racket-users] Setting parameters between files does not work as expected

2017-04-25 Thread David Storrs
Great. Thanks, Phillip! On Tue, Apr 25, 2017 at 2:14 PM, Philip McGrath wrote: > >1. Yes, that was supposed to be (current-database-handle) >2. A struct would definitely be a reasonable choice for the spec, but >you might just want to add a failure result

Re: [racket-users] Setting parameters between files does not work as expected

2017-04-25 Thread Philip McGrath
1. Yes, that was supposed to be (current-database-handle) 2. A struct would definitely be a reasonable choice for the spec, but you might just want to add a failure result to the hash-ref calls inside initialize: in that case default-database-spec could just be #hasheq(), and you

Re: [racket-users] Setting parameters between files does not work as expected

2017-04-25 Thread David Storrs
On Mon, Apr 24, 2017 at 9:46 PM, Philip McGrath wrote: > Another thing that might be relevant: >> >> In contrast, direct assignment to a parameter (by calling the parameter >> procedure with a value) changes the value in a thread cell, and therefore >> changes the

Re: [racket-users] Any work on demo.racket-lang.org?

2017-04-25 Thread Matthew Butterick
> On Apr 25, 2017, at 3:14 AM, Tim Brown wrote: > > 1 Volume: there are 932 tasks implemented on Rosetta Code; all of > which have some value. Since I have contributed a fair number of > these, I know that there is a good amount of time required to just > review each of

Re: [racket-users] Any work on demo.racket-lang.org?

2017-04-25 Thread Tim Brown
Matthew, Food for thought -- so here’s a bit of thinking out loud. On Tuesday, April 25, 2017 at 3:42:32 AM UTC+1, Matthew Butterick wrote: > Instead of a wiki, perhaps consider collecting demo code samples into > a new Racket package & adding explanations via Scribble docs. In turn, > these

[racket-users] Re: Any work on demo.racket-lang.org?

2017-04-25 Thread Tim Brown
Greg, On Monday, April 24, 2017 at 9:13:30 PM UTC+1, Greg Trzeciak wrote: > Regarding the Rosetta Code scraper - I have 90% of the task completed - I > will post my code on github sometime tomorrow. It still needs some work to > have it published - the number of code samples is huge so is the