[racket] complex sort or how to sort lines

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat May 26 11:03:16 EDT 2012

On May 26, 2012, at 10:32 AM, Don Green wrote:

> (with-output-to-file file
>  #:exists 'replace
>  (lambda ()
>    (for ((ch content)) (display ch)))) ;<<<<<<<<<<<<<<<<<<what is ch?

Like all languages, Racket for loops specify a variable _ch_ that run over some compound data structure, in this case the string in _content_ . 

> ;; --- test
> (check-equal? (with-output-to-string
>               (lambda ()
>                 (for ((ln (answer file)))
>                   (displayln (string-join ln))))) ;<<<<<procedure string-join: expects 2 arguments, given 1: '("Do" "you" "think" "it" "is" "long" "enough?")
>              expected)

I assume you're running a version of DrRacket that's a bit behind. Add " " as the second argument. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120526/1a5cb0ef/attachment-0001.html>

Posted on the users mailing list.