basics of LISP 
Author Message
 basics of LISP

I'm having a hard time understanding this functional programming thing.
 could someone please tell me the basic functioning of LISP?  How it
works in a sense?

Thanks
--
Posted via Talkway - http://www.*-*-*.com/
Exchange ideas on practically anything (tm).



Tue, 16 Oct 2001 03:00:00 GMT  
 basics of LISP

Quote:

> I'm having a hard time understanding this functional programming
> thing.  could someone please tell me the basic functioning of LISP?
> How it works in a sense?

it's all magic.

you ask a genie to do something and the genie asks the genies in its
hat, and so on.  eventually they give you an answer, all the while
having fun in their little spaces.  it's like the max on mtv (is that
still on?), but deeper.

you'd be surprised what a genie keeps in its hat!

thi



Tue, 16 Oct 2001 03:00:00 GMT  
 basics of LISP

Quote:

> I'm having a hard time understanding this functional programming
> thing.  could someone please tell me the basic functioning of LISP?

I could tell you. But then I'd have to kill you.

Christopher



Tue, 16 Oct 2001 03:00:00 GMT  
 basics of LISP

| I'm having a hard time understanding this functional programming thing.
| could someone please tell me the basic functioning of LISP?  How it works
| in a sense?

  it is really very simple.  functional programming means that it is
  functional, like a machine, a family, a sex life.  other programming is
  by inference dysfunctional.  so it isn't "how" it works, but "that" it
  works that makes it "functional".

#:Erik



Tue, 16 Oct 2001 03:00:00 GMT  
 basics of LISP

Quote:

> I'm having a hard time understanding this functional programming thing.
>  could someone please tell me the basic functioning of LISP?  How it
> works in a sense?

Well, I am fairly new here as well, and "basics of LISP" is quite
a huge question, but I can (attempt to) give you some food for thought
about this functional programming thing.                                        

In functional programming, you treat functions as "first class values",        
which means that you can treat them as any other value, i.e. create            
them, and pass them around as you do with your integers and strings.            

For a quick example, fire up your Lisp environment and type:                    

(defun create-adder (amount) (lambda (x) (+ x amount)))                        

This defines a function. When you call this function, e.g. with                
(create-adder 3)                                                                
you get back some garbage that is the printed representation of                
a function -- you get another of these thingies by typing                      
(symbol-function 'create-adder)                                                
btw.                                                                            

Now when you type                                                              

(funcall (create-adder 3) 4)                                                    

you get 7.  What happens is: The function "funcall" expects one of              
these function thingies you saw as its first argument, which it then            
executes with the rest of the input line as parameters (funcall is a            
"higher-order function", because it takes functions as input arguments).        

So, you saw a function that creates functions and a function that takes        
functions as its input--and also a function that has no name at all            
being passed between these two.  With this kind of power at your                
fingertips, all kinds of neat tricks are possible and deep magic will          
ensue.  If you are interested, pick up a good book about Lisp, learn            
and come back with new questions.                                              

Have fun,  Rudi



Tue, 16 Oct 2001 03:00:00 GMT  
 basics of LISP


Quote:
>I'm having a hard time understanding this functional programming thing.
> could someone please tell me the basic functioning of LISP?  How it
>works in a sense?

>Thanks
>--
>Posted via Talkway - http://www.talkway.com
>Exchange ideas on practically anything (tm).

There is a newsgroup, comp.lang.functional, which discusses functional
programming more extensively. There is an FAQ at:

<http://www.cs.nott.ac.uk/Department/Staff/gmh/faq.html>

Briefly, it describes functional programming as:

"... a style of programming that emphasizes the evaluation of expressions,
rather than execution of commands. The expressions in these language are
formed by using functions to combine basic values. A functional language is
a language that supports and encourages programming in a functional style."

Common Lisp supports, but does not require, a functional style.



Tue, 16 Oct 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Ada, Basic, C, Lisp, Modula, Pascal, Prolog

2. visual basic and lisp

3. Basic Q on Prolog/Lisp

4. Stumped (basic LISP question)

5. basic LISP problem

6. Corman Lisp and Visual Basic

7. Need some basic LISP info...

8. integration of lisp and visual basic

9. Help! : Need basic info on LISP and PROLOG

10. BASIC implementation on LISP

11. basic Lisp question

12. Q: Basic Questions on Common Lisp.

 

 
Powered by phpBB® Forum Software