Re: Newbie Question: Is it allowed for the function to change the value of parameters?



Rainer Joswig schrieb:
In article <f8qfks$vmv$1@xxxxxxxxx>,
Joachim Durchholz <jo@xxxxxxxxxxxxx> wrote:

Common Lisp supports imperative, procedural programming.
(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.
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.)

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 Relations
Should 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.

* Frames
* Description Logics
Not sure what that is.

"Description logics are knowledge representation languages tailored
for expressing knowledge about concepts and concept hierarchies."
http://dl.kr.org/

Differences with logic programming?

* Graphical Notations
Not 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
.



Relevant Pages

  • Re: Computer Algebra Algorithms
    ... If you want to learn CAS, learn lisp because that is what the ... The parser could be written in C or any other language. ... I would consider that such a minor aspect of a programming ... generally prefer righting there numeric algorithms in Maple and MATLAB ...
    (sci.math.symbolic)
  • Why should I care about Lisp and Scheme?
    ... Foreword to the book "Essentials of Programming Languages". ... It's an imaginary conversation between a newbie and a hacker. ... Why should I care about Lisp and Scheme? ... language, the result would be a Lisp interpreter. ...
    (comp.lang.scheme)
  • Re: F#
    ... Why did they take Lisp? ... properties of the language are only a part of the picture. ... If the favored programming style of a certain language ... Knowing a success story only tells me that other people ...
    (comp.lang.functional)
  • Re: Opinions on intro lisp books
    ... But Lisp is a little different, ... Some languages support one style of programming better than they ... Even if that weren't the case, I'm not sure that a language being a ... I don't believe that learning to program in CL requires more theory ...
    (comp.lang.lisp)
  • [ANN] 2nd European Lisp & Scheme Workshop
    ... Pascal Costanza, Programming Technology Lab, Vrije Universiteit Brussel ... Lisp has a tradition of providing a fruitful basis for language design ... and suggestions for breakout groups that discuss the opportunities Lisp ...
    (comp.lang.lisp)

Loading