320 likes | 468 Views
Ada, Scheme, R. Emory Wingard. Ada. 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). History cont.
E N D
Ada, Scheme, R • Emory Wingard
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)
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
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.
Versions • Original: Ada 83 • Ada 95 • Ada 2005 • Current version: Ada 2012
Usage • Embedded systems • Modern principles of software engineering • Large software systems
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
Subprograms • Used to express algorithms • Two kinds: procedures and functions • Procedure is a way to bring up actions • Functions provide computation of a value.
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
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.
Types • Integer • Character • Boolean • Float • String • *Considered to be strongly typed*
Readability? • Writability? • Cost?
R • Functional, Statistical Computing, Graphics, Data Analysis
History • Implementation of the S programming language • Created by Ross Ihaka and Robert Gentleman
Advantages • Open sourced • Available across multiple platforms • Ease of design of graphics • Data analysis
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
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
Objects • Numeric vectors, character vectors, lists, functions • Actually everything in R are objects • example
Constants • Building blocks for data objects • Numbers, character values, and symbols • examples.
Precedence rules • function calls and grouping expressions • Index and lookup operators • Arithmetic • Comparison • Formulas • Assignment • Help
Control Structures • Conditional Statements • if (condition) true_expression else false_expression
Overview • Developed in the 70s at MIT • An extension of LISP • Uses: optimizing compilers, financial analysis packages, operating systems, and writing text editiors
The Interpreter • Interactive • Infinite read-evaluate-print loop • Very small, increased reliability
Programs • Collection of functional definitions • DEFINE • binds names to a value • binds names to lambda expressions • prototypes • expression
Programs cont. • Block structured • keywords and variables are lexically scoped • This makes the programs modular • Increases readability and reliability • Maintenance is easier
Programs cont. • Scope of binding determined before evaluation of program by compiler • Makes the code more efficient
Arithmetic • Scheme uses prefix notation • This simplifies precedence and associativity of operators • example
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
Advantages • Portable • Used to teach programming in high schools • Very small and simplistic