Re: Newbie Question: Is it allowed for the function to change the value of parameters?
- From: Joachim Durchholz <jo@xxxxxxxxxxxxx>
- Date: Thu, 02 Aug 2007 11:52:46 +0200
Rainer Joswig schrieb:
In article <f8qfks$vmv$1@xxxxxxxxx>,
Joachim Durchholz <jo@xxxxxxxxxxxxx> wrote:
Common Lisp supports imperative, procedural programming.From the perspective of a Haskeller, that's entirely superfluous. (Simon Peyton-Jones: "Haskell - the World's Finest Imperative Language." He is serious about that claim, and has evidence to back that up.)
(Personally I think simple (!) functional programming with side
effects is not that far from that.) Old-style loops and
other control constructs (including goto). I'm not religiously
connected to that. I comes handy sometimes. Sometimes
it gets overused.
Guy Lewis Steele, Jr. and Gerald Jay Sussman.
"Lambda: The Ultimate Imperative". MIT AI Lab.
AI Lab Memo AIM-353. March 1976
http://library.readscheme.org/page1.html
Sure, you can do everything with Lambda.
Typical Lisp code doesn't use Lambda to wrap all the imperative stuff into a referentially transparent framework.
Haskell is different in that respect. It is serious about packing all the imperative stuff into a pure framework. You won't find referentially intransparent code in a Haskell program(*), even if it seems to be doing overwriting assignments.
(*1) You can have overwriting assignment locally - the side effect cannot escape the closure that contains it though. I.e. with this technique, the side effects are pushed together into local places and encapsulated.
(*2) You can have side effects via the IO() mechanism. The effects aren't directly mapped to any data structures though, you write functions that generate action commands in response to some input (I'm omitting a *lot* of details here). I.e. with this mechanism, side effects are pushed to the "surface" of the program and into the run-time system (which is deeply imperative anyway, and which is reused often enough that rigorously demonstrating that it doesn't do anything unexpected is actually worth the effort).
* Programming with RelationsShould be easy. (Unless I'm missing something.)
http://ap5.com/doc/ap5-frame.html
OK. Looks as if reproducing this for Haskell or *ML shouldn't be more difficult than writing it in Lisp.
Details would probably differ.
* FramesNot sure what that is.
* Description Logics
"Description logics are knowledge representation languages tailored
for expressing knowledge about concepts and concept hierarchies."
http://dl.kr.org/
Differences with logic programming?
* Graphical NotationsNot sure what specific advantages Lisp would have here.
Also not sure what the advantages of a graphical notation would be. I found most that I have seen too wasteful of screen space to be very useful (though I haven't seen much).
Used for example in Music composition:
http://recherche.ircam.fr/equipes/repmus/OpenMusic/
Some screenshots there.
OpenMusic allows you to draw algorithms and run them.
It provides a graphical notation for a bit of Lisp.
OK, now that's something that isn't directly representable in a compiled language.
One would have to build a domain-specific language on top of the FPL, and evaluate the DSL programs at run-time.
I'm not sure whether that's a real disadvantage though. Sure, I don't have the Haskell compiler inside Haskell, but setting up a DSL is so easy that I don't think I'm losing anything. After all, HOFs allow me to stick together functions at runtime just as I want them, and run the results - what I lose is the parser, which isn't a big deal in either language. (Setting up a parser isn't too difficult even in C, so I really don't consider a serious loss.)
Many paradigms can be implemented as a library. If the
language is flexible enough it may integrate nicely.
That's exactly the point: I think higher-order functions allow that kind of nice integration.
I may be missing scenarios where even a bunch of higher-order functions doesn't give the level of nice integration that a set of Lisp mechanisms could give. I can't imagine a situation where it is so, but that may be my lack of imagination, so there.
Regards,
Jo
.
- Follow-Ups:
- References:
- Re: Newbie Question: Is it allowed for the function to change the value of parameters?
- From: Markus E.L.
- Re: Newbie Question: Is it allowed for the function to change the value of parameters?
- From: Rainer Joswig
- Re: Newbie Question: Is it allowed for the function to change the value of parameters?
- From: Joachim Durchholz
- Re: Newbie Question: Is it allowed for the function to change the value of parameters?
- From: Rainer Joswig
- Re: Newbie Question: Is it allowed for the function to change the value of parameters?
- From: Joachim Durchholz
- Re: Newbie Question: Is it allowed for the function to change the value of parameters?
- From: Rainer Joswig
- Re: Newbie Question: Is it allowed for the function to change the value of parameters?
- From: Joachim Durchholz
- Re: Newbie Question: Is it allowed for the function to change the value of parameters?
- From: Rainer Joswig
- Re: Newbie Question: Is it allowed for the function to change the value of parameters?
- Prev by Date: Re: Newbie Question: Is it allowed for the function to change the value of parameters?
- Next by Date: Re: Newbie Question: Is it allowed for the function to change the value of parameters?
- Previous by thread: Re: Newbie Question: Is it allowed for the function to change the value of parameters?
- Next by thread: Re: Newbie Question: Is it allowed for the function to change the value of parameters?
- Index(es):
Relevant Pages
|
Loading