Intro to Ruby Scripting

Size: px
Start display at page:

Download "Intro to Ruby Scripting"

Transcription

1 Intro to Ruby Scripting Dimitrios Galanakis Thursday April 15th A Tutorial for the LSU Center for Computation and Technology

2 Why Scripting? Advantages Flexible, portable, reusable, short code No need for compilation Access to diverse libraries Glue among different tools Minimum programming knowledge required Disadvantages Relatively slow, but the gap has closed

3 Why Ruby? Pure object oriented language Compact, clean syntax, short code Powerful integration with Regular Expressions Blocks Meta programming Large set of libraries Web developers: Ruby on Rails

4 Getting Started Versions: Ruby 1.8: old but still used Ruby 1.9: the future and largely debugged Installation: Mac: version 1.8 comes preinstalled. Latest version from Macports Linux: All distributions have it preinstalled or provide a package. Windows: One-click installer. Run: ruby <source_filename>: executes the source./source_filename: if it is executable and prefixed by #!/path/to/bin/ruby Interactive RuBy: irb On the browser (zero install):

5 Object Oriented Programming class Person def def greet puts "Hello, def def def def Class: a collection of data and methods me=person.new("dimitris Galanakis"," ") me.greet puts me.phone another_me=me another_me.phone= another_me.to_s

6 Object Oriented Programming Class: a collection of data and methods class Person def "+@phone def greet puts "Hello, "+@name def def def def class names should be capitalized me=person.new("dimitris Galanakis"," ") me.greet puts me.phone another_me=me another_me.phone= another_me.to_s

7 Object Oriented Programming Class: a collection of data and methods class Person def "+@phone def greet puts "Hello, "+@name def def def def class names should be capitalized Initializer instance variables name, phone: local variables me=person.new("dimitris Galanakis"," ") me.greet puts me.phone another_me=me another_me.phone= another_me.to_s

8 Object Oriented Programming Class: a collection of data and methods class Person def "+@phone def greet puts "Hello, "+@name def def def def class names should be capitalized Initializer instance variables name, phone: local variables a method me=person.new("dimitris Galanakis"," ") me.greet puts me.phone another_me=me another_me.phone= another_me.to_s

9 Object Oriented Programming Class: a collection of data and methods class Person def "+@phone def greet puts "Hello, "+@name def def def def class names should be capitalized Initializer instance variables name, phone: local variables a method another method me=person.new("dimitris Galanakis"," ") me.greet puts me.phone another_me=me another_me.phone= another_me.to_s

10 Object Oriented Programming Class: a collection of data and methods class Person def "+@phone def greet puts "Hello, "+@name def def def def class names should be capitalized Initializer instance variables name, phone: local variables a method another method me=person.new("dimitris Galanakis"," ") me.greet puts me.phone another_me=me another_me.phone= another_me.to_s

11 Object Oriented Programming Class: a collection of data and methods class Person def "+@phone def greet puts "Hello, "+@name def def def def class names should be capitalized Initializer instance variables name, phone: local variables a method another method me=person.new("dimitris Galanakis"," ") me.greet puts me.phone another_me=me another_me.phone= another_me.to_s

12 Object Oriented Programming Class: a collection of data and methods class Person def "+@phone def greet puts "Hello, "+@name def def def def class names should be capitalized Initializer instance variables name, phone: local variables a method another method accessor methods me=person.new("dimitris Galanakis"," ") me.greet puts me.phone another_me=me another_me.phone= another_me.to_s

13 Object Oriented Programming Class: a collection of data and methods class Person def "+@phone def greet puts "Hello, "+@name def def def def class names should be capitalized Initializer instance variables name, phone: local variables a method another method accessor methods me=person.new("dimitris Galanakis"," ") me.greet puts me.phone another_me=me another_me.phone= another_me.to_s

14 Object Oriented Programming Class: a collection of data and methods class Person def "+@phone def greet puts "Hello, "+@name def def def def class names should be capitalized Initializer instance variables name, phone: local variables a method another method accessor methods me=person.new("dimitris Galanakis"," ") me.greet puts me.phone another_me=me another_me.phone= another_me.to_s

15 Object Oriented Programming Class: a collection of data and methods class Person def "+@phone def greet puts "Hello, "+@name def def def def class names should be capitalized Initializer instance variables name, phone: local variables a method another method accessor methods set methods me=person.new("dimitris Galanakis"," ") me.greet puts me.phone another_me=me another_me.phone= another_me.to_s

16 Object Oriented Programming class Person def def greet puts "Hello, def def def def Class: a collection of data and methods me=person.new("dimitris Galanakis"," ") me.greet puts me.phone another_me=me another_me.phone= another_me.to_s class names should be capitalized Initializer instance variables name, phone: local variables a method another method accessor methods set methods Output

17 Object Oriented Programming class Person def def greet puts "Hello, def def def def Class: a collection of data and methods me=person.new("dimitris Galanakis"," ") me.greet puts me.phone another_me=me another_me.phone= another_me.to_s class names should be capitalized Initializer instance variables name, phone: local variables a method another method accessor methods set methods Output Hello, Dimitris Galanakis Dimitris Galanakis:

18 Class Inheritance A class can be defined as a child of another class. This results in inheriting all the methods and and data in addition to the new ones. Single inheritance: a class has only one parent (like Java and unlike C++). Multiple inheritance is simulated through Modules class Person attr :phone, :name def "+@phone class Employee < Person attr :department def initialize(name,phone,department) def to_s super.to_s+" at the "+@department+" department." alice=employee.new("alice","234234","physics") puts alice.to_s

19 Class Inheritance A class can be defined as a child of another class. This results in inheriting all the methods and and data in addition to the new ones. Single inheritance: a class has only one parent (like Java and unlike C++). Multiple inheritance is simulated through Modules class Person attr :phone, :name def "+@phone auto generate the accessor and setter methods class Employee < Person attr :department def initialize(name,phone,department) def to_s super.to_s+" at the "+@department+" department." alice=employee.new("alice","234234","physics") puts alice.to_s

20 Class Inheritance A class can be defined as a child of another class. This results in inheriting all the methods and and data in addition to the new ones. Single inheritance: a class has only one parent (like Java and unlike C++). Multiple inheritance is simulated through Modules class Person attr :phone, :name def "+@phone auto generate the accessor and setter methods Person objects instance variables class Employee < Person attr :department def initialize(name,phone,department) def to_s super.to_s+" at the "+@department+" department." alice=employee.new("alice","234234","physics") puts alice.to_s

