• Complain

it-ebooks - Programming Languages Application and Interpretation

Here you can read online it-ebooks - Programming Languages Application and Interpretation full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2017, publisher: iBooker it-ebooks, genre: Home and family. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

it-ebooks Programming Languages Application and Interpretation
  • Book:
    Programming Languages Application and Interpretation
  • Author:
  • Publisher:
    iBooker it-ebooks
  • Genre:
  • Year:
    2017
  • Rating:
    4 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 80
    • 1
    • 2
    • 3
    • 4
    • 5

Programming Languages Application and Interpretation: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Programming Languages Application and Interpretation" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

it-ebooks: author's other books


Who wrote Programming Languages Application and Interpretation? Find out the surname, the name of the author of the book and a list of all author's works by series.

Programming Languages Application and Interpretation — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Programming Languages Application and Interpretation" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Programming Languages: Application and Interpretation

From: Programming Languages: Application and Interpretation

1 Introduction
1.1 Our Philosophy

Please watch thevideo on YouTube.Someday there will be a textual description here instead.

1.2 The Structure of This Book

Unlike some other textbooks, this one does not follow a top-downnarrative. Rather it has the flow of a conversation, withbacktracking. We will often build up programs incrementally, just asa pair of programmers would. We will include mistakes, not because Idont know the answer, but because this is the best way for youto learn . Including mistakes makes it impossible for you to readpassively: you must instead engage with the material, because you cannever be sure of the veracity of what youre reading.

At the end, youll always get to the right answer. However, thisnon-linear path is more frustrating in the short term (you will oftenbe tempted to say, Just tell me the answer, already!), and itmakes the book a poor reference guide (you cant open up to a randompage and be sure what it says is correct). However, that feeling offrustration is the sensation of learning. I dont know of a wayaround it.

At various points you will encounter this:

Exercise

This is an exercise. Do try it.

This is a traditional textbook exercise. Its something you need todo on your own. If youre using this book as part of a course, thismay very well have been assigned as homework. In contrast, you willalso find exercise-like questions that look like this:

Do Now!

Theres an activity here! Do you see it?

When you get to one of these, stop . Read, think, and formulatean answer before you proceed. You must do this because this isactually an exercise , but the answer is already in thebookmost often in the text immediately following (i.e., in the partyoure reading right now)or is something you can determine foryourself by running a program. If you just read on, youll see theanswer without having thought about it (or not see it at all, if theinstructions are to run a program), so you will get to neither (a)test your knowledge, nor (b) improve your intuitions. In other words,these are additional, explicit attempts to encourage active learning.Ultimately, however, I can only encourage it; its up to you topractice it.

1.3 The Language of This Book
The main programming language used in this book isRacket.Like with all operating systems, however, Racket actually supports ahost of programming languages, so you must tell Racket which language youre programming in. You inform the Unixshell by writing a line like

#!/bin/sh

at the top of a script; you inform the browser by writing, say,
Similarly, Racket asks that you declare which language you will beusing. Racket languages can have the same parenthetical syntax asRacket but with a different semantics; the same semantics but adifferent syntax; or different syntax and semantics. Thus everyRacket program begins with #lang followed by the name of some language: by default, its Racket(written as racket ). In DrRacket v. 5.3, go to Language, then ChooseLanguage, and select Use the language declared in the source. In this book well almost always use the language
plai-typed
.When we deviate well say so explicitly, so unless indicatedotherwise, put

#lang plai-typed

at the top of every file (and assume Ive done the same).
The Typed PLAI language differs from traditional Racket mostimportantly by being statically typed. It also gives you some usefulnew constructs: define-type , type-case , and test . There areadditional commands for controlling the output of testing, forinstance. Be sure to read the documentation for thelanguage In DrRacket v. 5.3, go to Help, then Help Desk,and in the Help Desk search bar, type plai-typed. Heres an example of each in use. We can introduce new datatypes:
( define-type MisspelledAnimal
[ caml ( humps : number ) ]
[ yacc ( height : number ) ] )
You can roughly think of this as analogous to the following inJava: an abstract class MisspelledAnimal and two concretesub-classes caml and yacc , each of which has one numericconstructor argument named humps and height , respectively.
In this language, we construct instances as follows:
( caml )
( yacc 1.9 )
As the name suggests, define-type creates a type of the givenname. We can use this when, for instance, binding the above instancesto names:
( define ma1 : MisspelledAnimal ( caml ) )
( define ma2 : MisspelledAnimal ( yacc 1.9 ) )
In fact you dont need these particular type declarations, becauseTyped PLAI will infer types for you here and in many other cases.Thus you could just as well have written
( define ma1 ( caml ) )
( define ma2 ( yacc 1.9 ) )
but we prefer to write explicit type declarations as a matter of bothdiscipline and comprehensibility when we return to programs later.

The type names can even be used recursively, as we will seerepeatedly in this book (for instance, ).

The language provides a pattern-matcher for use whenwriting expressions, such as a functions body:
( define ( good? [ ma : MisspelledAnimal ] ) : boolean
( type-case MisspelledAnimal ma
[ caml ( humps ) ( >= humps ) ]
[ yacc ( height ) ( > height 2.1 ) ] ) )
In the expression (>= humps 2) , for instance, humps isthe name given to whatever value was given as the argument to theconstructor caml .
Finally, you should write test cases, ideally before youve definedyour function, but also afterwards to protect against accidentalchanges:
( test ( good? ma1 ) #t )
( test ( good? ma2 ) #f )
When you run the above program, the language will give you verboseoutput telling you both tests passed. Read the documentation to learnhow to suppress most of these messages.
Heres something important that is obscured above. Weve used the samename, humps (and height ), in both the datatypedefinition and in the fields of the pattern-match. This is absolutelyunnecessary because the two are related by position , not name.Thus, we could have as well written the function as
( define ( good? [ ma : MisspelledAnimal ] ) : boolean
( type-case MisspelledAnimal ma
[ caml ( h ) ( >= h ) ]
[ yacc ( h ) ( > h 2.1 ) ] ) )
Because each h is only visible in the case branch in which itis introduced, the two h s do not in fact clash. You cantherefore useconvention and readability to dictate your choices. In general, itmakes sense to provide a long and descriptive name when defining thedatatype (because you probably wont use that name again), but shorternames in the type-case because youre likely to use use thosenames one or more times.
I did just say youre unlikely to use the field descriptorsintroduced in the datatype definition, but you can. The languageprovides selectors to extract fields without the needfor pattern-matching: e.g., caml-humps . Sometimes, its mucheasier to use the selector directly rather than go through thepattern-matcher. It often isnt, as when defining good? above,but just to be clear, lets write it without pattern-matching:
Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Programming Languages Application and Interpretation»

Look at similar books to Programming Languages Application and Interpretation. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Programming Languages Application and Interpretation»

Discussion, reviews of the book Programming Languages Application and Interpretation and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.