Oppimateriaalin copyright © 2009 Arto Wikla. Tämän oppimateriaalin käyttö on sallittu vain yksityishenkilöille opiskelutarkoituksissa. Materiaalin käyttö muihin tarkoituksiin, kuten kaupallisilla tai muilla kursseilla, on kielletty.

Ohjelmointikielten periaatteet keväällä 2009: 5. harjoitukset

  1. [Modified from Scott's Review Questions for Chapter 10] Answer the following questions concerning programming languages:

    1. What mathematical formalism underlies functional programming? Give a sample of this notation, and explain it.
    2. What is a higher-order function (also known as a functional form)?
    3. What does it mean for a language to be homoiconic? Give an example of a homoiconic programming language.
    4. What does it mean for a function to be strict?
    5. Why do both functional and logic programming languages make such heavy use of lists?
    6. Summarize the arguments for and against side-effect-free programming.

  2. [Strongly modified from Scott 10.2] It is possible to write programs in a purely functional subset of an imperative language such as Java, but certain limitations of the language quickly become apparent. What features would need to be added to a classical imperative language to make it genuinely useful as a functional language? Hint: What does Scala have that Java lacks?

  3. Explain the terms closure and currying in Scala language. Give program examples of situations, where these techniques feel natural and lead to clear program structure.

  4. [Scott's Review Questions for Chapter 11] Answer the following questions concerning programming languages:
    1. What mathematical formalism underlies logic programming?
    2. What is a Horn clause?
    3. Briefly describe the process of resolution in logic programming.
    4. What are clauses, terms, and structures in Prolog? What are facts, rules, and queries?
    5. [*]Explain how Prolog differs from imperative languages in its handling of arithmetic?

  5. [Scott's Review Questions for Chapter 13] Answer the following questions concerning programming languages:
    1. What is the Perl motto?
    2. Explain the distinction between server-side and client-side web scripting.
    3. Why might we prefer to to execute a web script on the server rather than the client? Why might we sometimes prefer the client instead?
    4. What is the relationship of between JavaScript and Java?
    5. What popular scripting language uses dynamic scope?
    6. [*]Contrast the philosophies of Perl and Ruby with regard to error checking and reporting.

  6. [*] [Tämäkin on ihan "oikea", rastittava tehtävä, johon vastaamisesta vain ilmoitetaan ohjaajalle. Olkaa luotettavia ja vastatkaa kyselyyn vaikka emme sitä pystykään varmistamaan! ;-] (Niin ja tähän siis vastataan ihan itse, ei ryhmänä. ;-)
    Vastaa kurssikyselyyn niiltä osin voit -- koetta koskeviin kysymyksiin ei tietenkään voi vastata.


Takaisin harjoitusten pääsivulle.