Google Groups Home
Help | Sign in
Message from discussion Ray tracer in Stalin
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
Jon Harrop  
View profile
 More options 19 Aug 2005, 17:25
Newsgroups: comp.lang.scheme
From: Jon Harrop <use...@jdh30.plus.com>
Date: Fri, 19 Aug 2005 17:25:59 +0100
Local: Fri 19 Aug 2005 17:25
Subject: Re: Ray tracer in Stalin

Förster vom Silberwald wrote:
> (define
>    (map2e::obj fun::obj lis1::pair-nil lis2::pair-nil)
>    (match-case (list lis2 lis2)
>       [(() ()) '()]
>       [((?h1 ???t1) (?h2 ???t2))
>          (cons
>             (fun h1 h2)
>             (map2 fun t1 t2))]
>       [(?- ?-) (error "map2" "invalid list argument" (list lis
> lis2))]))

In Mathematica:

Map2[f_, {}, {}] := {}
Map2[f_, {h1_, t1___}, {h2_, t2___}] :=
  Prepend[f[h1, h2], Map2[f, {t1}, {t2}]]

I thought the "?h1" vs "h1_" and "???t1" vs "t1___" was quite
interesting. :-)

--
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com


    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