+ All Categories

Download - Ada, Scheme, R

Transcript
Page 1: Ada, Scheme, R

Ada, Scheme, REmory Wingard

Page 2: Ada, Scheme, R

Ada

Page 3: Ada, Scheme, R

History• Department of Defense in search of high

level language around 1975.

• Requirements drafted for the language.

• Competition between vendors to produce language narrowed down to four.

• Cii-Honeywell/Bull's language design won.(1979)

Page 4: Ada, Scheme, R

History cont.

• Large requirements called for a large language.

• Was not released to the public during testing.

• Dr. Jean Ichbiah headed the French team

• Based on Pascal

Page 5: Ada, Scheme, R

The Compiler

• Compilers for Ada were not developed until four years after the language was completed.

• Compilers are trademarked.

• Slow compile-time and run-time performance in the beginning.

Page 6: Ada, Scheme, R

Versions

• Original: Ada 83

• Ada 95

• Ada 2005

• Current version: Ada 2012

Page 7: Ada, Scheme, R

Usage

• Embedded systems

• Modern principles of software engineering

• Large software systems

Page 8: Ada, Scheme, R

Structure of programs

• Programs composed of program units

• Program units have subprograms, packages, task units, protected units, and generic units.

• Units consist of two parts: specifications and the body

• Most can be compiled separately

Page 9: Ada, Scheme, R

Subprograms

• Used to express algorithms

• Two kinds: procedures and functions

• Procedure is a way to bring up actions

• Functions provide computation of a value.

Page 10: Ada, Scheme, R

Packages• Considered the highlight of Ada

• Program units that encapsulate a group of related declarations and control visibility.

• Supports definition of interfaces and implementations

• Information hiding and abstract data types

• Structure for larger systems

Page 11: Ada, Scheme, R

Exception Handling

• Based on PL/I and CLU

• Handled locally in the code so reference environment is the same.

• Inadequate for task.

• No extension to Ada 95 for exception handling.

Page 12: Ada, Scheme, R

Types

• Integer

• Character

• Boolean

• Float

• String

*Considered to be strongly typed*

Page 13: Ada, Scheme, R

• Readability?

• Writability?

• Cost?

Page 14: Ada, Scheme, R

RFunctional, Statistical Computing, Graphics, Data

Analysis

Page 15: Ada, Scheme, R

History

• Implementation of the S programming language

• Created by Ross Ihaka and Robert Gentleman

Page 16: Ada, Scheme, R

Advantages

• Open sourced

• Available across multiple platforms

• Ease of design of graphics

• Data analysis

Page 17: Ada, Scheme, R

Packages• Stores data sets and functions.

• Similar to classes in Java

• Functions in packages are related

• Large number of packages for many different purposes

• Only a handful loaded by default

Page 18: Ada, Scheme, R

Commands• Two forms: expressions assignments

• Expression are printed immediately, values are not stored

• Assignments pass values to variables, these results are not printed

• Commands can be grouped by braces

• Separation of commands done by semi-colons

Page 19: Ada, Scheme, R

expression/assignment examples

Page 20: Ada, Scheme, R

Objects

• Numeric vectors, character vectors, lists, functions

• Actually everything in R are objects

• example

Page 21: Ada, Scheme, R

Constants

• Building blocks for data objects

• Numbers, character values, and symbols

• examples.

Page 22: Ada, Scheme, R

Precedence rules• function calls and grouping expressions

• Index and lookup operators

• Arithmetic

• Comparison

• Formulas

• Assignment

• Help

Page 23: Ada, Scheme, R

Control Structures

• Conditional Statements

if (condition) true_expression else false_expression

Page 24: Ada, Scheme, R

Scheme

Page 25: Ada, Scheme, R

Overview

• Developed in the 70s at MIT

• An extension of LISP

• Uses: optimizing compilers, financial analysis packages, operating systems, and writing text editiors

Page 26: Ada, Scheme, R

The Interpreter

• Interactive

• Infinite read-evaluate-print loop

• Very small, increased reliability

Page 27: Ada, Scheme, R

Programs• Collection of functional definitions

• DEFINE

• binds names to a value

• binds names to lambda expressions

• prototypes

• expression

Page 28: Ada, Scheme, R

Programs cont.• Block structured

• keywords and variables are lexically scoped

• This makes the programs modular

• Increases readability and reliability

• Maintenance is easier

Page 29: Ada, Scheme, R

Programs cont.

• Scope of binding determined before evaluation of program by compiler

• Makes the code more efficient

Page 30: Ada, Scheme, R

Arithmetic

• Scheme uses prefix notation

• This simplifies precedence and associativity of operators

• example

Page 31: Ada, Scheme, R

Data Structures• Scheme uses lists rather than arrays

• Shown as sequences of objects surrounded by parenthesis.

• quote is used to tell the program that the list is to be treated as data and not a procedure

• List manipulation:

• car- returns the first element in a list

• cdr- returns the rest of the list

• cons- used to construct list

Page 32: Ada, Scheme, R

Advantages

• Portable

• Used to teach programming in high schools

• Very small and simplistic


Top Related