From: Thomas Fischbacher <Thomas.Fischbacher@Physik.Uni-Muenchen.DE>
To: skaller <skaller@users.sourceforge.net>
Cc: Markus Mottl <markus@oefai.at>,
Andrej Bauer <Andrej.Bauer@andrej.com>,
caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] environment idiom
Date: Mon, 13 Dec 2004 13:01:27 +0100 (CET) [thread overview]
Message-ID: <Pine.LNX.4.58.0412131156280.13773@eiger.cip.physik.uni-muenchen.de> (raw)
In-Reply-To: <1102935187.2578.85.camel@pelican.wigram>
On Mon, 13 Dec 2004, skaller wrote:
> I.e. a simplified Assembler.
>
> Is assmebler code functional?
>
> No of course not!
>
> Yes of course it is! Is is nothing more
> than a function from registers to registers where
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> the instructions guarrantee you can't access the prior state.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> That's just the state monad .. :)
That's not quite how I would describe the state monad to work.
However solid the mental picture which you have of a brick may be,
you will not be able to hit real people with it as with a real brick. You
can, of course, have a solid mental picture of solidly hitting real people
with a solid real brick. This transformation of "mental picture of a solid
brick" to "real brick in a mental picture of something that involves a
brick" is just monadic binding.
I know all this may sound a bit hairsplitting, but it is precisely the
necessity of this hairsplitting that makes it so difficult for beginners
that have been poisoned by the imperative side of the force(TM) to get the
idea behind the monadic approach.
Back to the question:
> Is assmebler code functional?
After all, "code" can mean very different things here: a string that can
be parsed in a given grammar, a sequence of instructions that are to be
fed into a processor, an actually running programm, etc. Some people work
hard to get the fine distinctions one has to make here into other people's
heads. My impression is that your statements just work against these
distinctions other people try to establish.
> The point really is: what do you mean by purely functional?
> I think the answer depends on context.
I think the answer depends on properly wording the question!
Can one express transformations on sequences of machine instructions in a
functional language? ("Language" in the much broader sense than just
"functional programming language, especially haskell"; rather: "using
proper mathematical reasoning".) Sure, and this is in many aspects
perhaps the best way to talk about such transformations.
Do sequences of machine instructions of the type
Ra = foo Rb Rc
respect some "naive" substitution properties like e.g.
Ra = foo Rb Rc
Ra = foo Rb Rc
-->
Ra = foo Rb Rc
The answer is, of course, that no one would expect this.
These questions could not be any more different! What irks me is when such
very different things are subsumed under a statement of the form "depends
whether you ask this question in the outer or inner context". As it is a
very different question you are asking! It does not depend on "context",
but actually on the meaning you connect with the words which you use.
So, can one do array mutation in haskell? Certainly not. Can one use
haskell to talk about doing array mutations? For sure. But nothing more.
Well, systems like hugs will actually behave in funny ways if especially
plans to do IO appear in certain magical places, but this is an entirely
different story.
My point is that with statements like
> Yes, that indeed is my intention. Basically, any non-transparent
^^^^^^^^^^^^^^^^^^^
> non-function code can be made purely functional and transparent
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> with a simple transformation, yet it doesn't by this transformation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> get any easier to reason about the code.
you are trying to "hit real people with mental bricks".
> I'm sure you can implement this machine using the ST monad...
I'm sure you can even do without. :-)
--
regards, tf@cip.physik.uni-muenchen.de (o_
Thomas Fischbacher - http://www.cip.physik.uni-muenchen.de/~tf //\
(lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y) V_/_
(if (= x 0) y (g g (- x 1) (* x y)))) n 1)) (Debian GNU)
next prev parent reply other threads:[~2004-12-13 12:01 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-09 2:07 HENRIKSON, JEFFREY
2004-12-09 4:47 ` [Caml-list] " Jacques Garrigue
2004-12-09 6:02 ` Michael Walter
2004-12-09 11:28 ` Jacques Garrigue
2004-12-09 20:02 ` pad
2004-12-09 23:11 ` Jacques Garrigue
2004-12-10 2:30 ` skaller
2004-12-09 9:09 ` Richard Jones
2004-12-09 13:12 ` [Caml-list] " Ville-Pertti Keinonen
2004-12-10 11:59 ` Richard Jones
2004-12-10 10:52 ` [Caml-list] " Andrej Bauer
2004-12-10 12:13 ` Richard Jones
2004-12-10 23:35 ` Jacques Garrigue
2004-12-11 2:30 ` skaller
2004-12-11 14:31 ` Andrej Bauer
2004-12-11 18:13 ` Markus Mottl
2004-12-11 23:56 ` skaller
2004-12-12 2:36 ` William Lovas
2004-12-12 5:33 ` skaller
2004-12-12 19:09 ` Michael Walter
2004-12-13 0:48 ` skaller
2004-12-13 2:03 ` Michael Walter
2004-12-13 2:05 ` Michael Walter
[not found] ` <877e9a170412121844b633bb8@mail.gmail.com>
2004-12-13 2:45 ` Michael Walter
2004-12-13 6:18 ` skaller
2004-12-13 7:08 ` skaller
2004-12-13 9:56 ` Michael Walter
2004-12-13 12:59 ` skaller
2004-12-13 8:56 ` Thomas Fischbacher
2004-12-13 9:21 ` Jacques Garrigue
2004-12-13 10:05 ` Michael Walter
2004-12-13 10:29 ` Thomas Fischbacher
2004-12-13 21:16 ` Michael Walter
2004-12-13 10:20 ` Thomas Fischbacher
2004-12-13 12:09 ` Jacques Garrigue
2004-12-13 12:48 ` Thomas Fischbacher
2004-12-13 14:09 ` skaller
2004-12-13 21:39 ` Michael Walter
2004-12-13 13:22 ` skaller
2004-12-13 16:54 ` Marcin 'Qrczak' Kowalczyk
2004-12-13 18:44 ` Thomas Fischbacher
2004-12-13 10:11 ` Michael Walter
2004-12-13 11:46 ` skaller
2004-12-13 5:41 ` skaller
2004-12-13 9:29 ` Michael Walter
2004-12-13 12:30 ` skaller
2004-12-13 13:49 ` Martin Berger
2004-12-12 23:03 ` Thomas Fischbacher
2004-12-13 1:26 ` skaller
2004-12-13 8:37 ` Thomas Fischbacher
2004-12-13 10:53 ` skaller
2004-12-13 11:38 ` Martin Berger
2004-12-13 13:33 ` skaller
2004-12-13 12:01 ` Thomas Fischbacher [this message]
2004-12-13 13:41 ` skaller
2004-12-11 23:29 ` skaller
2004-12-12 0:21 ` Jacques Carette
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.58.0412131156280.13773@eiger.cip.physik.uni-muenchen.de \
--to=thomas.fischbacher@physik.uni-muenchen.de \
--cc=Andrej.Bauer@andrej.com \
--cc=caml-list@inria.fr \
--cc=markus@oefai.at \
--cc=skaller@users.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox