New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

CSCI 2041 Week 1 notes

by: Lauren Arbisi

CSCI 2041 Week 1 notes CSCI 2041

Lauren Arbisi
U of M
View Full Document for 0 Karma

View Full Document


Unlock These Notes for FREE

Enter your email below and we will instantly email you these Notes for Advanced Programming Principles

(Limited time offer)

Unlock Notes

Already have a StudySoup account? Login here

Unlock FREE Class Notes

Enter your email below to receive Advanced Programming Principles notes

Everyone needs better class notes. Enter your email and we will send you notes for this class for free.

Unlock FREE notes

About this Document

First week of notes for the semester; introduces clojure and briefly explains multi-processing.
Advanced Programming Principles
James Moen
Class Notes
CS, Computer, Science, CSCI, cse




Popular in Advanced Programming Principles

Popular in Computer Science and Engineering

This 3 page Class Notes was uploaded by Lauren Arbisi on Monday August 15, 2016. The Class Notes belongs to CSCI 2041 at University of Minnesota taught by James Moen in Fall 2016. Since its upload, it has received 411 views. For similar materials see Advanced Programming Principles in Computer Science and Engineering at University of Minnesota.

Popular in Computer Science and Engineering


Reviews for CSCI 2041 Week 1 notes


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 08/15/16
Written by Lauren Arbisi Week 1Notes CSCI 2041 Fall 2016 James Moen Wednesday, September 7, 2016 1. Administrative stuff a. First time teaching class. b. No textbook for this class. i. Clojure is a relatively new language. ii. Functional programming generally doesn’t have good texts. c. 3 projects, 2 midterms, 1 final for this course. d. We’ll learn a little bit of OCaml at the end of the semester because previous teachers often have taught in their classes. 2. Functional programming a. Paradigms in programming i. Procedural programming: like C and Fortran ii. Object-oriented programming: like Java and Python iii. Functional programming: like Clojure and OCaml 1. Treats computation as evaluation of expressions (involve functions) and avoids state changes and mutable data (variables). 2. Functional programming doesn’t change variables. It uses nested functions. b. Why we use functional programming: multi-processing. i. Moore’s “Law”: the number of transistors in computers doubles every 2 years. In Professor Moen’s words, “We get better and better at building computers, and we can cram more and more transistors into them, making them increasingly powerful.” ii. Moore’s “Law” will eventually be disproven… because that’s how the universe works. iii. Computing power will continue to increase by making computers with multiple processors that run simultaneously. c. Multi-processing needs functional programming to work properly. Here is an example of non-functional programming messing up a multi-processing situation. In the diagram above, P and P represent separate processors which both have pointers to the top of 1 2 the stack. In this situation,1P needs to push to the stack and 2 needs to pop from the stack. i. Imagine that P 1ushes a new element called D first, then P p2ps. Element P has2popped D. ii. Imagine that P2pops first, then P1pushes a new element called D. Element P ha2 popped C. iii. If 1 pushes and P 2ops at the exact same time, you’re probably screwed due to the limitations of computer hardware. iv. In any situation, the outcome is different! d. Let’s take a look at what would happen if the pointers went directly to the top element of the stack, effectively eliminating the “top” variable. Written by Lauren Arbisi In the diagram above, P a1d P rep2esent separate processors which both have pointers to the first element of the stack. In this situation, P1needs to push to the stack and P ne2ds to pop from the stack. i. Imagine that P p1shes a new element called D first, then P pops2 Because P ’s poin2er was still pointing to element C after P 1ushed D, P po2ped C. ii. Imagine that P 2ops first, then P 1ushes a new element called D. Element P has po2ped C. iii. If 1 pushes and P 2ops at the exact same time, P wil2 have popped C for the same reasons given in situation i. iv. Because of the flexibility afforded by functional programming, we can basically do the the steps in any order. 3. Clojure a. Clojure is a member of the Lisp family. i. How it got its name: Lis(t) p(rocessor). ii. Lisp is the 2 oldest programming language still in widespread use. iii. Lisp 1 was introduced by John McCarthy and his students in 1958. iv. Lisp uses homoiconicity, meaning that programs and data have the same representation. (Programs work on other programs.) v. Lisp 1.5 (1960) has many derivatives, most notably: 1. Scheme (1975) 2. Common Lisp (1984) 3. Clojure (2007) b. Homoiconicity in Clojure i. (F a b c) can work as a data structure: a list/sequence with 4 parts: F, a, b, and c. ii. (F a b c) could be calling function F with parameters a, b, and c. c. Example program defining a factorial function. (def factorial (fn [n] (if (= n 0 (* n (factorial (- n 1))))))) Friday, September 9, 2016 1. Clojure runs on the Java virtual machine. Where Java runs, Clojure runs. 2. Parts of Clojure functions a. Literals: evaluate to themselves. i. Numbers (as in Java) ii. Strings (“…”) iii. Characters (\c, \newline, \backspace, etc…) iv. Boolean values (false, true) Written by Lauren Arbisi v. nil (pointer to nothing, like Java’s null.) vi. Keywords b. Symbols: names/identifiers i. Name can be bound to a value. ii. Starts with a non-numeric character and can contain alphanumeric characters and these other characters: *, +, !, -, _, ', and ? c. Composite forms i. List 1. This is an empty list:() 2. This is a filled li(e:1 e2 … e k 3. Jth element O(j) ii. Vector 1. This is an empty vector [] 2. This is a filled vecto[e 1 e 2 … e k 3. A vector is like an array, except that its elements can be any form. 4. Jth element O(1) d. Special Forms: look like functions, but may evaluate their arguments in unusual ways. i. def (def n e) binds n to the result of evaluating e. ii. fn (in other Lisp languages, called lambda) (fn [p 1 p 2 … p k e) results in a function with parameters p1, 2,d p akd body e. iii. quote 1. (quote e) returns e without evaluating it. Can also be written as‘e 2. ‘(F a b c) returns the list with elements F, a, b, and c. iv. Commenting: ;comment until end of line


Buy Material

Are you sure you want to buy this material for

0 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Allison Fischer University of Alabama

"I signed up to be an Elite Notetaker with 2 of my sorority sisters this semester. We just posted our notes weekly and were each making over $600 per month. I LOVE StudySoup!"

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.