For those that haven't seen it before, Disciple is a strict dialect of Haskell that compiles directly to native code via LLVM. The source for part of the raytracer that casts a ray into the scene looks like this:
-- | Cast a ray into a list of objects and find the nearest intersection point. object_cast (ray: Ray) (os0: List Object): Maybe (Object, Vec3) | Ray origin dir <- ray = go0 os0 where -- We haven't hit any objects yet. go0 Nil = Nothing go0 (Cons o os) = case object_distance ray o of Nothing -> go0 os Just dist -> go1 o dist os -- We already hit an object and we're testing others to see -- if they're closer. go1 oClose oDist Nil = Just (oClose, origin + vec3_muls dir oDist) go1 oClose oDist (Cons o os) = case object_distance ray o of Nothing -> go1 oClose oDist os Just dist' | dist' < oDist -> go1 o dist' os | otherwise -> go1 oClose oDist osFull source code on github