[racket] Untyped arithmetics performance
Hi Xiangqui,
I just tried to run this, but it didn't show anything.
I put this in /tmp/src.rkt:
#lang racket
(for/fold ([v 0]) ([x (in-range 100)])
(+ v (/ x 100)))
(for/fold ([v 0]) ([x (in-range 100)])
(+ v (/ x (- 100 x))))
and this in /tmp/med.rkt:
#lang medic
(layer layer1
(in #:module (file "/tmp/src.rkt")
[(at (+ v (/ x 100))) [on-entry (timeline v)]]
[(at (+ v (/ x (- 100 x)))) [on-entry (timeline v)]]))
And then tried running "med.rkt" either in DrRacket or at the command line.
It doesn't print anything that I can see. Do I need to do something else?
I have the latest version of medic installed, I think.
Sam
On Mon, Jan 26, 2015 at 1:22 PM, Xiangqi Li <artlessu at gmail.com> wrote:
> For the testing program provided by Matthew, we can also use *(timeline
> v)* (an enhanced version of displayln) to compare the value of v at each
> iteration and see the results in a better way:
>
>
> If you want to try it out yourself, you can go to
> https://github.com/lixiangqi/medic and install the Medic package which
> has support for timeline. By writing the following Medic program,
>
> #lang medic
>
> (layer layer1
> (in #:module "src.rkt"
> [(at (+ v (/ x 100))) [on-entry (timeline v)]]
> [(at (+ v (/ x (- 100 x)))) [on-entry (timeline v)]]))
>
> you'll see a timeline view of results.
>
> Xiangqi
>
> On Sat, Jan 24, 2015 at 09:56 AM, Matthew Flatt <mflatt at cs.utah.edu>
> wrote:
>
>>
>> Jens Axel and Alexander have provided the answer, but in case it helps
>> to see what they mean, try these loops that display the intermediate
>> results:
>>
>> (for/fold ([v 0]) ([x (in-range 100)])
>> (displayln v)
>> (+ v (/ x 100)))
>>
>> (for/fold ([v 0]) ([x (in-range 100)])
>> (displayln v)
>> (+ v (/ x (- 100 x))))
>>
>>
>
> ____________________
> 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/20150126/4dd7c903/attachment-0001.html>