21 Class Inheritance A class can be defined as a child of another class. This results in inheriting all the methods and and data in addition to the new ones. Single inheritance: a class has only one parent (like Java and unlike C++). Multiple inheritance is simulated through Modules class Person attr :phone, :name def "+@phone auto generate the accessor and setter methods Person objects instance variables Employee will be a more specific Person class Employee < Person attr :department def initialize(name,phone,department) def to_s super.to_s+" at the "+@department+" department." alice=employee.new("alice","234234","physics") puts alice.to_s

22 Class Inheritance A class can be defined as a child of another class. This results in inheriting all the methods and and data in addition to the new ones. Single inheritance: a class has only one parent (like Java and unlike C++). Multiple inheritance is simulated through Modules class Person attr :phone, :name def "+@phone auto generate the accessor and setter methods Person objects instance variables Employee will be a more specific Person class Employee < Person attr :department def initialize(name,phone,department) def to_s super.to_s+" at the "+@department+" department." Calls the parent classes initializer alice=employee.new("alice","234234","physics") puts alice.to_s

23 Class Inheritance A class can be defined as a child of another class. This results in inheriting all the methods and and data in addition to the new ones. Single inheritance: a class has only one parent (like Java and unlike C++). Multiple inheritance is simulated through Modules class Person attr :phone, :name def "+@phone class Employee < Person attr :department def initialize(name,phone,department) auto generate the accessor and setter methods Person objects instance variables Employee will be a more specific Person def to_s super.to_s+" at the "+@department+" department." alice=employee.new("alice","234234","physics") puts alice.to_s Calls the parent classes initializer Employee @department instance variables

24 Modules Implement functions that can be shared between classes Multiple inheritance is simulated through Modules module VerboseToS def verbose_tos implement a method that relies on the to_s "This is a rather verbose way to say that "+to_s class Employee include VerboseToS classes can open and close any time include all the methods from VerboseToS module puts alice.verbose_tos Output: This is a rather verbose way to say that alice: at the Physics department.

25 Object Oriented Programming Overview A class is a definition of data + methods An object is an instance of the class and is born by calling the class initializer. The methods of an object are called to access or modify it s data. A class can inherit the data and methods of another class. Modules are collections of methods than can be inserted to any class. Each class inherits only from a single class, but can include many modules. All classes are implicit children of the built in class Object.

26 Basic Ruby Classes Numeric: Integers, Rationals, Floats, Complex Strings: Any alphanumeric between or Regular Expressions: /\w+/ Indexed Collections: Arrays and Hashes

27 Numbers Integers, Rationals, Floats, Complex Source a=13 b=100 puts a*b puts a+b puts 1.2*b-a puts a**b puts a.quo(b) a=math.sin(2.4345)+10 puts a require 'complex' include Math z=complex(4,5) puts atan(z) puts z.arg puts z.real.to_s+","+z.imag.to_s Output / i ,5

