I'm using version 7.3, amusingly.

James


> On 5 Jun 2019, at 15:47, Philip McGrath <phi...@philipmcgrath.com> wrote:
> 
> What version of Racket are you using? I get a segfault in 7.2, but 7.3 works 
> for me.
> -Philip
> 
> 
> On Wed, Jun 5, 2019 at 10:42 AM James Geddes <james.ged...@gmail.com> wrote:
> Dear All,
> 
> The following Typed Racket program is intended to produce an image of the 
> Mandelbrot set (but it doesn't bother actually displaying the image).
> 
> Running the program using command-line Racket causes a crash. Specifically, 
> Racket terminates with the error message: 
> 
>         Segmentation fault: 11 
> 
> However,
> 
> 1. The program runs successfully in DrRacket;
> 
> 2. Reducing the size of the image to, say, 200 x 200 (by changing the last 
> arguments in the calls to `make-ticks`) also results in successful 
> termination, without a segmentation fault.
> 
> Any advice appreciated!
> 
> (PS: I'm not actually that interested in making pictures. I'm trying to do 
> some speed benchmarks to show my colleagues, particularly those who argue 
> that Python is faster, and this example happened to be on hand.) 
> 
> 
> James
> 
> 
> 
> 
> #lang typed/racket
> 
> ;; Generate an image of the Mandelbrot set 
> (https://en.wikipedia.org/wiki/Mandelbrot_set)
> 
> (define *iteration-limit* : Integer 50)
> 
> (: mandel (-> Float-Complex Integer))
> ;; Given c, iterate z <- z^2 + c starting from z = 0 until either |z| > 2 or 
> the number of iterations
> ;; exceeds *iteration-limit*. Returns the number of iterations required.
> (define (mandel c)
>   (let mandel-iter ([z 0.0+0.0i]
>                     [i 0])
>     (if (or (>= i *iteration-limit*) (> (magnitude z) 2.0))
>         i
>         (mandel-iter (+ c (sqr z)) (+ i 1)))))
> 
> (: brot ((Listof Float) (Listof Float) -> (Listof Integer)))
> ;; Apply mandel to a rectangular grid of complex numbers
> (define (brot xs ys)
>   (for*/list : [Listof Integer]
>       ([y (in-list ys)]
>        [x (in-list xs)])
>     (mandel (make-rectangular x y))))
> 
> (: make-ticks (-> Float Float Integer (Listof Float)))
> (define (make-ticks min max resolution)
>   (range min max (/ (- max min) resolution)))
> 
> (define *xs* (make-ticks -1.5 0.5 300))
> (define *ys* (make-ticks -1.0 1.0 300))
> 
> ;; Compute a Mandelbrot image (but then discard it)
> (void (brot *xs* *ys*))
> 
> 
> 
> 
> -- 
> 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/194F0EE9-0B9E-412B-A2C0-BCE51CD0AA75%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/831D8880-1BBD-4EE2-B112-61BD8E6A1020%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to