Google Groups Home
Help | Sign in
Message from discussion Port my ray tracer
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Vesa Karvonen  
View profile
 More options 2 Jun 2005, 16:05
Newsgroups: comp.lang.functional
From: Vesa Karvonen <vesa.karvo...@cs.helsinki.fi>
Date: 2 Jun 2005 15:05:33 GMT
Local: Thurs 2 Jun 2005 16:05
Subject: Re: Port my ray tracer
Jon Harrop <use...@jdh30.plus.com> wrote:

[...]
> I'm keen to hear any constructive criticisms of my existing
> implementations.
[...]
>         let val r' = 3.0 * r / Real.Math.sqrt 12.0 in
>             let fun aux x' z' =
>                     create (level-1) (0.5 * r) (x-x', y+r', z+z') in
>                 let val objs = [aux (~r') (~r'), aux r' (~r'),
>                                 aux (~r') r', aux r' r', obj] in
>                     Group ((x, y, z), 3.0 * r, objs)
>                     end end end end

[...]

This won't have an effect on performance, but the above style of
let-nesting (used throughout the code), which is probably a result of
a conservative translating from OCaml, is not necessary in SML. In
SML, you can flatten the nested let-expressions. In other words, you
can flatten an expression of the form

  let val ... in
  let val ... in
    ...
  let val in ... end ... end end

into

  let val ...
      val ...
      ...
  in ... end

-Vesa Karvonen


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google