Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Functional Programming with LISP

6,765 views

Published on

Published in: Technology
  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Dating for everyone is here: ❶❶❶ http://bit.ly/2ZDZFYj ❶❶❶
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Dating direct: ♥♥♥ http://bit.ly/2ZDZFYj ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Excellent presentation! However, I would like to add Embeddable Common-Lisp to your list of "Current Available Forms" (slide 5), as it is an implementation of Common Lisp that is highly portable, and allows for translating to C code, which can produce standalone executables. https://common-lisp.net/project/ecl/main.html
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Functional Programming with LISP

  1. 1. Functional Programming with LISt Processing © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> All Rights Reserved.
  2. 2. Introduction© 2010 Anil Kumar Pugalia <email@sarika-pugs.com> All Rights Reserved.
  3. 3. What to Expect?Ws of LISPLanguage SpecificsFun with Recursion © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 3 All Rights Reserved.
  4. 4. What is LISP?Functional Programming Language Conceived by John McCarthy in 1956Name comes from its initial powerful List Processing featuresNatural computation mechanism: RecursionStandardization as Common LISP ANSI released standards in 1996Thought of as for Artificial Intelligence But could pretty much do anythingExamples range from OS, editors, compilers, games, GUIs, andyou think of it © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 4 All Rights Reserved.
  5. 5. Current Available FormsANSI Common Lisp: clisp Compiler, Interpreter, DebuggerGNU Common Lisp: gcl Compiler, InterpreterCMU Common Lisp: cmucl By Carnegie Mellon University Default available as .deb packages Use “alien –to-rpm" to convert them to rpmAllegro CL: Commercial Common Lisp implementation © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 5 All Rights Reserved.
  6. 6. Why LISP?“The programmable programming language"Whats good for the languages designer Is good for the languages usersWish for new features for easier programming? As you can just add the feature yourselfCode the way our brain thinks: Recursive Most natural way of programming50 lines of Code © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 6 All Rights Reserved.
  7. 7. Language SpecificsData StructuresBasic OperationsControl StructuresBasic I/O © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 7 All Rights Reserved.
  8. 8. Data StructuresS-Expression: Atom or ListAtom: String of characters (Values or Variables) Peace, 95432, -rtx, etcList: Collection of S-Expressions enclosed by () (The 100 times done) (Guava (43 (2.718 5) 56) Apple)What is a Null List: ()?Common Pitfall: Lists need to start with © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 8 All Rights Reserved.
  9. 9. Basic OperationsLisp Program = Sequence of Functions Applied to their Arguments Returning Lisp ObjectsFunction Types Predicate Tests conditions with its arguments Returns Nil (FALSE) or anything else (TRUE) Command Performs operation with its arguments Returns an S-Expression © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 9 All Rights Reserved.
  10. 10. Basic Operations ...Format: (function arg1 arg2 … argn)Lets try Commands: car, cdr, cons, quote Predicates: atom, nullNB Lisp is case-insensitiveMore: first, last, rest, append, consp, ... © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 10 All Rights Reserved.
  11. 11. Mathematical OperationsPredicates: zerop, plusp, evenp, integerp, floatpArithmetic: +, -, *, /, rem, 1+, 1-Comparisons: =, /=, <, >, <=, >=Rounding: floor, ceiling, truncate, roundMore Functions max, min, exp, expt, log, abs, signum, sqrt, isqrt © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 11 All Rights Reserved.
  12. 12. Control StructuresConstants & Variables: Atoms w/ & w/o quote ()Assignment: setq, psetq, set, setfConditionals: equal, cond, ifLogical: and, or, notFunctions (defun func-name (par1 … parn) (commands)) Unnamed: (lambda (par1 … parn) (commands)) © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 12 All Rights Reserved.
  13. 13. Lets try some functionsExtract the second element from a listInsert an element at second position in a listChange nth element in a listFind length of a list (iteratively)Find variance of a list of elements © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 13 All Rights Reserved.
  14. 14. Iteration is Human Recursion is God© 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 14 All Rights Reserved.
  15. 15. Recursion For any recursion, we need 2 things Recursive Relation Termination Condition Functional ProceduralRecursive Relation From Mathematics. Tricky Extreme Fairly Simple ConditionsTermination Needs Thought Fairly TrivialCondition Lets try some examples to understand © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 15 All Rights Reserved.
  16. 16. Tracing & AnalysisTracing Recursive Function Calls Enable tracing: (trace recursive-func) Invoke the function to be traced: (recursive-func …)Performance Analysis (time (func …)) Samples with our recursive functions © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 16 All Rights Reserved.
  17. 17. Tail RecursionBottom most calls return = Topmost calls return Lets observe the trace on list reversalMay not be always possibleBut if possible, it is a smart compiler advantage Cuts-off processing as soon as lowest level returns © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 17 All Rights Reserved.
  18. 18. Example: Set OperationsSets: List of AToms (LATs)Operations: member, union, intersection, adjoinLets write some examples which support sets being elements of set © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 18 All Rights Reserved.
  19. 19. Basic Input / OutputBasic Input (read [input-stream] [eof-error] [eof-value]) → s-exprBasic Output (print s-expr [output-stream]) → s-expr (format destination control-string [args]) © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 19 All Rights Reserved.
  20. 20. Loading FilesLoading Lisp file for interpretation (load "file.lisp")Compiling a Lisp file (compile "file.lisp") or (compile "file")Loading a compiled Lisp file (load (compile "file.lisp")) © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 20 All Rights Reserved.
  21. 21. ReferencesCommon Lisp: http://www.lisp.orgCLISP: http://clisp.cons.orgPractical Common Lisp by Peter Seibel Also @ http://www.gigamonkeys.com/book/LISP Tutorial: http://www.mars.cs.unp.ac.za/lisp/ © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 21 All Rights Reserved.
  22. 22. What all have we learnt?Ws of LISPLanguage Specifics Demonstration Data Structures Basic Operations Control Structures Basic I/OFun with Recursion Power, Tail Recursion, Tracing & Analysis © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 22 All Rights Reserved.
  23. 23. Any Queries?© 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 23 All Rights Reserved.

×