🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #3440

Re: Dynamic typing (part 3)

#3440
From: Nick Rothwell
Date: Wed, 10 Apr 1991 15:22
34 lines
1662 bytes
In article <1593@optima.cs.arizona.edu>, gudeman@cs.arizona.edu (David Gudeman) writes:
> In a Icon (a dynamically typed language) you could define
> 
>   procedure map(f,s)
>   local t,i
>   t := list(*s)
>   every i := 1 to *s do t[i] := f(s[i])
>   return t
>   end
> 
> Try to write this function in a statically typed language so that it
> has all the generality of the math and Icon versions.

(me)	- fun map(f, s) =
	    case s of x :: y => f x :: map(f, y)
	            | nil => nil;
(ml)	> val map = fn : ('a -> 'b) * 'a list -> 'b list

Do I get a prize?

> No, forget the challenge.
> Someone is sure to post a solution (or near solution) using some
> baroque system of static declarations from Ada or some wierd C trick
> (I can think of one...).

Not me, however.

	Nick.

-- 
Nick Rothwell,	Laboratory for Foundations of Computer Science, Edinburgh.
                nick@lfcs.ed.ac.uk    <Atlantic Ocean>!mcsun!ukc!lfcs!nick
~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~
           "I see what you see: Nurse Bibs on a rubber horse."
Technical Details
Message-ID: <8687@skye.cs.ed.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!deccrl!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!edcastle!cs.ed.ac.uk!cs.edinburgh.ac.uk!nick
References: <1593@optima.cs.arizona.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!deccrl!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!edcastle!cs.ed.ac.uk!cs.edinburgh.ac.uk!nick
From: nick@cs.edinburgh.ac.uk (Nick Rothwell)
Newsgroups: comp.lang.misc
Subject: Re: Dynamic typing (part 3)
Message-ID: <8687@skye.cs.ed.ac.uk>
Date: 10 Apr 91 15:22:36 GMT
References: <1593@optima.cs.arizona.edu>
Sender: nnews@cs.ed.ac.uk
Reply-To: nick@lfcs.ed.ac.uk
Organization: Tasha Yar Appreciation Soc... oh, sh*t
Lines: 34