Re: [racket-dev] [racket] A puzzle

2011-01-20 Thread Matthias Felleisen


Anyone up for a dissertation? Multi-stepping debugging is, eh, pushing it. 




On Jan 19, 2011, at 2:43 PM, Doug Orleans wrote:

 The following program was a puzzle in the 2011 MIT Mystery Hunt held last 
 weekend.  (I'm not linking directly to the site because they posted a 
 solution and I don't want you to be tempted to look at the answer 
 prematurely...)  I was disappointed that Dr Racket doesn't seem to have a 
 multi-threaded stepping debugger, at least not in a form that could easily 
 run this program-- correct me if I'm wrong.
 
 I would be interested to hear what other ideas people have about solving this 
 puzzle, either automatically or by hand (or some combination).  But, I 
 haven't solved it myself yet, so I may be avoiding reading replies for a 
 while...
 
 --Doug
 
 
 
 Efficiency
 The Prince is quite proud of his competitive Katamari-rolling time record, 
 having mastered the art of multitasking.
 
 All procedure calls are evaluated from left to right.
 
 
 
 
 
 (define (send x)
   (if (or (integer? x) (char? x))
   (display x)
   (send x))
   (flush-output)
   #t)
 (define (sendc x)
   (if (and (= x 0) ( x 26))
   (send (integer-char (+ 65 x)))
 
 
   (sendc x)))
 
 
 (define a 2)
 (define b '(11))
 (define c 5)
 (define d 30)
 (define e 3)
 
 (thread
  (lambda ()
(set! a (* a (first a)))
(send a)
(set! c (lambda () (- b 4)))
 
 
(set! c (lambda () (- b 11)))
 
(set! d (rest d))
(sendc (/ 4 (+ (- c) c)))
(set! a (sqrt (+ c (* c c
(sendc b)
(set! b '(((24 12 15 (2))) 1 (5 1) 3 2 8 10 (9 1 (3)) ((3) (1)) 5 14 10))
 
 
(set! d '())
 
(sendc (length (append c b)))
(sendc (length (append a b c c c d)))
(set! d 2)
(map (lambda (x)
   (set! c (first b))
   (sendc x)
   (set! b c)) a)
 
 
(send (* (+ 3 (first c)) 100 (- (sqrt a) 1)))
 
(set! a (+ a 1))
(set! e (- e 1))
))
 
 (thread
  (lambda ()
(set! a (list c))
(set! a (lambda (x) (if x (sendc x) x)))
(let loop ()
 
 
  (set! b (c))
 
  (if (a b)
  (loop)
  (set! d '(2 4 8 16 32
(set! c (first d))
(set! c (second d))
(set! b (- a (sqrt (first d
(set! a (list 14 (- (length b) 1) c))
 
 
(let loop ()
 
  (set! d b)
  (if (null? d)
  (set! a (+ a 1))
  (begin
(sendc (first d))
(set! b (rest d))
(loop
(set! e (- e 1))
))
 
 
 
 
 (thread
  (lambda ()
(set! b d)
(set! c (lambda () (/ b 2)))
(let loop ()
  (set! d (- d 10))
  (if (and (= d 0)
   (= b 0)
 ( b 0))
  (set! b #f)
 
 
  (loop)))
 
(set! c (first d))
(set! a 0)
(sendc (length b))
(set! c (list (second b)))
(sendc (sqrt (+ 12 (length d
(send (+ (/ (foldl * 26 a)
(+ (length (append a b))
 
 
 (* (length c) (length c
 
 d))
(set! a (first b))
(sendc (/ 204 a))
(set! e (- e 1))
))
 
 (let loop ()
   (if ( e 0)
   (loop)
   (newline)))
 
 _
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] Building without docs

2011-01-20 Thread Noel Welsh
On Thu, Jan 20, 2011 at 7:12 PM, John Clements
cleme...@brinckerhoff.org wrote:
 There are a bunch of comments in raco's main.rkt about absolutely never ever 
 creating a .zo for this file.  Does this call to racket create such a file?

I can check, but not till tomorrow afternoon at the earliest.
(racket-lang.org being down today wedged my attempts at installation.)

N.
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] changing #lang plai to depend on racket rather than scheme?

2011-01-20 Thread John Clements

On Jan 19, 2011, at 1:13 PM, Jay McCarthy wrote:

 2011/1/19 John Clements cleme...@brinckerhoff.org:
 I went looking for the immutable hash table functions in plai today, and I 
 discovered that since plai is based on #lang scheme rather than #lang 
 racket, you need to use old names in a bunch of places.
 
 Just for the heck of it, I went ahead and changed scheme - racket in two 
 places in plai/main.rkt, and... things seem to work fine.  However, I don't 
 see a test suite that I could run to check this.
 
 1) Is there a test suite somewhere? The obvious one would be running all of 
 the code in the PLAI textbook.
 
 There are very small test suites for the core library (datatype and
 test) in tests/plai

Ran 'em all. They all produce what appears to be successful output.  I had to 
change the web example to wrap Hello in (response/xexpr ...); I don't know 
whether that change would have been required anyhow.

I committed and pushed the changes.

John



smime.p7s
Description: S/MIME cryptographic signature
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev