Simple Introduction to Clojure with Analysis By: Shannon Birchell.

Slides:



Advertisements
Similar presentations
Arrays.
Advertisements

Semantics Static semantics Dynamic semantics attribute grammars
Semantic Analysis Chapter 6. Two Flavors  Static (done during compile time) –C –Ada  Dynamic (done during run time) –LISP –Smalltalk  Optimization.
Fortran Jordan Martin Steven Devine. Background Developed by IBM in the 1950s Designed for use in scientific and engineering fields Originally written.
1 pritisajja.info Unlocking the World of Java Programming….. Priti Srinivas Sajja February, 2014 Visit pritisajja.info for detail Future Technology for.
Chapter 41 Variables and JSP Control Structures JavaServer Pages By Xue Bai.
CS 355 – PROGRAMMING LANGUAGES Dr. X. Apply-to-all A functional form that takes a single function as a parameter and yields a list of values obtained.
Compiler Construction
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 5 Types Types are the leaven of computer programming;
Programming Languages Structure
1 Arrays  Arrays are objects that help us organize large amounts of information  Chapter 8 focuses on: array declaration and use passing arrays and array.
Chapter 3 Program translation1 Chapt. 3 Language Translation Syntax and Semantics Translation phases Formal translation models.
ISBN Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.
Review Java.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011.
1 Chapter 5: Names, Bindings and Scopes Lionel Williams Jr. and Victoria Yan CSci 210, Advanced Software Paradigms September 26, 2010.
DEDUCTIVE DATABASE.
Imperative Programming
 Value, Variable and Data Type  Type Conversion  Arithmetic Expression Evaluation  Scope of variable.
Expressions creating information. topics  operators: precedence, associativity, parentheses, overloading  operands: side-effects, coercion  arithmetic,
CSC3315 (Spring 2009)1 CSC 3315 Programming Languages Hamid Harroud School of Science and Engineering, Akhawayn University
Names Variables Type Checking Strong Typing Type Compatibility 1.
1 Programming Language History and Evolution In Text: Chapter 2.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
1 © 2002, Cisco Systems, Inc. All rights reserved. Arrays Chapter 7.
Lec 6 Data types. Variable: Its data object that is defined and named by the programmer explicitly in a program. Data Types: It’s a class of Dos together.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 2 Basic Elements of Java.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Data TypestMyn1 Data Types The type of a variable is not set by the programmer; rather, it is decided at runtime by PHP depending on the context in which.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Python Functions.
Python Primer 1: Types and Operators © 2013 Goodrich, Tamassia, Goldwasser1Python Primer.
PROGRAMMING LANGUAGES: PROLOG, CLOJURE, F# Jared Wheeler.
Computing and Statistical Data Analysis Lecture 2 Glen Cowan RHUL Physics Computing and Statistical Data Analysis Variables, types: int, float, double,
RUBY by Ryan Chase.
ISBN Chapter 6 Structured Data Types Array Types Associative Arrays Record Types Union Types.
CSI 3125, Preliminaries, page 1 Data Type, Variables.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
Programmeren 1 6 september 2010 HOORCOLLEGE 2: INTERACTIE EN CONDITIES PROGRAMMEREN 1 6 SEPTEMBER 2009 Software Systems - Programming - Week.
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
Variables reference, coding, visibility. Rules for making names  permitted character set  maximum length, significant length  case sensitivity  special.
Java Software Solutions Lewis and Loftus Chapter 6 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Objects for Organizing Data.
Agenda Comments Identifiers Keywords Syntax and Symentics Indentation Variables Datatype Operator.
Aside: Running Supplied *.java Programs Just double clicking on a *.java file may not be too useful! 1.In Eclipse, create a project for this program or.
C H A P T E R T H R E E Type Systems and Semantics Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
An Introduction to Java – Part 1 Erin Hamalainen CS 265 Sec 001 October 20, 2010.
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
CS 330 Programming Languages 10 / 23 / 2007 Instructor: Michael Eckmann.
Java Programming: From Problem Analysis to Program Design, Second Edition 1 Lecture 1 Objectives  Become familiar with the basic components of a Java.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Chapter 9 Introduction to Arrays Fundamentals of Java.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
Programming Language History and Evolution
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Web Database Programming Using PHP
CSE3302 Programming Languages (notes continued)
Data Types In Text: Chapter 6.
Web Database Programming Using PHP
Object Oriented Programming
Java Programming: From Problem Analysis to Program Design, 4e
PHP.
Web DB Programming: PHP
Python Primer 1: Types and Operators
Java Programming Review 1
Declarative Computation Model Single assignment store (VRH 2
Compiler Construction
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Presentation transcript:

Simple Introduction to Clojure with Analysis By: Shannon Birchell

 First Class Functions  Inherits concepts from Lisp  Every expression is a function  Functions attempt to be pure (not possible)  Concurrency is very stable  Software Transaction Memory(STM)  Uses JVM  Hybrid  Dynamically run code  REPL  Inherits all Java classes (4k+)

 Primitives Not so interesting: Number, String, Boolean and char  Coercion takes place on the JVM in byte code  Interesting Lisp primitives  List: Linked List without element removal capacities  Vector: like linked list but more efficient (less capabilities)  Keyword: used for Map as key  Map: equivalent to Hashmap  Set: same as mathematics

 Dynamic type binding  Variable Scope  Stack Dynamic  Explicitly stated global scopes  Value bindings are immutable  Values cannot be changed  Mapping are used to transform variables  Enhanced stability and reliability

 Function Declaration  Anonymous function (fn [ ]( … ))  Explicit function (defn [ ] ( <element…))  Functions can be self documented using  Function closure  A function and all its current values can be stored as a variable. It is said, “The function is closed over”

 Some functions  String: (str “hello” “world”) -> hello world  (cons 4 ‘(1 2 3)) ->  (first ‘(1 3 5)) ->1  (doc someFunct) -> description  First class functions  Parameters can be functions (* (+ 1 1) (+ 1 1)) = (* 2 (+ 1 1))=(* 2 2)=4  Return values can be functions  (defn f1 [p1] (fn [p2] ( str p1 p2)))

 Java integration  ( javax.swing.JOptionPane/showMessageDialog nil (str "Hello Everyone"))  Is equivalent to java code: javax.swing.JOptionPane.showMessageDialog(null, "Hello Everyone“);  Dot operator “.” performs java functinality (. String split “,”) -> String.split(“,”);  Most java objects do not work in the dynamic environment

 Readability  Orthogonal structures. (. String contains “hi”) -> String.contains(“hi”);  iteration is done through recursion and is cryptic  Writeability  Highly nested structures require substantial forethought (if(< (+ 1 1) (3/4) “write”))  Highly nested structures unify code into cohesive chunk.  Cost  Different than main stream – learning curve  Free software with good libraries

Overview and analysis of R By Shannon Birchell

 Domain specific  Statistical and numerical analysis  Used as a scripting language  Run commands real time in R environment  R Based on S syntax  Created by Bell Laboratories in 1976  Alternative to Fortran  Static scoped  Imperative language  Class Oriented  Like OO but uses predefined classes

 Primitives  Vectors logical, integer, double, complex, character, or raw  Coercion is used for different vectors of different size + = Logical Error checking reduced!!!  Type coercion is character, integer, double, logic  Implicit type binding  Lists  Behave like a vector without enforcing a type  Keys/Names can be associated with entries  Use brackets with name string to accesses elements

 Matrix  Is a vector that is mapped to the specified dimensions  Coercion done when dim doesn’t match  An associated array  Indexes start with 1  Tables  Matrix with elaborate row and column names  Inherits additional methods: colnames & rownames

 Objects are black box  unlike Java  Objects are implicitly associated with a class  Auto inherit mode and Attribute methods  More that one class may be inherited  There are many built in functions  Associated with classes but for all practical purposes act completely like functions

 Important Functions  Function c() creates a vector  Function list() creates a vector of generic types  Function dim() maps vector to an array  Function plot() graphs a dataset  Creating a objects  “<-” assign to an object  Can assign values, functions or other objects  Creating a vector: x <-c(1,2,3,4)  Creating a list x <- list( “one”, 1, three= ”three” )

 Creating a matrix  array( c(1,0,0,1), dim=c(2,2))-> a :  Creating a function  Default values as parameters x <- function(a, b = 1 ){ return( a + b );} x(1,2) is 3 x(4) is 5  Creating a graph  Plot, box plot, density… etc

 Readability  Black box objects make it difficult to understand what objects can do  Familiar syntax  Writeability  Large number of operators make full language use difficult  Large number of keywords is problematic  Consistent use of expressions make tasks easy  Cost  Syntax is familiar to C and C++  Software and packages are free

 Micheal J. Crawley, “The R Book”, Wiley, 2007  The R Project,

Simple Introduction to Prolog with Analysis By: Shannon Birchell

 Languages is based on first order logic  Queries perform complex analysis on truth statements  Can display true of false at the simplest level  Can display all values that are true

 Atom  A string of characters that is tokenized as an id  Has no other purpose  Scope is global  Numbers  Floats and Integers only  Variables  Starts with a capital letter  Anonymous variable “_”  Scope is rule

 An Axiom is a statement of truth  Immutable – always true “There is a dog call red”  There must be an animal dog : animal(dog).  There must be a name red: name(red).  Rules are axioms with relationships Given the previous example “There is a dog called red”  The relationship that bind “dog” and “red” the verb called Therefore called(x):= name(x), animal(x).

 Unification is how prolog derives the truth of a query  This is done by checking all axioms against rules Object is to make the implication query equal: axiom1, axiom2 axiomN…. rule1, rule2… query ? Rule LHS <- rule RHS <- axioms  Backtracking is the process of performing unification over all possibilities

 Readability  Difficult to understand the relationships  But this is the point!!!  Writeability  Simple statements of fact  Simple syntax  Reliability  Bad query catastrophically fail  Unintended consequences of statements unrealized