CoolInterview.com - World's Largest Collection of Interview Questions
Start Your Own website Now
Sponsored Links

Interview Questions
Our Services

Get 9,000 Interview Questions & Answers in an eBook.


  • 9500+ Pages
  • 9000 Question & Answers
  • All Tech. Categories
  • 14 MB Content

    Get it now !!



    Send your Resume to 6000 Companies


  • INTERVIEW QUESTIONS LANGUAGES LISP PROGRAMMING DETAILS
    Question :
    What is the difference between Scheme and Common Lisp?
    Category Lisp Programming Interview Questions
    Rating (1.0) By 193 users
    Added on 5/15/2009
    Views 1527
    Rate it!
    Answers:

    Scheme is a dialect of Lisp that stresses conceptual elegance and
    simplicity. It is specified in R4RS and IEEE standard P1178. (See
    the Scheme FAQ for details on standards for Scheme.) Scheme is much
    smaller than Common Lisp; the specification is about 50 pages,
    compared to Common Lisp's 1300 page draft standard. (See question
    [4-10] for details on standards for Common Lisp.) Advocates of Scheme
    often find it amusing that the Scheme standard is shorter than the
    index to CLtL2.

    Scheme is often used in computer science curricula and programming
    language research, due to its ability to represent many programming
    abstractions with its simple primitives. Common Lisp is often used for
    real world programming because of its large library of utility
    functions, a standard object-oriented programming facility (CLOS), and
    a sophisticated condition handling system.

    See the Scheme FAQ for information about object-oriented programming
    in Scheme.

    In Common Lisp, a simple program would look something like the
    following:

    (defun fact (n)
    (if (< n 2)
    1
    (* n (fact (1- n)))))

    In Scheme, the equivalent program would like like this:

    (define fact
    (lambda (n)
    (if (< n 2)
    1
    (* n (fact (- n 1))))))

    Experienced Lisp programmers might write this program as follows in order
    to allow it to run in constant space:

    (defun fact (n)
    (labels ((tail-recursive-fact (counter accumulator)
    (if (> counter n)
    accumulator
    (tail-recursive-fact (1+ counter)
    (* counter accumulator)))))
    (tail-recursive-fact 1 1)))

    Whereas in Scheme the same computation could be written as follows:

    (define fact
    (lambda (n)
    (letrec ((tail-recursive-fact
    (lambda (counter accumulator)
    (if (> counter n)
    accumulator
    (tail-recursive-fact (+ counter 1)
    (* counter accumulator))))))
    (tail-recursive-fact 1 1))))

    or perhaps (using IEEE named LETs):

    (define fact
    (lambda (n)
    (let loop ((counter n)
    (accumulator 1))
    (if (< counter 2)
    accumulator
    (loop (- counter 1)
    (* accumulator counter))))))

    Some Schemes allow one to use the syntax (define (fact n) ...) instead
    of (define fact (lambda (n) ...)).



    If you have the better answer, then send it to us. We will display your answer after the approval.
    Rules to Post Answers in CoolInterview.com:-

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.
  • Name :*
    Email Id :*
    Answer :*
    Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
    Process Verification  Enter the above shown code:*
    Inform me about updated answers to this question

       
    Related Questions
    View Answer
    What is the purpose of this newsgroup?
    View Answer
    How complex can I get?
    View Answer
    What if I get interrupted?
    View Answer
    How do I tell LG3 what I what?
    View Answer
    What is the ouput like?
    View Answer
    Can I save my programs to files?
    View Answer
    Why use LISP?
    View Answer


    Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

    View ALL Lisp Programming Interview Questions

    User Options
    Sponsored Links


    Copyright ©2003-2014 CoolInterview.com, All Rights Reserved.
    Privacy Policy | Terms and Conditions

    Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Dedicated Servers | C Interview Questions & Answers

    Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes


    Cache = 0.011719 Seconds