[racket-users] lovely illustration of the importance of teaching languages...

2017-04-26 Thread 'John Clements' via Racket Users
This nightmarish but organic example produced by a student actually works correctly, and is a beautiful example of why we need teaching languages (or a type system that enforces boolean inputs to ‘or’): https://www.brinckerhoff.org/blog/ Note that while the actual student code is in python,

[racket-users] Re: How to improve compile times?

2017-04-26 Thread Alex Harsanyi
I would also like to know more about this topic. I have never done any rigorous tests, however for my application which takes about 7 seconds to load, I have observed the following: * there is no big startup difference between running the application as "racket run.rkt" (which loads the

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

2017-04-26 Thread Daniel Prager
On Thu, Apr 27, 2017 at 12:34 PM, Vishesh Yadav wrote: > >> BTW: I'm interested in porting to RacketScript. How does the performance >> of the image library equivalent compare with regular Racket? >> >> > It is slower than regular Racket. I did not spend much time comparing

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

2017-04-26 Thread Vishesh Yadav
> > > BTW: I'm interested in porting to RacketScript. How does the performance > of the image library equivalent compare with regular Racket? > > It is slower than regular Racket. I did not spend much time comparing it with Racket, and there is definitively scope for improvement. Let us know how

Re: [racket-users] Lexical context for all-defined-out

2017-04-26 Thread Philip McGrath
Thanks, that does the trick! -Philip On Wed, Apr 26, 2017 at 6:27 PM, Matthew Flatt wrote: > The `all-defined-out` macro supports a trick that several non-hygienic > macros use: it uses the scopes on the parentheses around > `all-defined-out` non-hygienically, instead of

Re: [racket-users] Lexical context for all-defined-out

2017-04-26 Thread Matthew Flatt
The `all-defined-out` macro supports a trick that several non-hygienic macros use: it uses the scopes on the parentheses around `all-defined-out` non-hygienically, instead of the scopes on the identifier. So, in place of (datum->syntax stx '(all-defined-out))) you can use (datum->syntax stx

[racket-users] Lexical context for all-defined-out

2017-04-26 Thread Philip McGrath
I'm working on a #%module-begin variant that provides all module-level bindings, and I'm having trouble finding the right way to give lexical context to all-defined-out. The issue (IIUC) is that all-defined-out only exports identifiers "that have the same lexical context as the (all-defined-out)

[racket-users] Re: #:grammar and #:contracts of scribble

2017-04-26 Thread Dupéron Georges
Hi, This sounds like a nice enhancement. You might want to request this at https://github.com/racket/scribble/issues . Aside from the implementation difficulty (the code for defform and friends is large, handles many edge cases, and feels a bit like spaghetti code), one of the main concerns

[racket-users] How to improve compile times?

2017-04-26 Thread Dupéron Georges
Hi all! Some of my libraries take a while to load: just adding a (require mylib) to an empty #lang racket/base file bumps the compile time from 0.5s to 1.5s, even if no bindings from the library are used. After experimenting a bit, it seems that the overhead is mainly due to other modules

Re: [racket-users] Announcing Leibniz, a new language in the Racket universe

2017-04-26 Thread Dmitry Pavlov
Konrad, Sorry I am a bit late to the party. You may remember me from this topic: https://groups.google.com/forum/#!topic/racket-users/E6utg2Pv5hA where I looked for a scientific language and a tool for code generation. Leibniz seems to be very general. Is generation of (C or other) code from

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

2017-04-26 Thread Jack Firth
On Wednesday, April 26, 2017 at 9:48:56 AM UTC-7, David K. Storrs wrote: > On Wed, Apr 26, 2017 at 12:21 AM, Jon Zeppieri wrote: > I don't know that there's a right way, but if your functions are > > nullary, then promises are a decent fit: > > > > (define conf > >  

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

2017-04-26 Thread Jon Zeppieri
On Wed, Apr 26, 2017 at 12:48 PM, David Storrs wrote: > > > On Wed, Apr 26, 2017 at 12:21 AM, Jon Zeppieri wrote: >> >> I don't know that there's a right way, but if your functions are >> nullary, then promises are a decent fit: >> >> (define conf >>

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

2017-04-26 Thread David Storrs
On Wed, Apr 26, 2017 at 12:21 AM, Jon Zeppieri wrote: > 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

Re: [racket-users] Announcing Leibniz, a new language in the Racket universe

2017-04-26 Thread Konrad Hinsen
Alexander McLin writes: > One paper I have in mind is Hodgkin & Huxley's paper published in 1952 > where they first wrote down the equations describing the membrane > voltage of the giant squid > axon. >

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

2017-04-26 Thread Matthias Felleisen
#lang racket (define read-conf (let [(conf (delay (with-input-from-file “db.conf" (thunk (displayln "hello") (read)] (thunk (force conf (read-conf) (read-conf) -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To

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

2017-04-26 Thread Tim Brown
On Wednesday, April 26, 2017 at 5:21:41 AM UTC+1, Jon Zeppieri wrote: > (define conf > (delay > (with-input-from-file ...))) > > Then just (force conf) whenever you want the value. I tend to call promises xxx-promise (e.g. conf-promise), to remind me not to use them without force'ing them.

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

2017-04-26 Thread Norman Gray
Greetings. On 25 Apr 2017, at 23:51, 'John Clements' via Racket Users wrote: In answer to your actual question, the most common name is “Tail Call Optimization,” which many people correctly object to because it’s not an optimization, it’s a change to the meaning of terms in the language

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

2017-04-26 Thread Jack Firth
A `define/delay` macro for this might be a good addition to `racket/promise`: (define-simple-macro (define/delay id:id expr:expr) (begin (define p (delay expr)) (define (id) (force p (define/delay conf (with-input-from-file "db.conf" read-json)) (conf) ;; forces promise -- You

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

2017-04-26 Thread Daniel Prager
Thank-you all for the suggestions. I'll check them out and report back. Vishesh: There is some repetition (not animation), but I removed all caching to simplify and rework the interactive flow. It would be with trying freeze in conjunction with updated caching. BTW: I'm interested in porting to

Re: [racket-users] How to make unit test for error "unbound identifier"?

2017-04-26 Thread Alexis King
You can use convert-syntax-error from syntax/macro-testing to convert the syntax error to a runtime error, which can be caught by RackUnit: http://docs.racket-lang.org/syntax/macro-testing.html#%28form._%28%28lib._syntax%2Fmacro-testing..rkt%29._convert-syntax-error%29%29 Alexis > On Apr 25,

[racket-users] Re: How to make unit test for error "unbound identifier"?

2017-04-26 Thread Jinzhou Zhang
Sorry for forgot to mention Racket version. It is 6.8. -- 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

[racket-users] How to make unit test for error "unbound identifier"?

2017-04-26 Thread Jinzhou Zhang
Hi there, I am writing a simple macro `if-let` that tried to bind the condition to a variable. ``` (define-simple-macro (if-let (~describe "binding pairs" [binding:expr value:expr]) (~describe "\"then\" clause" then:expr) (~describe