[racket] Untyped arithmetics performance
Thanks, that works great. Looks really cool!
Sam
On Mon Jan 26 2015 at 2:27:44 PM Xiangqi Li <artlessu at gmail.com> wrote:
> Right now Medic doesn't support directly running "med.rkt" to get the
> results (has to know the set of medic programs to execute and which source
> file to start debugging). We need to write another program to debug the
> source code. The program should be in the same directory of medic programs:
>
> #lang racket
>
> (require medic/core)
>
> (medic "/tmp/med.rkt")
> (debug "/tmp/src.rkt")
> On Mon, Jan 26, 2015 at 11:42 AM, Sam Tobin-Hochstadt <
> samth at cs.indiana.edu> wrote:
>
>> 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
>>>
>>>
>> ____________________
> 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/6854c8b1/attachment.html>