Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
COMP30020
Declarative Programming Prolog s e a r ch b s t ( node (K, V, , ) , K, V) . s e a r ch b s t ( node (K, , L , ) , SK, SV) :? SK @< K, s e a r ch b s t (L , SK, SV) . s e a r ch b s t ( node (K, , , R) , SK, SV) :? SK @> K, s e a r ch b s t (R, SK, SV) . Haskell s e a r ch b s t : : Tree k v ?> k ?> Maybe v s e a r ch b s t Leaf = Nothing s e a r ch b s t (Node k v l r ) sk = i f sk == k then Just v else i f sk < k then s e a r ch b s t l sk else s e a r ch b s t r sk School of Computing and Information Systems The University of Melbourne Copyright c? 2020 The University of Melbourne A language that doesn’t affect the way you think about programming, is not worth knowing. — Alan Perlis Section 0: Subject Introduction Welcome to Declarative Programming Lecturer: Peter Schachte Contact information is available from the LMS. There will be two pre-recorded one-hour lectures per week, plus one live one-hour practical meeting for questions, discussion, and demonstrations. There will be eleven one-hour workshops (labs), starting in week 2. You should have already been allocated a workshop. Please check your personal timetable after the lec- ture. – section 0 slide 1 – Grok We use Grok to provide added self-paced instruc- tional material, exercises, and self-assessment for both Haskell and Prolog. You can access Grok by following the link from the subject LMS page. If you are unable to access Grok or find that it is not working correctly, please email Grok University Support ~~~~ from your university email account and explain the problem. If you have questions regarding the Grok lessons or exercises, please post a message to the subject LMS discussion forum. – section 0 slide 2 – Workshops The workshops will reinforce the material from lec- tures, partly by asking you to apply it to small scale programming tasks. To get the most out of each workshop, you should read and attempt the exercises before your work- shop. You are encouraged to ask questions, discuss, and actively engage in workshops. The more you put into workshops, the more you will get out of them. Workshop exerciese will be available through Grok, so they can be undertaken even if you are not present in Australia. Sample solutions for each set of workshop exercises will also be available through Grok. Most programming questions have more than one correct answer; your answer may be correct even if it differs from the sample solution. NOTE If your laptop can access the building’s wire- less network, you will be able to log onto the MSE servers and use their installed versions of this sub- ject’s languages, Haskell and Prolog. If your lap- top cannot access the building’s wireless network, then you will be able to test your Haskell or Pro- log code if you install the implementations of those languages on your machine yourself. For both lan- guages this is typically fast and simple. – section 0 slide 3 – Resources The lecture notes contain copies of the slides pre- sented in lectures, plus some additional material. All subject materials (lecture notes, workshop ex- ercises, project specifications etc) will be available online through the LMS. The recommended text is ? Bryan O’Sullivan, John Goerzen and Don Stewart: Real world Haskell. O’Reilly Media, 2009. ISBN 978-0-596-51498-3. Available on- line at http://book.realworldhaskell.org/read. Other recommended resources are listed on the LMS. – section 0 slide 4 – Assessment The subject has the following assessment compo- nents: 0% short Prolog project, due in Week 4 (optional) 15% larger Prolog project, due in Week 6 or 7 0% short Haskell project, is due in Week 8 or 9 (optional) 15% larger Haskell project, due in Week 11 or 12 70% two-hour written final examination To pass the subject (get 50%), you must pass both the project component and the exam component. The exam is closed book, and will be held during the usual examination period after the end of the semester. Practice versions of the final exam are available on the LMS. – section 0 slide 5 – Academic Integrity All assessment for this subject is individual ; what you submit for assessment must be your work and your work alone. It is important to distinguish project work (which is assessed) from tutorials and other unassessed ex- ercises. We are well aware that there are many online sources of material for subjects like this one; you are encouraged to learn from any online sources, and from other students, but do not submit for assessment anything that is not your work alone. Do not provide or show your project work to any other student. Do not store your project work in a public Github or other repository. We use sophisticated software to find code that is similar to other submissions this year or in past years. Students who submit another person’s work as their own or provide their work for another stu- dent to submit in whole or in part will be subject to disciplinary action. – section 0 slide 6 – How to succeed Declarative programming is substantially different from imperative programming. Even after you can understand declarative code, it can take a while before you can master writing your own. If you have been writing imperative code all your programming life, you will probably try to write im- perative code even in a declarative language. This often does not work, and when it does work, it usu- ally does not work well. Writing declarative code requires a different mind- set, which takes a while to acquire. This is why attending the workshops, and practic- ing, practicing and practicing some more are essen- tial for passing the subject. – section 0 slide 7 – Sources of help During contact hours: ? Ask me during or after a lecture (not before). ? Ask the demonstrator in your workshop. Outside contact hours: ? The LMS discussion board (preferred: every- one can see it) ? Email (if not of interest to everyone) ? Attend my consultation hours (see LMS for schedule) ? Email to schedule an appointment Subject announcements will be made on the LMS. Please monitor the LMS for announcements, and the discussion forum for detailed information. Read the discussion forum before asking questions; ques- tions that have already been answered will not be answered again. – section 0 slide 8 – Objectives On completion of this subject, students should be able to: ? apply declarative programming techniques; ? write medium size programs in a declarative language; ? write programs in which different components use different languages; ? select appropriate languages for each compo- nent task in a project. These objectives are not all of equal weight; we will spend almost all of our time on the first two objec- tives. – section 0 slide 9 – Content ? Introduction to logic programming and Prolog ? Introduction to constraint programming ? Introduction to functional programming and Haskell ? Declarative programming techniques ? Tools for declarative programming, such as de- buggers ? Interfacing to imperative language code This subject will teach you Haskell and Prolog, with an emphasis on Haskell. For logistical reasons, we will begin with Prolog.