This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Jay Glascoe writes: > > The opposite of imperative isn't functional. It's the "!" which isn't > > functional. > > I'm using "functional" as the adjectival form of "function". One of the > properties of a function is that it has a return value. I'm thinking of "functional" in terms of the mathematical definition, which is fully reentrant. This is probably just semantics, though... > > Mutation/destruction is the opposite of functional -- it just so happens > > that imperative style is useless without mutation (after all, if you > > don't use the resulting value of a side-effect-free procedure, why call > > the procedure at all?) > > Yes, but then a purely functional program is also useless without > mutation. E.g. it must perform some IO, thus changing the state of > something (the file, my screen, the speaker ...), if it is to communicate > with the outside world. Quite true. I actually find this quite interesting. A purely functional language/program isn't all that interesting. In fact, it is extremely boring: though (in a vague, theoretical manner) any non-functional program could be made functional, this is more a theoretical ability than a practical one. Real programs live in a very dynamic environment (file systems, networks, and the ever-dynamic human component). Turing machines can only represent functional programs and algorithms. Turing Complete is touted as this very important idea yet we constantly go beyond it. It's when we go beyond it that we create things that are both powerful and bug-ridden. > the pairs/associations themselves are left untouched. If something is > pointing to some part of "list" (like its cdr), then yes, that thing too > will be changed. It's really no different from "set-cdr!" or something. I guess I don't see how this could be a win. You can destruct the list, but the garbage collector still needs to dispose of all the components anyway, right? Some other structure could be pointing at any piece of the list -- the contents, cons cells, whatever. You can muck with the cons cells, but you can't make them go away. If you do make them go away you are compromising the integrity of the system, which is worse than simple non-functional. <-------------------------------------------------------------------> < Ian Bicking | bickiia@earlham.edu > < drawer #419 Earlham College | http://www.cs.earlham.edu/~bickiia > < Richmond, IN 47374 | (765) 973-2824 > <------------------------------------------------------------------->