COM SCI 131 Study Guide - Winter 2019, Comprehensive Midterm Notes - Java Virtual Machine, Compile Time, Xerox

117 views18 pages
Published on 14 Feb 2019
School
Professor
COM SCI 131
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 18 pages and 3 million more documents.

Already have an account? Log in
1/10/19
- Languages/notations have niches
- LaTeX → text documents
- R → Statistics
- Mathematics → MATLAB
- JavaScript → browsing servers
- C → text
- C++ → Operating System
- Successful languages evolve
- BASIC
- Running on GE 225.
- Takes 40 microseconds to add integers
- 500 microseconds to divide
- with about 40KiB RAM
- C
- 4 microseconds to add
- 16 KiB RAM
- 1.2 microseconds memory cycle
- Evolve within the language
- C++ technology in C
-close(fd)
closes a file
-close(5)
when 5 is not opened returns -1 and set errno, but Microsoft
throws exception.
- Can define own function called rpl_close
that takes into account of two
kinds of error handling
- int rpl_close(int fl) {
TRY
n = close(fl)
CATCH
n = 1; errno = EBADF;
return n;
}
define close rpl_close
- Uses the macro language of C to build a new language that takes into
account of all linux systems handling of error exceptions and of all
microsoft’s way of handling error exceptions.
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 18 pages and 3 million more documents.

Already have an account? Log in
1/10/19
Imperative languages
C, C++, Java
Follows commands/steps
Functional
Lisps, Scala
Functions together hooked
by function calls. Passing
result of one function to
another. No assignments
Logic
Prolog
No function calls but has
predicates connected by
logic
- Functional languages motivation
- Clarity → mathematician have hundreds of years of notational experiences
- Parallelity → escape from the non newman between bottleneck
- Functional form: higher order function that takes function as arguments
-f ▫ g → h or h(x) = f(g(x))
- Order of evaluation in functional languages
- Determined by calls and recursion
- i.e to order evaluation 1, 2, 3, 4, 5, must write a recursive function
-Referential Transparency: Since there are no variables in the C sense, there’s
no longer indirection between variables and values. i.e variables always have the
same value
- f(x) == f(x) & v == v are always evaluated to true
- Ocaml basic properties
- Good support for higher order functions
- Compile-time type checking
- Type inference: need not to write down the type all the time
- No need to worry about storage management
- Read-eval-print loop
- # if 3 < 5 then 47 * 3 then 0 returns int = 141
- # if 3 < 5 then “a” then ”b” returns string = “a”
- 1,2;; returns int x int = 1, 2 (a pair of integers)
- [1, 2] returns int list = [1, 2]
- 3, “a”, false returns int x string x bool
list
tuple
lists must be homogeneous,
containing only same types
Not restricted by size
tuples can contain multiple types,
is always fixed in size
- [ ] @ [1,3] concatenates and gives a list containing integers
- let f x = x + 1
f: int → int = <function>
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 18 pages and 3 million more documents.

Already have an account? Log in
1/10/19
- f 3 → 4
- Two argument function
let add (a,b) = a + b;;
add int x int → int = < , >
-
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 18 pages and 3 million more documents.

Already have an account? Log in

Document Summary

C++ technology in c close(fd) closes a file close(5) when 5 is not opened returns -1 and set errno, but microsoft throws exception. Can define own function called rpl_close that takes into account of two kinds of error handling int rpl_close(int fl) { Catch n = 1; errno = ebadf; return n; define close rpl_close. Uses the macro language of c to build a new language that takes into account of all linux systems handling of error exceptions and of all microsoft"s way of handling error exceptions. No function calls but has predicates connected by logic. Clarity mathematician have hundreds of years of notational experiences. Parallelity escape from the non newman between bottleneck. Functional form: higher order function that takes function as arguments f g h or h(x) = f(g(x)) Determined by calls and recursion i. e to order evaluation 1, 2, 3, 4, 5, must write a recursive function.

Get OneClass Grade+

Unlimited access to all notes and study guides.

YearlyMost Popular
75% OFF
$9.98/m
Monthly
$39.98/m
Single doc
$39.98

or

You will be charged $119.76 upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.