From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ce0900b60ca3f616 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-06 11:46:37 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.germany.net!newsfeed.arcor-online.net!newsfeed2.easynews.net!easynews.net!news.cid.net!news.enyo.de!news1.enyo.de!not-for-mail From: Florian Weimer Newsgroups: comp.lang.ada Subject: Re: Side-Effects in Functions [Rosen Trick] Date: Tue, 06 Nov 2001 21:08:10 +0100 Organization: Enyo's not your organization Message-ID: <87itcn8xxx.fsf@deneb.enyo.de> References: <9rti6v$hcu$1@news.huji.ac.il> <1EyE7.10050$xS6.13527@www.newsranger.com> <9rue9f$j4t$1@nh.pace.co.uk> <9ruiet$kqg$1@nh.pace.co.uk> <3BE3235D.E292B890@boeing.com> <3BE35498.9F6381A2@acm.org> <9s230d$107b5a$2@ID-25716.news.dfncis.de> <5ee5b646.0111040507.5ca7ea23@posting.google.com> <9s3tl3$111hco$1@ID-25716.news.dfncis.de> <5ee5b646.0111041846.93f3e07@posting.google.com> <9s5eub02j61@drn.newsguy.com> <3be666fe.6426140@News.CIS.DFN.DE> <9s7bfb$11boa1$1@ID-25716.news.dfncis.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cancel-Lock: sha1:8QrPVDSqnDYqzKuktNuR6XJWgcA= Xref: archiver1.google.com comp.lang.ada:15945 Date: 2001-11-06T21:08:10+01:00 List-Id: "Nick Roberts" writes: > From a pedagogical point of view, care needs to be taken not to give the > impression that a function in a procedural programming language (most > programming languages, really) is the same thing as a mathematical function. > Clearly it isn't: a mathematical function is a kind of relation called a > 'bijection' (and is nowadays specifically defined as such, I think); A function f : M -> N are two sets M, N and a subset G_f of the Cartesian product M x N with the following property: for all m in M, there exists exactly one n in N such that (m, n) in G_f. > a programming function is really just an encapsulated computation. Yes, such functions take an additional implicit argument (the machine state before execution) and have an invisible result (the machine state after execution). However, there are programming languages which use only mathematical functions, and a special construct for I/O, Haskell for example.