28 Strings String: a series of alphanumeric characters in or, such as Hello, World In the strings all characters are literal, but the strings can represent special characters, such as \n, \t etc. prefix='datafile' suffix=".dat" label=200.to_s filename=prefix+label+suffix string="reading #{filename}\n\n" command_string=%x{ls -l #{filename}} string_array=%w{this will create an array of those words}

29 Strings String: a series of alphanumeric characters in or, such as Hello, World In the strings all characters are literal, but the strings can represent special characters, such as \n, \t etc. prefix='datafile' suffix=".dat" label=200.to_s filename=prefix+label+suffix string="reading #{filename}\n\n" command_string=%x{ls -l #{filename}} string concatenate => datafile200.dat string_array=%w{this will create an array of those words}

30 Strings String: a series of alphanumeric characters in or, such as Hello, World In the strings all characters are literal, but the strings can represent special characters, such as \n, \t etc. prefix='datafile' suffix=".dat" label=200.to_s filename=prefix+label+suffix string="reading #{filename}\n\n" command_string=%x{ls -l #{filename}} string concatenate => datafile200.dat Reading datafile200.dat string_array=%w{this will create an array of those words}

31 Strings String: a series of alphanumeric characters in or, such as Hello, World In the strings all characters are literal, but the strings can represent special characters, such as \n, \t etc. prefix='datafile' suffix=".dat" label=200.to_s filename=prefix+label+suffix string="reading #{filename}\n\n" command_string=%x{ls -l #{filename}} string concatenate => datafile200.dat Reading datafile200.dat returns the output of a system command string_array=%w{this will create an array of those words}

32 Regular Expressions Defines a text pattern Can be used for pattern matching and extraction Exactly the same as in perl, awk, sed, egrep, python, etc. Essential for text manipulation, replacement, data extraction \w (\W) any alphanumeric character (opposite) \d (\D) any digit (opposite). any character \. the dot character [ ] ranges and sets of characters ( ) a group (you can refer to it later) + once or more * zero or more times

33 Regular Expressions Defines a text pattern Can be used for pattern matching and extraction Exactly the same as in perl, awk, sed, egrep, python, etc. Essential for text manipulation, replacement, data extraction \w (\W) any alphanumeric character (opposite) \d (\D) any digit (opposite). any character \. the dot character [ ] ranges and sets of characters ( ) a group (you can refer to it later) + once or more * zero or more times line="filling= / " floatpattern=/=(\d+\.*\d*)/ filling=line[floatpattern,1].to_f

34 Regular Expressions Defines a text pattern Can be used for pattern matching and extraction Exactly the same as in perl, awk, sed, egrep, python, etc. Essential for text manipulation, replacement, data extraction \w (\W) any alphanumeric character (opposite) \d (\D) any digit (opposite). any character \. the dot character [ ] ranges and sets of characters ( ) a group (you can refer to it later) + once or more * zero or more times line="filling= / " floatpattern=/=(\d+\.*\d*)/ filling=line[floatpattern,1].to_f =

35 Arrays and Hashes Dynamic, Indexed collections of objects Arrays: the index is an integer (zero based) Hashes: a map or dictionary from any object (called the key) to another object called value. [ ] : Initialize arrays of objects { } : Initialize hashes of objects

36 Array/Hash Examples a=[3,"english",32,"german","greek",:test] puts a[1]+" and "+a[4] puts a.values_at(0,3,4)*"," English and Greek 3,German,Greek h={ 'cello'=>'string', 'clarinet'=>'woodwind', 'drum' => 'percussion', 'trumpet' => 'woodwind', 'violin' => 'string' } puts h['cello'] puts h['clarinet'] string woodwind

37 Symbols Symbol: a constant integer. Same as the enum in C. It is prefixed by : (Example :symbol) Excellent choice for a hash key. hello.to_sym instrument_types={:cello => 'string', :drum => 'percussion'} instrument_types={cello:'string', drum:'percussion'}

38 Symbols Symbol: a constant integer. Same as the enum in C. It is prefixed by : (Example :symbol) Excellent choice for a hash key. hello.to_sym convert a string to a symbol instrument_types={:cello => 'string', :drum => 'percussion'} instrument_types={cello:'string', drum:'percussion'}

39 Symbols Symbol: a constant integer. Same as the enum in C. It is prefixed by : (Example :symbol) Excellent choice for a hash key. hello.to_sym instrument_types={:cello => 'string', :drum => 'percussion'} instrument_types={cello:'string', drum:'percussion'} convert a string to a symbol symbols make ideal hash keys

40 Symbols Symbol: a constant integer. Same as the enum in C. It is prefixed by : (Example :symbol) Excellent choice for a hash key. hello.to_sym instrument_types={:cello => 'string', :drum => 'percussion'} instrument_types={cello:'string', drum:'percussion'} convert a string to a symbol symbols make ideal hash keys Identical to the previous (Ruby 1.9)

41 Control Structures There aren t many that are practically used. Mainly if and while. happy=true if(happy) puts "Hello World" else puts "Goodbye World" puts (happy)? "Hello World" : "Goodbye World" puts "I am happy" if happy C/C++ syntax compact if while(line=gets) puts line

42 Blocks A block is an anonymous function passed as an argument One of Ruby s most pressious feature! Allows for compact and general code Natural way to iterate over collections def fib_up_to(max) i1, i2 = 1, 1 while i1 <= max yield i1 i1, i2 = i2, i1+i2 parallel assignment yield will call the block with f=i1 fib_up_to(1000) { f print f, " " } Output:

43 Typical Containers and Iterators Array.each: execute the block with the element as the argument: a=[1,2,3,4,5] a.each{ e puts e} Array.each_with_index: same but the index is also passed as an argument: a.each_with_index{ e,i puts "index= "+i.to_s+" value= "+e.to_s} Array.collect: replace every element with the result of the block: squares=a.collect{ e e*e} Hash.each: execute the block with the key/value as the arguments h={cello:"string",drum:"percussion"} h.each{ k,v puts k.to_s+" is a "+v+" instrument"} File.open: open a file and pass it s handler to the block: File.open(data.txt) { f while(line=f.gets) puts line }

44 Introduction to Metaprogramming Programmatically generate and insert new code. attr is an example of metaprogramming: it generates and inserts the accessor and setter functions. code = <<-";" def hello puts "Hello" ; puts code instance_eval(code) hello code= def hello puts Hello the code is inserted in the script the defined function can be called.

45 Real Life Application A simple command line tool that will read text, extracts parameters and executes commands on them.

46 Step 1: Input file format Let s assume something about the input Major program output beta iso filling mu = 3.5 Energy per site is: We will extract mu, beta and energy

47 Step 1: Input file format Let s assume something about the input Major program output beta iso filling line.split[0] mu = 3.5 Energy per site is: We will extract mu, beta and energy

48 Step 1: Input file format Let s assume something about the input Major program output beta iso filling mu = 3.5 line.split[0] /mu\ *=\ *(\d+\.*\d*)/ Energy per site is: We will extract mu, beta and energy

49 Step 1: Input file format Let s assume something about the input Major program output beta iso filling mu = 3.5 Energy per site is: line.split[0] /mu\ *=\ *(\d+\.*\d*)/ /Energy[\ \w:]+(\d+\.*\d*)/ We will extract mu, beta and energy

50 Step 2: Implement the data file parser The parser will be implemented as a module so that it can be inserted in any class that may need to know how to read it. module DataFile def read(filename) mupattern=/mu\ *=\ *(\d+\.*\d*)/ energypattern=/energy[\ \w:]+(\d+\.*\d*)/ File.open(filename) { f reg. ex. for mu and energy open the file for reading read it line by line if if line[energypattern,1] }

51 Step 2.5: Including the data file parser class Parameters include DataFile attr :mu, :beta, :energy def initialize(filename) read(filename) def to_s the initialization consists of reading the file into the parameters "Beta= "+beta.to_s+" mu= "+mu.to_s+" energy= "+energy.to_s data.txt Major program output beta iso filling mu = 3.5 Calling code p=parameters.new("data.txt") puts p.to_s Print output Beta= 10.0 mu= 3.5 energy= Energy per site is: 0.254

52 Step 3: Parse command line arguments All the arguments are stored in an array called ARGV We will assume that the first argument is the command and the rest are the files. The command will have arbitrary syntax. tool.rb <command> <files>

53 Step 3.5: Implement a basic parser if(argv.size<2 or!file.exist?(argv[1])) puts "Usage: tool.rb <command> files" exit command="def exec\n"+argv.shift+"\n" Insert command in the class definition. Parameters.module_eval(command) Minimal input validation shift: return the first element after removing it. command= def exec <command> Replace the filenames by the data structures parameters=argv.collect { f Parameters.new(f)} Execute the command for each parameter set. parameters.each { p p.exec} Example: ruby tool.rb puts mu**2 data* Will read all files and print the mu squared

54 Further reading I am not paid by this guy. I find this book a really good introduction and reference. The version for Ruby 1.6 is free online.

Your First Ruby Script

Your First Ruby Script Learn Ruby in 50 pages Your First Ruby Script Step-By-Step Martin Miliauskas @mmiliauskas 1 Your First Ruby Script, Step-By-Step By Martin Miliauskas Published in 2013 by Martin Miliauskas On the web:

More information

CSE 12 Abstract Syntax Trees

CSE 12 Abstract Syntax Trees CSE 12 Abstract Syntax Trees Compilers and Interpreters Parse Trees and Abstract Syntax Trees (AST's) Creating and Evaluating AST's The Table ADT and Symbol Tables 16 Using Algorithms and Data Structures

More information

Programming Paradigms

Programming Paradigms PP 2016/17 Unit 4 Ruby Advanced 1/42 Programming Paradigms Unit 4 Ruby Advanced J. Gamper Free University of Bozen-Bolzano Faculty of Computer Science IDSE PP 2016/17 Unit 4 Ruby Advanced 2/42 Outline

More information

Overview of the Ruby Language. By Ron Haley

Overview of the Ruby Language. By Ron Haley Overview of the Ruby Language By Ron Haley Outline Ruby About Ruby Installation Basics Ruby Conventions Arrays and Hashes Symbols Control Structures Regular Expressions Class vs. Module Blocks, Procs,

More information

Outline. Introduction to Perl. Why use scripting languages? What is expressiveness. Why use Java over C

Outline. Introduction to Perl. Why use scripting languages? What is expressiveness. Why use Java over C Outline Introduction to Perl Grégory Mounié Scripting Languages Perl 2012-10-11 jeu. Basics Advanced 1 / 30 2 / 30 Why use scripting languages? What is expressiveness Why use Java over C Memory management

More information

CSE 341, Autumn 2015, Ruby Introduction Summary

CSE 341, Autumn 2015, Ruby Introduction Summary CSE 341, Autumn 2015, Ruby Introduction Summary Disclaimer: This lecture summary is not necessarily a complete substitute for atting class, reading the associated code, etc. It is designed to be a useful

More information

What is Ruby? CSc 372. Comparative Programming Languages. 27 : Ruby Introduction. Department of Computer Science University of Arizona

What is Ruby? CSc 372. Comparative Programming Languages. 27 : Ruby Introduction. Department of Computer Science University of Arizona What is Ruby? CSc 372 Comparative Programming Languages 27 : Ruby Introduction Department of Computer Science University of Arizona Everything is an object. Everything can be changed: method can be added

More information

CSE 413 Programming Languages & Implementation. Hal Perkins Winter 2019 Ruby Containers, Blocks, and Procs

CSE 413 Programming Languages & Implementation. Hal Perkins Winter 2019 Ruby Containers, Blocks, and Procs CSE 413 Programming Languages & Implementation Hal Perkins Winter 2019 Ruby Containers, Blocks, and Procs CSE413 Winter 2019 1 The Plan Ruby container data structures Blocks and control structures (iterators,

More information

Installation Download and installation instructions can be found at

Installation Download and installation instructions can be found at IntroductiontoRuby Ruby (http://www.ruby-lang.org/en/ ) is a reflective, dynamic, objectoriented, single-pass interpreted programming language. It also has some functional programming features such as

More information

9.2 Linux Essentials Exam Objectives

9.2 Linux Essentials Exam Objectives 9.2 Linux Essentials Exam Objectives This chapter will cover the topics for the following Linux Essentials exam objectives: Topic 3: The Power of the Command Line (weight: 10) 3.3: Turning Commands into

More information

Table of Contents EVALUATION COPY

Table of Contents EVALUATION COPY Table of Contents Introduction... 1-2 A Brief History of Python... 1-3 Python Versions... 1-4 Installing Python... 1-5 Environment Variables... 1-6 Executing Python from the Command Line... 1-7 IDLE...

More information

Week - 01 Lecture - 04 Downloading and installing Python

Week - 01 Lecture - 04 Downloading and installing Python Programming, Data Structures and Algorithms in Python Prof. Madhavan Mukund Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 01 Lecture - 04 Downloading and

More information

PYTHON. Varun Jain & Senior Software Engineer. Pratap, Mysore Narasimha Raju & TEST AUTOMATION ARCHITECT. CenturyLink Technologies India PVT LTD

PYTHON. Varun Jain & Senior Software Engineer. Pratap, Mysore Narasimha Raju & TEST AUTOMATION ARCHITECT. CenturyLink Technologies India PVT LTD PYTHON Varun Jain & Senior Software Engineer Pratap, Mysore Narasimha Raju & TEST AUTOMATION ARCHITECT CenturyLink Technologies India PVT LTD 1 About Python Python is a general-purpose interpreted, interactive,

More information

What s different about Factor?

What s different about Factor? Harshal Lehri What s different about Factor? Factor is a concatenative programming language - A program can be viewed as a series of functions applied on data Factor is a stack oriented program - Data

More information

Using Scala for building DSL s

Using Scala for building DSL s Using Scala for building DSL s Abhijit Sharma Innovation Lab, BMC Software 1 What is a DSL? Domain Specific Language Appropriate abstraction level for domain - uses precise concepts and semantics of domain

More information

CSE341: Programming Languages Lecture 19 Introduction to Ruby and OOP. Dan Grossman Winter 2013

CSE341: Programming Languages Lecture 19 Introduction to Ruby and OOP. Dan Grossman Winter 2013 CSE341: Programming Languages Lecture 19 Introduction to Ruby and OOP Dan Grossman Winter 2013 Ruby logistics Next two sections use the Ruby language http://www.ruby-lang.org/ Installation / basic usage

More information

Unix Basics. Benjamin S. Skrainka University College London. July 17, 2010

Unix Basics. Benjamin S. Skrainka University College London. July 17, 2010 Unix Basics Benjamin S. Skrainka University College London July 17, 2010 Overview We cover basic Unix survival skills: Why you need some Unix in your life How to get some Unix in your life Basic commands

More information

Introduction CMSC 330: Organization of Programming Languages. Books on Ruby. Applications of Scripting Languages

Introduction CMSC 330: Organization of Programming Languages. Books on Ruby. Applications of Scripting Languages Introduction CMSC 330: Organization of Programming Languages Ruby is an object-oriented, imperative scripting language I wanted a scripting language that was more powerful than Perl, and more object-oriented

More information

why you should use Ruby

why you should use Ruby LUKE KANIES why you should use Ruby Luke Kanies runs Reductive Labs (http://reductivelabs.com), a startup producing OSS software for centralized, automated server administration. He has been a UNIX sysadmin

More information

Ruby: Introduction, Basics

Ruby: Introduction, Basics Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 3 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie

More information

Overview of OOP. Dr. Zhang COSC 1436 Summer, /18/2017

Overview of OOP. Dr. Zhang COSC 1436 Summer, /18/2017 Overview of OOP Dr. Zhang COSC 1436 Summer, 2017 7/18/2017 Review Data Structures (list, dictionary, tuples, sets, strings) Lists are enclosed in square brackets: l = [1, 2, "a"] (access by index, is mutable

More information

The current topic: Python. Announcements. Python. Python

The current topic: Python. Announcements. Python. Python The current topic: Python Announcements! Introduction! reasons for studying languages! language classifications! simple syntax specification Object-oriented programming: Python Types and values Syntax

More information

Ruby logistics. CSE341: Programming Languages Lecture 19 Introduction to Ruby and OOP. Ruby: Not our focus. Ruby: Our focus. A note on the homework

Ruby logistics. CSE341: Programming Languages Lecture 19 Introduction to Ruby and OOP. Ruby: Not our focus. Ruby: Our focus. A note on the homework Ruby logistics CSE341: Programming Languages Lecture 19 Introduction to Ruby and OOP Dan Grossman Autumn 2018 Next two sections use the Ruby language http://www.ruby-lang.org/ Installation / basic usage

More information

Iterators and blocks. Using iterators and blocks Iterate with each or use a for loop? Creating iterators

Iterators and blocks. Using iterators and blocks Iterate with each or use a for loop? Creating iterators Iterators and blocks Using iterators and blocks Iterate with each or use a for loop? Creating iterators CSc 372, Fall 2006 Ruby, Slide 77 Iterators and blocks Some methods are iterators. An iterator that

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

CS 5142 Scripting Languages

CS 5142 Scripting Languages CS 5142 Scripting Languages 10/25/2012 Ruby 1 Outline Ruby Martin Hirzel 2 About Ruby Invented 1995 by Yokihiro Matz Matsumoto Influenced by SmallTalk Everything is an object (even e.g., integers) Blocks

More information

EL2310 Scientific Programming

EL2310 Scientific Programming (yaseminb@kth.se) Overview Overview Roots of C Getting started with C Closer look at Hello World Programming Environment Discussion Basic Datatypes and printf Schedule Introduction to C - main part of

More information

Introduction to Programming: Variables and Objects. HORT Lecture 7 Instructor: Kranthi Varala

Introduction to Programming: Variables and Objects. HORT Lecture 7 Instructor: Kranthi Varala Introduction to Programming: Variables and Objects HORT 59000 Lecture 7 Instructor: Kranthi Varala What is a program? A set of instructions to the computer that perform a specified task in a specified

More information

Ruby Topic Maps. Introduction to Ruby. Benjamin Bock.

Ruby Topic Maps. Introduction to Ruby. Benjamin Bock. Ruby Topic Maps http://rtm.rubyforge.org Introduction to Ruby Benjamin Bock 1 Calculator irb(main):001:0> 1+2 Type irb in your Terminal / Command / Shell window to start the interactive Ruby interpreter

More information

Physics 514 Basic Python Intro

Physics 514 Basic Python Intro Physics 514 Basic Python Intro Emanuel Gull September 8, 2014 1 Python Introduction Download and install python. On Linux this will be done with apt-get, evince, portage, yast, or any other package manager.

More information

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8 Epic Test Review 1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4 Write a line of code that outputs the phase Hello World to the console without creating a new line character. System.out.print(

More information

SPARK-PL: Introduction

SPARK-PL: Introduction Alexey Solovyev Abstract All basic elements of SPARK-PL are introduced. Table of Contents 1. Introduction to SPARK-PL... 1 2. Alphabet of SPARK-PL... 3 3. Types and variables... 3 4. SPARK-PL basic commands...

More information

Manual Shell Script Linux If Not Equal String Comparison

Manual Shell Script Linux If Not Equal String Comparison Manual Shell Script Linux If Not Equal String Comparison From the Linux ping manual: If mkdir d failed, and returned a non-0 exit code, Bash will skip the next command, and we will stay in the current

More information

This course is designed for web developers that want to learn HTML5, CSS3, JavaScript and jquery.

This course is designed for web developers that want to learn HTML5, CSS3, JavaScript and jquery. HTML5/CSS3/JavaScript Programming Course Summary Description This class is designed for students that have experience with basic HTML concepts that wish to learn about HTML Version 5, Cascading Style Sheets

More information

What is Scripting? CSCI: 4500/6500 Programming Languages. Higher-level Programming. Origin of Scripting Languages. Contemporary Scripting Languages

What is Scripting? CSCI: 4500/6500 Programming Languages. Higher-level Programming. Origin of Scripting Languages. Contemporary Scripting Languages What is Scripting? CSCI: 4500/6500 Programming Languages! Yes! The name comes from written script such as screenplay, where dialog is repeated verbatim for every performance Scripting Languages Chapter

More information

22c:111 Programming Language Concepts. Fall Types I

22c:111 Programming Language Concepts. Fall Types I 22c:111 Programming Language Concepts Fall 2008 Types I Copyright 2007-08, The McGraw-Hill Company and Cesare Tinelli. These notes were originally developed by Allen Tucker, Robert Noonan and modified

More information

CSE 374 Programming Concepts & Tools. Brandon Myers Winter 2015 Lecture 4 Shell Variables, More Shell Scripts (Thanks to Hal Perkins)

CSE 374 Programming Concepts & Tools. Brandon Myers Winter 2015 Lecture 4 Shell Variables, More Shell Scripts (Thanks to Hal Perkins) CSE 374 Programming Concepts & Tools Brandon Myers Winter 2015 Lecture 4 Shell Variables, More Shell Scripts (Thanks to Hal Perkins) test / if Recall from last lecture: test (not built-in) takes arguments

More information

Introduction to Python

Introduction to Python Introduction to Python EECS 4415 Big Data Systems Tilemachos Pechlivanoglou tipech@eecs.yorku.ca 2 Background Why Python? "Scripting language" Very easy to learn Interactive front-end for C/C++ code Object-oriented

More information

Part 1: jquery & History of DOM Scripting

Part 1: jquery & History of DOM Scripting Karl Swedberg: Intro to JavaScript & jquery 0:00:00 0:05:00 0:05:01 0:10:15 0:10:16 0:12:36 0:12:37 0:13:32 0:13:32 0:14:16 0:14:17 0:15:42 0:15:43 0:16:59 0:17:00 0:17:58 Part 1: jquery & History of DOM

More information

Linux Shell Scripting. Linux System Administration COMP2018 Summer 2017

Linux Shell Scripting. Linux System Administration COMP2018 Summer 2017 Linux Shell Scripting Linux System Administration COMP2018 Summer 2017 What is Scripting? Commands can be given to a computer by entering them into a command interpreter program, commonly called a shell

More information

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Introduction: PHP (Hypertext Preprocessor) was invented by Rasmus Lerdorf in 1994. First it was known as Personal Home Page. Later

More information

An Introduction to Python (TEJ3M & TEJ4M)

An Introduction to Python (TEJ3M & TEJ4M) An Introduction to Python (TEJ3M & TEJ4M) What is a Programming Language? A high-level language is a programming language that enables a programmer to write programs that are more or less independent of

More information

Python for Earth Scientists

Python for Earth Scientists Python for Earth Scientists Andrew Walker andrew.walker@bris.ac.uk Python is: A dynamic, interpreted programming language. Python is: A dynamic, interpreted programming language. Data Source code Object

More information

Jython. secondary. memory

Jython. secondary. memory 2 Jython secondary memory Jython processor Jython (main) memory 3 Jython secondary memory Jython processor foo: if Jython a

More information

Shell Programming. Introduction to Linux. Peter Ruprecht Research CU Boulder

Shell Programming. Introduction to Linux. Peter Ruprecht  Research CU Boulder Introduction to Linux Shell Programming Peter Ruprecht peter.ruprecht@colorado.edu www.rc.colorado.edu Downloadable Materials Slides and examples available at https://github.com/researchcomputing/ Final_Tutorials/

More information

CSE 413 Spring Introduction to Ruby. Credit: Dan Grossman, CSE341

CSE 413 Spring Introduction to Ruby. Credit: Dan Grossman, CSE341 CSE 413 Spring 2011 Introduction to Ruby Credit: Dan Grossman, CSE341 Why? Because: Pure object-oriented language Interesting, not entirely obvious implications Interesting design decisions Type system,

More information

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications JavaScript Started as a simple script in a Web page that is interpreted and run by the browser Supported by most modern browsers Allows dynamic update of a web page More generally, allows running an arbitrary

More information

Introduction to Python. Didzis Gosko

Introduction to Python. Didzis Gosko Introduction to Python Didzis Gosko Scripting language From Wikipedia: A scripting language or script language is a programming language that supports scripts, programs written for a special run-time environment

More information

THE COBRA PROGRAMMING LANGUAGE. cobra-language.com Lang.NET 2008

THE COBRA PROGRAMMING LANGUAGE. cobra-language.com Lang.NET 2008 THE COBRA PROGRAMMING LANGUAGE cobra-language.com Lang.NET 2008 1 INTRO Cobra is a new language Object-oriented, imperative Embraces unit tests, contracts and more General purpose Runs on.net & Mono Windows,

More information

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications JavaScript Started as a simple script in a Web page that is interpreted and run by the browser Supported by most modern browsers Allows dynamic update of a web page More generally, allows running an arbitrary

More information

CSE450. Translation of Programming Languages. Lecture 11: Semantic Analysis: Types & Type Checking

CSE450. Translation of Programming Languages. Lecture 11: Semantic Analysis: Types & Type Checking CSE450 Translation of Programming Languages Lecture 11: Semantic Analysis: Types & Type Checking Structure Project 1 - of a Project 2 - Compiler Today! Project 3 - Source Language Lexical Analyzer Syntax

More information

15.1 Origins and Uses of Ruby

15.1 Origins and Uses of Ruby 15.1 Origins and Uses of Ruby - Designed by Yukihiro Matsumoto; released in 1996 - Use spread rapidly in Japan - Use is now growing in part because of its use in Rails - A pure object-oriented purely interpreted

More information

CS 301. Lecture 05 Applications of Regular Languages. Stephen Checkoway. January 31, 2018

CS 301. Lecture 05 Applications of Regular Languages. Stephen Checkoway. January 31, 2018 CS 301 Lecture 05 Applications of Regular Languages Stephen Checkoway January 31, 2018 1 / 17 Characterizing regular languages The following four statements about the language A are equivalent The language

More information

CMSC330 Spring 2016 Midterm #1 9:30am/12:30pm/3:30pm Solution

CMSC330 Spring 2016 Midterm #1 9:30am/12:30pm/3:30pm Solution CMSC330 Spring 2016 Midterm #1 9:30am/12:30pm/3:30pm Solution Name: Discussion Time: 10am 11am 12pm 1pm 2pm 3pm TA Name (Circle): Adam Anshul Austin Ayman Damien Daniel Jason Michael Patrick William Instructions

More information

CSCI 4152/6509 Natural Language Processing. Perl Tutorial CSCI 4152/6509. CSCI 4152/6509, Perl Tutorial 1

CSCI 4152/6509 Natural Language Processing. Perl Tutorial CSCI 4152/6509. CSCI 4152/6509, Perl Tutorial 1 CSCI 4152/6509 Natural Language Processing Perl Tutorial CSCI 4152/6509 Vlado Kešelj CSCI 4152/6509, Perl Tutorial 1 created in 1987 by Larry Wall About Perl interpreted language, with just-in-time semi-compilation

More information

Python Programming, bridging course 2011

Python Programming, bridging course 2011 Python Programming, bridging course 2011 About the course Few lectures Focus on programming practice Slides on the homepage No course book. Using online resources instead. Online Python resources http://www.python.org/

More information

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

More information

Glossary. For Introduction to Programming Using Python By Y. Daniel Liang

Glossary. For Introduction to Programming Using Python By Y. Daniel Liang Chapter 1 Glossary For Introduction to Programming Using Python By Y. Daniel Liang.py Python script file extension name. assembler A software used to translate assemblylanguage programs into machine code.

More information

Ruby: Introduction, Basics

Ruby: Introduction, Basics Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 4 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie

More information

CEU s (Continuing Education Units) 12 Hours (i.e. Mon Thurs 5 9PM or Sat Sun 8AM 5PM)

CEU s (Continuing Education Units) 12 Hours (i.e. Mon Thurs 5 9PM or Sat Sun 8AM 5PM) Course Name: Intro to Ruby Course Number: WITP 312 Credits: Classroom Hours: 1.2 CEU s (Continuing Education Units) 12 Hours (i.e. Mon Thurs 5 9PM or Sat Sun 8AM 5PM) Flex Training - Classroom and On-Line

More information

PYTHON FOR KIDS A Pl ayfu l I ntrodu ctio n to Prog r am m i ng J a s o n R. B r i g g s

PYTHON FOR KIDS A Pl ayfu l I ntrodu ctio n to Prog r am m i ng J a s o n R. B r i g g s PYTHON FO R K I D S A P l ay f u l I n t r o d u c t i o n to P r o g r a m m i n g Jason R. Briggs Index Symbols and Numbers + (addition operator), 17 \ (backslash) to separate lines of code, 235 in strings,

More information

Ruby: Introduction, Basics

Ruby: Introduction, Basics Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 4 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie

More information

Introduction to Python Part 2

Introduction to Python Part 2 Introduction to Python Part 2 v0.2 Brian Gregor Research Computing Services Information Services & Technology Tutorial Outline Part 2 Functions Tuples and dictionaries Modules numpy and matplotlib modules

More information

The Lorax Programming Language

The Lorax Programming Language The Lorax Programming Language Doug Bienstock, Chris D Angelo, Zhaarn Maheswaran, Tim Paine, and Kira Whitehouse dmb2168, cd2665, zsm2103, tkp2108, kbw2116 Programming Translators and Languages, Department

More information

Vi & Shell Scripting

Vi & Shell Scripting Vi & Shell Scripting Comp-206 : Introduction to Week 3 Joseph Vybihal Computer Science McGill University Announcements Sina Meraji's office hours Trottier 3rd floor open area Tuesday 1:30 2:30 PM Thursday

More information

Software. Programming Languages. Types of Software. Types of Languages. Types of Programming. Software does something

Software. Programming Languages. Types of Software. Types of Languages. Types of Programming. Software does something Software Software does something LBSC 690: Week 10 Programming, JavaScript Jimmy Lin College of Information Studies University of Maryland Monday, April 9, 2007 Tells the machine how to operate on some

More information

Ruby Primer and Review for Developers

Ruby Primer and Review for Developers A PPENDIX A Ruby Primer and Review for Developers This T appendix is designed to act as both a Ruby primer and review, useful both to developers who want to brush up rapidly on their Ruby knowledge, and

More information

[CHAPTER] 1 INTRODUCTION 1

[CHAPTER] 1 INTRODUCTION 1 FM_TOC C7817 47493 1/28/11 9:29 AM Page iii Table of Contents [CHAPTER] 1 INTRODUCTION 1 1.1 Two Fundamental Ideas of Computer Science: Algorithms and Information Processing...2 1.1.1 Algorithms...2 1.1.2

More information

Using bash. Administrative Shell Scripting COMP2101 Fall 2017

Using bash. Administrative Shell Scripting COMP2101 Fall 2017 Using bash Administrative Shell Scripting COMP2101 Fall 2017 Bash Background Bash was written to replace the Bourne shell The Bourne shell (sh) was not a good candidate for rewrite, so bash was a completely

More information

Data Structures (list, dictionary, tuples, sets, strings)

Data Structures (list, dictionary, tuples, sets, strings) Data Structures (list, dictionary, tuples, sets, strings) Lists are enclosed in brackets: l = [1, 2, "a"] (access by index, is mutable sequence) Tuples are enclosed in parentheses: t = (1, 2, "a") (access

More information

Ruby: Blocks, Hashes, and Symbols

Ruby: Blocks, Hashes, and Symbols Ruby: Blocks, Hashes, and Symbols Computer Science and Engineering College of Engineering The Ohio State University Lecture 7 Blocks A block is a statement(s) passed in as an argument to a function 5.times

More information

(CC)A-NC 2.5 by Randall Munroe Python

(CC)A-NC 2.5 by Randall Munroe Python http://xkcd.com/353/ (CC)A-NC 2.5 by Randall Munroe Python Python: Operative Keywords Very high level language Language design is focused on readability Mulit-paradigm Mix of OO, imperative, and functional

More information

Today. Review. Unix as an OS case study Intro to Shell Scripting. What is an Operating System? What are its goals? How do we evaluate it?

Today. Review. Unix as an OS case study Intro to Shell Scripting. What is an Operating System? What are its goals? How do we evaluate it? Today Unix as an OS case study Intro to Shell Scripting Make sure the computer is in Linux If not, restart, holding down ALT key Login! Posted slides contain material not explicitly covered in class 1

More information

Beyond Blocks: Python Session #1

Beyond Blocks: Python Session #1 Beyond Blocks: Session #1 CS10 Spring 2013 Thursday, April 30, 2013 Michael Ball Beyond Blocks : : Session #1 by Michael Ball adapted from Glenn Sugden is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike

More information

Exam 1 Format, Concepts, What you should be able to do, and Sample Problems

Exam 1 Format, Concepts, What you should be able to do, and Sample Problems CSSE 120 Introduction to Software Development Exam 1 Format, Concepts, What you should be able to do, and Sample Problems Page 1 of 6 Format: The exam will have two sections: Part 1: Paper-and-Pencil o

More information

Ruby. Mooly Sagiv. Most slides taken from Dan Grossman

Ruby. Mooly Sagiv. Most slides taken from Dan Grossman Ruby Mooly Sagiv Most slides taken from Dan Grossman Ruby dynamic, reflective, object-oriented, general-purpose programming language Designed and developed in the mid-1990s by Yukihiro "Matz" Matsumoto

More information

Python as a First Programming Language Justin Stevens Giselle Serate Davidson Academy of Nevada. March 6th, 2016

Python as a First Programming Language Justin Stevens Giselle Serate Davidson Academy of Nevada. March 6th, 2016 Python as a First Programming Language Justin Stevens Giselle Serate Davidson Academy of Nevada Under Supervision of: Dr. Richard Kelley Chief Engineer, NAASIC March 6th, 2016 Science Technology Engineering

More information

What is the Best Way for Children to Learn Computer Programming?

What is the Best Way for Children to Learn Computer Programming? What is the Best Way for Children to Learn Computer Programming? Dr Alex Davidovic One of the defining characteristics of today s society is that the computers and mobile devices are the integral and natural

More information

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University CS 112 Introduction to Computing II Wayne Snyder Department Boston University Today: Java basics: Compilation vs Interpretation Program structure Statements Values Variables Types Operators and Expressions

More information

And Parallelism. Parallelism in Prolog. OR Parallelism

And Parallelism. Parallelism in Prolog. OR Parallelism Parallelism in Prolog And Parallelism One reason that Prolog is of interest to computer scientists is that its search mechanism lends itself to parallel evaluation. In fact, it supports two different kinds

More information

Senthil Kumaran S

Senthil Kumaran S Senthil Kumaran S http://www.stylesen.org/ Agenda History Basics Control Flow Functions Modules History What is Python? Python is a general purpose, object-oriented, high level, interpreted language Created

More information

SOAPScript For squeaky-clean code, use SOAPScript Language Summary Bob Nisco Version 0.5 β

SOAPScript For squeaky-clean code, use SOAPScript Language Summary Bob Nisco Version 0.5 β SOAPScript For squeaky-clean code, use SOAPScript Language Summary Bob Nisco Version 0.5 β This page intentionally left blank? It s a paradox more so than a question. Nisco 2 Nisco 3 1. Introduction SOAPScript,

More information

Lecture 2. Object Orientation

Lecture 2. Object Orientation Lecture 2 Object Orientation 1 Homework 0 Grades Homework 0 grades were returned earlier this week Any questions? 2 Homework 1 Homework 1 is due tonight at 11:59pm You will be graded on: Correctness: 15

More information

MEIN 50010: Python Introduction

MEIN 50010: Python Introduction : Python Fabian Sievers Higgins Lab, Conway Institute University College Dublin Wednesday, 2017-10-04 Outline Goals Teach basic programming concepts Apply these concepts using Python Use Python Packages

More information

Scala, Your Next Programming Language

Scala, Your Next Programming Language Scala, Your Next Programming Language (or if it is good enough for Twitter, it is good enough for me) WORLDCOMP 2011 By Dr. Mark C. Lewis Trinity University Disclaimer I am writing a Scala textbook that

More information

About Python. Python Duration. Training Objectives. Training Pre - Requisites & Who Should Learn Python

About Python. Python Duration. Training Objectives. Training Pre - Requisites & Who Should Learn Python About Python Python course is a great introduction to both fundamental programming concepts and the Python programming language. By the end, you'll be familiar with Python syntax and you'll be able to

More information

CS1 Lecture 2 Jan. 16, 2019

CS1 Lecture 2 Jan. 16, 2019 CS1 Lecture 2 Jan. 16, 2019 Contacting me/tas by email You may send questions/comments to me/tas by email. For discussion section issues, sent to TA and me For homework or other issues send to me (your

More information

Introduction to Computer Science. Course Goals. Python. Slides02 - Intro to Python.key - September 15, 2015

Introduction to Computer Science. Course Goals. Python. Slides02 - Intro to Python.key - September 15, 2015 Introduction to Computer Science Barbara Lerner (blerner@mtholyoke.edu) https://www.mtholyoke.edu/~blerner/cs100/ 1 Office Clapp 227, x3250 Mon 1-2 Tues 4-5 Wed. 11-12 Thurs 3:30-4:30 or by appointment

More information

Notes from a Short Introductory Lecture on Scala (Based on Programming in Scala, 2nd Ed.)

Notes from a Short Introductory Lecture on Scala (Based on Programming in Scala, 2nd Ed.) Notes from a Short Introductory Lecture on Scala (Based on Programming in Scala, 2nd Ed.) David Haraburda January 30, 2013 1 Introduction Scala is a multi-paradigm language that runs on the JVM (is totally

More information

CS1 Lecture 3 Jan. 18, 2019

CS1 Lecture 3 Jan. 18, 2019 CS1 Lecture 3 Jan. 18, 2019 Office hours for Prof. Cremer and for TAs have been posted. Locations will change check class website regularly First homework assignment will be available Monday evening, due

More information

programming languages need to be precise a regular expression is one of the following: tokens are the building blocks of programs

programming languages need to be precise a regular expression is one of the following: tokens are the building blocks of programs Chapter 2 :: Programming Language Syntax Programming Language Pragmatics Michael L. Scott Introduction programming languages need to be precise natural languages less so both form (syntax) and meaning

More information

DATA STRUCTURE AND ALGORITHM USING PYTHON

DATA STRUCTURE AND ALGORITHM USING PYTHON DATA STRUCTURE AND ALGORITHM USING PYTHON Advanced Data Structure and File Manipulation Peter Lo Linear Structure Queue, Stack, Linked List and Tree 2 Queue A queue is a line of people or things waiting

More information

just a ((somewhat) safer) dialect.

just a ((somewhat) safer) dialect. Intro_to_C Page 1 Intro to C Tuesday, September 07, 2004 5:30 PM C was developed specifically for writing operating systems Low level of abstraction. "Just above machine language." Direct access to the

More information

Class API. Class API. Constructors. CS200: Computer Science I. Module 19 More Objects

Class API. Class API. Constructors. CS200: Computer Science I. Module 19 More Objects CS200: Computer Science I Module 19 More Objects Kevin Sahr, PhD Department of Computer Science Southern Oregon University 1 Class API a class API can contain three different types of methods: 1. constructors

More information

Ruby assign variable if nil. Ruby assign variable if nil.zip

Ruby assign variable if nil. Ruby assign variable if nil.zip Ruby assign variable if nil Ruby assign variable if nil.zip Assign variable only if not nil (Ruby) and I want the method below to assign value to it only if. Email codedump link for Assign variable only

More information

CSE 374 Midterm Exam Sample Solution 2/11/13. Question 1. (8 points) What does each of the following bash commands do?

CSE 374 Midterm Exam Sample Solution 2/11/13. Question 1. (8 points) What does each of the following bash commands do? Question 1. (8 points) What does each of the following bash commands do? (a) rm x Remove the file named x in the current directory. (b) rm *x Remove all files in the current directory whose names end with

More information

Functional programming in LISP

Functional programming in LISP Programming Languages Week 4 Functional programming in LISP College of Information Science and Engineering Ritsumeikan University review of part 3 enumeration of dictionaries you receive a sequence of

More information

Having Fun with Social Coding. Sean Handley. February 25, 2010

Having Fun with Social Coding. Sean Handley. February 25, 2010 Having Fun with Social Coding February 25, 2010 What is Github? GitHub is to collaborative coding, what Facebook is to social networking 1 It serves as a web front-end to open source projects by allowing

More information

Object-oriented Compiler Construction

Object-oriented Compiler Construction 1 Object-oriented Compiler Construction Extended Abstract Axel-Tobias Schreiner, Bernd Kühl University of Osnabrück, Germany {axel,bekuehl}@uos.de, http://www.inf.uos.de/talks/hc2 A compiler takes a program

More information