[racket] LC53

From: Richard Cleis (rcleis at me.com)
Date: Sat Nov 17 07:42:55 EST 2012

I am not familiar with your subject matter, or your point. Without a set of inputs and outputs, I cannot discern if I succeeded.

#lang racket

(define (make-f n-bits k1 k2)
  (define limit (expt 2 n-bits))
  (define m (- limit k1))
  (define a (- limit k2))
  (lambda (i x) (modulo (* a x) m)))

(define (g n f lox)
  (cond ((<= n 0) lox)
        (else (g (sub1 n) f (cons (f n (car lox)) lox)))))

(g 4 (make-f 32 5 333333333) '(123456789)


'(3864819999 806650895 1510242424 1116891036 123456789)

rac


On Nov 17, 2012, at 5:24 AM, Hugh Aguilar wrote:

> Well, if by "examples" you mean valid values for X, any 32-bit number other than 0 will work.
> 
> From: Richard Cleis <rcleis at me.com>
> To: Hugh Aguilar <hughaguilar96 at yahoo.com> 
> Cc: "users at racket-lang.org" <users at racket-lang.org> 
> Sent: Saturday, November 17, 2012 4:59 AM
> Subject: Re: [racket] LC53
> 
> Only excessively brave Racketeers would attempt that without a good set of examples. :-)
> 
> rac
> 
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121117/a1e311ef/attachment.html>

Posted on the users mailing list.