Racket v5.3.6 is a bug-fix release. It eliminates errors from v5.3.5 that people have found over the summer.
RacketCon will be held at Northeastern University in Boston on September 29. The details of the event can be found on the website: http://con.racket-lang.org
We also have a page on Lanyrd for the event: http://lanyrd.com/2013/racketcon/
More information about the schedule will be posted in the upcoming weeks.
This is a special-purpose release to match the arrival of “Realm of Racket” in bookstores. Racket v5.3.5 adds a single realm collection to the v5.3.4 release. The new collection contains the source code that readers of Realm may wish to use for experiments.
We are happy to announce the release of Marketplace, a new programming language for building functional network programs. Marketplace combines two fundamental ideas in a new way: nested virtual machines and publish/subscribe messaging. Nesting allows programs to isolate processes and to delimit conversations. While publish/subscribe generalizes point-to-point and broadcast messaging, it smoothly turns the appearance and disappearance of participants and resources into presence and absence messages. Such messages make it particularly easy to start and stop services and to manage resources based on demand.
Here is a simple TCP echo server written in Marketplace:
#lang marketplace (endpoint #:subscriber (tcp-channel ? (tcp-listener 5999) ?) #:conversation (tcp-channel from to _) #:on-presence (spawn #:child (echoer from to))) ;; echoer: TcpAddress TcpAddress -> Transition (define (echoer from to) (transition stateless (endpoint #:subscriber (tcp-channel from to ?) #:on-absence (quit) [(tcp-channel _ _ data) (send-message (tcp-channel to from data))])))
The initial endpoint subscribes to TCP messages on port 5999. When a conversational partner appears, the endpoint spawns a new process that runs an echoer process. The latter is stateless and subscribes to TCP messages. When it gets messages with payload data, it sends them back out with the opposite addressing; when the TCP conversation disappears, it quits.
Thus far, we have built several real systems using Marketplace: a DNS server, a DNS proxy, and an SSH server. The DNS proxy has handled DNS traffic for ourselves and other members of our lab for the last several months.
You can read an overview along with detailed documentation for Marketplace at http://tonyg.github.io/marketplace/.
To get the sources for Marketplace as well as the applications point your browser to https://github.com/tonyg/marketplace.
- Extflonums (80-bit floating-point numbers) are supported on some x86/x86_64 platforms — including Windows, and including platforms where Racket is compiled to use SSE instructions for flonum arithmetic. Thanks to Michael Filonenko.
- OS X: DrRacket and all of the other apps are now signed with an official key.
- Tally Maze: a new game based an enumeration of 2d mazes.
- The Optimization Coach, a DrRacket plugin, has been moved from the Racket distribution to the Racket package repository. Install it with: raco pkg install optimization-coach.
- Redex: define-union-language now merges productions when languages define the same nonterminals. Thanks to William Bowman.
- The srfi/19 library is now compatible with the date structure type exported by racket/base.
Lunch will be provided.
On the Saturday (28th) before RacketCon, we plan to hold a hackathon to work on various Racket projects.
Registration will open during the summer, and we will post a detailed schedule of events around the same time. The conference website is at
About a month ago, inspired by a mailing list post by Tim Brown, Racketeers started to write more solutions to Rosetta Code tasks for Racket. Just today, we’ve reached 200 entries in the Racket category!
This is a nice milestone, but we still have a ways to go. At 200 entries, Racket comes in at around 54th in the popularity rankings. So if you’re looking to practice your Racketeering skills, don’t hesitate to work on some of the remaining tasks.
To give you a taste of the kinds of solutions we have so far, here are some examples.
(define (iterations a z i) (define z′ (+ (* z z) a)) (if (or (= i 255) (> (magnitude z′) 2)) i (iterations a z′ (add1 i)))) (define (iter->color i) (if (= i 255) (make-object color% "black") (make-object color% (* 5 (modulo i 15)) (* 32 (modulo i 7)) (* 8 (modulo i 31))))) (define (mandelbrot width height) (define target (make-screen-bitmap width height)) (define dc (new bitmap-dc% [bitmap target])) (for* ([x width] [y height]) (define real-x (- (* 3.0 (/ x width)) 2.25)) (define real-y (- (* 2.5 (/ y height)) 1.25)) (send dc set-pen (iter->color (iterations (make-rectangular real-x real-y) 0 0)) 1 'solid) (send dc draw-point x y)) target)
> (mandelbrot 300 200)
Yin and Yang:
(define (yin-yang d) (define base (hc-append (inset/clip (circle d) 0 0 (- (/ d 2)) 0) (inset/clip (disk d) (- (/ d 2)) 0 0 0))) (define with-top (ct-superimpose base (cc-superimpose (colorize (disk (/ d 2)) "white") (disk (/ d 8))))) (define with-bottom (cb-superimpose with-top (cc-superimpose (disk (/ d 2)) (colorize (disk (/ d 8)) "white")))) (cc-superimpose with-bottom (circle d)))
> (yin-yang 200)
Animate a pendulum:
#lang racket (require 2htdp/image 2htdp/universe) (define (pendulum) (define (accel θ) (- (sin θ))) (define θ (/ pi 2.5)) (define θ′ 0) (define θ′′ (accel (/ pi 2.5))) (define (x θ) (+ 200 (* 150 (sin θ)))) (define (y θ) (* 150 (cos θ))) (λ (n) (define p-image (underlay/xy (add-line (empty-scene 400 200) 200 0 (x θ) (y θ) "black") (- (x θ) 5) (- (y θ) 5) (circle 5 "solid" "blue"))) (set! θ (+ θ (* θ′ 0.04))) (set! θ′ (+ θ′ (* (accel θ) 0.04))) p-image)) (animate (pendulum))
#lang algol60 begin integer i; real procedure sum (i, lo, hi, term); value lo, hi; integer i, lo, hi; real term; comment term is passed by-name, and so is i; begin real temp; temp := 0; for i := lo step 1 until hi do temp := temp + term; sum := temp end; comment note the correspondence between the mathematical notation and the call to sum; printnln (sum (i, 1, 100, 1/i)) end
Thanks to all of the people who have contributed solutions so far!