Article View: comp.lang.misc
Article #5678Re: a simple miranda problem
From: Will Clinger
Date: Wed, 10 Aug 1988 18:24
Date: Wed, 10 Aug 1988 18:24
28 lines
1216 bytes
1216 bytes
I've never programmed in Miranda, but the standard practice in functional
languages is to associate to the left. Thus I believe the Miranda program
answer = twice twice twice suc 0
twice f x = f (f x)
suc x = x + 1
would be written in Scheme as
(define twice
(lambda (f)
(lambda (x)
(f (f x)))))
(define suc
(lambda (x)
(+ x 1)))
(define answer
((twice
(twice
(twice suc)))
0))
and so the answer is 8.
William Clinger
Semantic Microsystems, Inc.
Technical Details
Message-ID:
<2921@tekcrl.CRL.TEK.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!bellcore!rutgers!mit-eddie!uw-beaver!tektronix!tekcrl!NTP server version 1.5 (26 Feb 88) ready at Wed Aug 10 1!willcReferences:
<FELDMARK.88Aug9114727@hanako.stars.flab.Fujitsu.JUNET>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!bellcore!rutgers!mit-eddie!uw-beaver!tektronix!tekcrl!NTP server version 1.5 (26 Feb 88) ready at Wed Aug 10 1!willc From: willc@tekcrl.TEK.COM (Will Clinger) Newsgroups: comp.lang.misc Subject: Re: a simple miranda problem Summary: try associating to the left Keywords: functional programming Message-ID: <2921@tekcrl.CRL.TEK.COM> Date: 10 Aug 88 18:24:48 GMT References: <FELDMARK.88Aug9114727@hanako.stars.flab.Fujitsu.JUNET> Sender: ftp@tekcrl.CRL.TEK.COM Reply-To: willc@tekchips.CRL.TEK.COM (Will Clinger) Distribution: comp Organization: Tektronix, Inc., Beaverton, OR. Lines: 28