# mk-convert Contents 1 Converting to minikanren, quasimatically. 08 July 2014

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 mk-convert 08 July 2014 Contents 1 Converting to minikanren, quasimatically Variations on a Scheme Racket to minikanren, nally Back to the beginning Conclusions and further guidance Converting to minikanren, quasimatically. #lang racket (require utah/mk) (require utah/let-pair) (provide (all-defined-out)) Some folk wanted a bit more detail on converting programs from Scheme to minikanren. So I thought we could walk through an example in some detail, and that way you can play along at home. So here's a real humdinger of an examplelist-union. It takes two lists (which represent sets) and returns a list representation of their union. ((null? s1) s2) ((member (car s1) s2) (list-union (cdr s1) s2)) (else (cons (car s1) (list-union (cdr s1) s2))))) Let's give it a whirl 1

2 -> (list-union '() '(1 2 3)) (1 2 3) -> (list-union '(2) '(3 2 1)) (3 2 1) -> (list-union '(1 2) '(4 5)) ( ) That seems to work, ship it. So, as Will said on Tuesday, my preferred way to do this is to get my Scheme program looking as much like the resultant minikanren as I can, and then convert to minikanren from there. Testing the whole way through. So the plan is to massage this code until it looks like the minikanren would just fall out trivially, and see if we can't list some rules along the way. 1.1 Variations on a Scheme Let's start by talking about the question of that rst cond line, (null? s1). We know, where we're going, that == is our big, giant hammer. Where it makes sense, I'd like to use equal?, the Racket primitive which tests for structural equality, because that's going to map pretty well to ==. So let's rewrite that to a similar question, which maps over nicely. ((member (car s1) s2) (list-union (cdr s1) s2)) (else (cons (car s1) (list-union (cdr s1) s2))))) Looking good there. The answer of that rst cond clause is a value. We know that when we go to minikanrenize this code, we'll just unify that value with the out variable we will introduce. Now, something to bear in mind is that you can't rely on any Scheme primitives aside from cons. We can cons things together to build structures, but we don't get to pull'em apart any way other than unifying with a pair. In the remaining lines, we're taking cars and cdrs, we'll need some way to represent what we're doing. And here's another minikanrenizing guideline. When you have multiple cond clauses which require performing the same structural decomposition, only do it once, and then use it. Right quick we're going to do a couple of steps that at rst blush look like some pretty fancy dancing. But after doing it a few times, it'll get to be old hat. 2

3 ((member (car s1) s2) (list-union (cdr s1) s2)) (else (cons (car s1) (list-union (cdr s1) s2))))))) In either one of those last two lines, s1 has to be a pair. So that (pair? s1) question we ask there is safe and valid and right and good. And now that we know it's a pair, we have the opportunity to let-bind the car and cdr of s1, and use those names throughout. So here we go. (let ((a (car s1)) (d (cdr s1))) ((member a s2) (list-union d s2)) (else (cons a (list-union d s2)))))))) That's an absolutely legit maneuver. And if you're happy with doing it that way, power to you. I'm going to use a macro we put together called let-pair to do something similar. (define-syntax let-pair (syntax-rules () [(_ ((a. d) call) body) (let ((tmp-res call)) (let ((a (car tmp-res)) body))])) (d (cdr tmp-res))) Let-pair evaluates the expression (which better be something with a car and cdr), and then binds the car and cdr to names you give it. It's just a bit of syntax wizardry, but compare the below to the above and you'll get what's going on. 3

4 ((member a s2) (list-union d s2)) (else (cons a (list-union d s2)))))))) I like that slightly better, `cause when we go to minikanren, we just slip an == in there with some backticks and commas and we'll be on our way. Nooow we get to something pretty interesting. That call to member. We can't rely on Racket's member, because it doesn't know how to go backwards. We're going to have to write our own function, that way we can minikanrenize it, and make our list-union do what we want when we go to list-uniono. So, actually, we're at an interesting point here. A small aside with a punchline. -> (member 3 '(4 5 6)) #f Above, the expression evaluates to #f because 3 isn't in that list. Do you know what value the expression below will evaluate to? -> (member 3 '(3 4 5)) Give you a hint, it's not #t like you might expect. In fact, it's (3 4 5) -> (member 3 '(3 4 5)) (3 4 5) When we write our version of this function, we've got some decisions to make. We must decide if we want to preserve that behavior, or just return #f or #tthat is, should we write a predicate member? instead. And bear in mind that else in the nal line below still has to be dealt with as well. 4

5 ((member a s2) (list-union d s2)) ---> (else (cons a (list-union d s2)))))))) Now, here's the deciding factor. When member returns a non-false value, like (3 4 5) above, we don't care what it is. Sometimes, you might. Here we don't. We'll go with the predicate, member?. (define (member? x ls) ((null? ls) #f) ((equal? x (car ls)) #t) (else (member? x (cdr ls))))) ((member? a s2) (list-union d s2)) (else (cons a (list-union d s2)))))))) And we can go ahead and test that, make sure it still works. Check. Now, let's do to member? the sorts of things we've done to list-union so far. (define (member? x ls) ((equal? '() ls) #f) ((pair? ls) (let-pair ((a. d) ls) ((equal? x a) #t) ---> (else (member? x d))))))) 5

6 ((member? a s2) (list-union d s2)) (else (cons a (list-union d s2)))))))) Will made a point of demonstrating that we need our cond clauses to be non-overlapping to get the behavior we expect and desire when running backwards. Recall that in the rembero example we had to add disequality constraints in order to avoid the odd-looking answers. Same deal here. Now, the else sitting in member? is one we know how to deal with. I know how to write not equal?, and that'll translate right nicely to minikanren. (define (member? x ls) ((equal? '() ls) #f) ((pair? ls) (let-pair ((a. d) ls) ((equal? x a) #t) ((not (equal? x a)) (member? x d))))))) ((member? a s2) (list-union d s2)) (else (cons a (list-union d s2)))))))) Back to list-union. That else in member? was pretty easy to do. The one in list-union, not so much. The fall-through cases of a cond clause with a non-trivial question (that is, where the question of the cond line isn't going to be just a simple == thing) are non-trivial. We could write something called not-a-member, that returns true in all the cases that member will return false. That is, we construct a predicate that's the complement of member?, and use it where we have the else. Or we can use the boolean value which is the result of the call to member?. This decision impacts how we translate member? to minikanren. I'm going to choose to make use of the boolean value which we get back. So we'll rewrite that inner cond, and let-bind the result of the call. 6

7 (let ((b (member? a s2))) ((equal? b #t) (list-union d s2)) (else (cons a (list-union d s2))))))))) Now we've got something we can do with that else. If your instict was to jump to disequality constraints, you aren't wrong, but we can do better. If it isn't #t, then it must be #f. (let ((b (member? a s2))) ((equal? b #t) (list-union d s2)) ((equal? b #f) (cons a (list-union d s2))))))))) Now I want to look at those two answers of the nal two cond clauses. Here there is something interesting. We are computing the same value, (listunion d s2), either way. We can pull that up into a let binding. We can in fact pull that up into the let binding we've already created. This implies that the order in which we evaluate the clauses of that let doesn't matter. In the biz, we use `res' as a name for the variable in the recursive call, for the RESult of the recursion. (let ((b (member? a s2)) (res (list-union d s2))) 7

8 ((equal? b #t) res) ((equal? b #f) (cons a res)))))))) Now (cons a res) is a value, which when we go to minikanren, we'll just unify with out. I'm going to go ahead and rewrite it with the backtick comma syntax, and then we can marvel at what we've done. (define (member? x ls) ((equal? '() ls) #f) ((pair? ls) (let-pair ((a. d) ls) ((equal? x a) #t) ((not (equal? x a)) (member? x d))))))) (let ((b (member? a s2)) (res (list-union d s2))) ((equal? b #t) res) ((equal? b #f) `(,a.,res)))))))) We can now reorder our cond lines in whatever order we wish, and we'll still get the same behavior. And we've got something which, to my eye, looks a heck of a lot like minikanren but still runs in straight Racket. 1.2 Racket to minikanren, nally We can now start converting. We can do member? rst, and then list-union. With a blind, dogmatic obedience, I dutifully stick an `o' on the end. I do a nd-and-replace, so I never leave a call to the old version. I've been bit by that too many times to count. (define (member?o x ls) ((equal? '() ls) #f) 8

9 ((pair? ls) (let-pair ((a. d) ls) ((equal? x a) #t) ((not (equal? x a)) (member?o x d))))))) We need to add a third argument, the out variable, change cond to conde, and we know how to handle the rst clause pretty well. (define (member?o x ls out) e ((== '() ls) (== #f out))...)) Now for that second clause, the (pair? ls) question and the let-pair are all satised by unication. It has a avor of both testing and bindingthat's why it's the giant hammer. Let's rewrite that part, and then we'll come to the inner cond next. Don't forget to freshen the variables a and d. (define (member?o x ls out) e ((== '() ls) (== #f out)) ((fresh (a d) (== `(,a.,d) ls)...)))) That cond has to be a conde, the rst clause of that cond falls pretty easily. (not (equal?... )) needs to be a disequality constraint, and the recursive call needs the third argument passed along. (define (member?o x ls out) e ((== '() ls) (== #f out)) ((fresh (a d) (== `(,a.,d) ls) e ((== x a) (== #t out)) ((=/= x a) (member?o x d out))))))) And we can go ahead and test it. 9

10 -> (run 1 (q) (member?o 3 '(3 4 5) q)) (#t) -> (run* (q) (member?o 3 '(3 4 5) q)) (#t) -> (run* (q) (member?o q '(3 4 5) #t)) (3 4 5) -> (run 4 (q) (member?o 3 q #t)) ((3. _.0) ((_.0 3. _.1) (=/= ((_.0 3)))) ((_.0 _.1 3. _.2) (=/= ((_.0 3)) ((_.1 3)))) ((_.0 _.1 _.2 3. _.3) (=/= ((_.0 3)) ((_.1 3)) ((_.2 3))))) -> (run 4 (q) (fresh (a b c) (== `(,a,b,c) q) (member?o a b c))) ((_.0 () #f) (_.0 (_.0. _.1) #t) ((_.0 (_.1) #f) (=/= ((_.0 _.1)))) ((_.0 (_.1 _.0. _.2) #t) (=/= ((_.0 _.1))))) Lookin' good. Let's bring it home. List-union becomes list-uniono. (define (list-uniono s1 s2 out)...) And let's go ahead and take care of everything up to the let binding. (define (list-uniono s1 s2 out) e ((== '() s1) (== s2 out)) ((fresh (a d) (== `(,a.,d) s1)...)))) The left-hand sides of the clauses of the let reveal that I'm going to need to freshen b and res. And I know that I don't need to freshen them any earlier, either. Because the order of the clauses of the let didn't matter, our transformation didn't give us information regarding which one we want to list rst. It won't impact the correctness, but it might have serious performance implications. (define (list-uniono s1 s2 out) e ((== '() s1) (== s2 out)) 10

11 ((fresh (a d) (== `(,a.,d) s1) (fresh (b res) (member?o a s2 b) (list-uniono d s2 res)...))))) The variables on the left-hand side of the let binding are what I wanted to pass as the last elements of the relations. Cond becomes conde, we can handle the questions, and the answers similar to the manner above. Let's go ahead and tackle the rest of it. (define (list-uniono s1 s2 out) e ((== '() s1) (== s2 out)) ((fresh (a d) (== `(,a.,d) s1) (fresh (b res) (member?o a s2 b) (list-uniono d s2 res) e ((== b #t) (== res out)) ((== b #f) (== `(,a.,res) out)))))))) It's quasi-automatic, reasonably quick, and results in minikanren. -> (run 1 (q) (list-uniono '( ) '(5 6) q)) (( )) 1.3 Back to the beginning Unfortunately, that minikanren is going to have bad divergence behavior, and in any case won't be terribly performant running backwards. But we're close. Let-binding the serious recursive relation invocations above gave us the variable names right where we needed'em, but means that they are above the calls to == in conde. Consider the three clauses of the inner fresh expression in list-uniono. If we run with s1 and s2 fresh, but with some information in the variable out, then we will continue to recur, and the information in out will not get propogated through when we do a run*. This may cause running the relation to loop innitely. We can manually reorder those clauses, and then we've got what we're after. 11

12 (define (member?o x ls out) e ((== '() ls) (== #f out)) ((fresh (a d) (== `(,a.,d) ls) e ((== x a) (== #t out)) ((=/= x a) (member?o x d out))))))) (define (list-uniono s1 s2 out) e ((== '() s1) (== s2 out)) ((fresh (a d) (== `(,a.,d) s1) (fresh (b res) e ((== b #t) (== res out)) ((== b #f) (== `(,a.,res) out))) (member?o a s2 b) (list-uniono d s2 res)))))) And it runs backward too. -> (run 5 (q) (fresh (a b) (== q `(,a,b)) (list-uniono a b '(1 2)))) ((() (1 2)) ((1) (1 2)) ((1 2) ()) ((1) (2)) ((1 1) (1 2))) Now we don't have a prayer of it completing with run*. We assumed our input were lists without duplicates. But we didn't ensure that. See the 5th answer above. Moreover, what we called sets are really lists with denite order. As a result running backwards might not give the expected results. If we are okay with this behavior, awesome. If not, well, then we might want to try augmenting our original functional program some, and then redoing the transformation. There's plenty to play with. 1.4 Conclusions and further guidance Though this seems like a pretty hefty program, in the Scheme of things it's not all that big. As you go on to write more minikanren, here are some things, big and small, to bear in mind: Everything has to be rst-order, defunctionalized, and using datastructure representations. 12

13 We let-bound the values of list-union and member?. In general, if you know what the structure of the call is going to be, use match (or pmatch) to evaluate the expression and match the pieces. This helps to avoid freshening unnecessary variables. When using match, if you're matching on a variable, and the result of the match is exactly that variable, don't create a new variable name. Conversely, if you are using match and decomposing a structure, don't shadow the variable name by rebinding it in the pattern. When you can, put multiple clauses in your let bindings. This indicates when your minikanren program has clauses for which the order doesn't matter, at least when running in the standard (functional) mode. If you plan on using the relational arithmetic suite to perform arithmetic operations, recall those are themselves recursive relations, and should be let-bound as appropriate. Decide ahead of time if you will need to tag relational numbers (to distinguish them from arbitrary lists), if so, bear the tag in mind when you are thinking about the decomposition. It can help to tag your arabic numbers before going to the minikanren arithmetic suite, in this case. When using match or pmatch, it is often advantageous to reorder your clauses in order to group similar decompositions together. When helper functions have been transformed to rst-order and data structures, often you can then in-line the data structures, to avoid freshening some variables and unications. Functions with multiple return values are perfectly acceptable. This often avoids unnecessarily constructing and destructing pairs out of a recursion. Use let-values the way we used let above, and feel free to combine let bindings into let-values bindings, if there is no dependence between them. 13

### Intro. Scheme Basics. scm> 5 5. scm>

Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

### Scheme Basics > (butfirst '(help!)) ()

Scheme Basics > (butfirst '(help!)) () [The butfirst of a *sentence* containing one word is all but that word, i.e., the empty sentence. (BUTFIRST 'HELP!) without the inner parentheses would be butfirst

### Project 5 - The Meta-Circular Evaluator

MASSACHVSETTS INSTITVTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science 6.001 Structure and Interpretation of Computer Programs Fall Semester, 2005 Project 5 - The Meta-Circular

### MITOCW watch?v=yarwp7tntl4

MITOCW watch?v=yarwp7tntl4 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality, educational resources for free.

Linked Lists Along with arrays, linked lists form the basis for pretty much every other data stucture out there. This makes learning and understand linked lists very important. They are also usually the

### Project 5 - The Meta-Circular Evaluator

MASSACHVSETTS INSTITVTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science 6.001 Structure and Interpretation of Computer Programs Spring Semester, 2005 Project 5 - The Meta-Circular

### Instructor: Craig Duckett. Lecture 03: Tuesday, April 3, 2018 SQL Sorting, Aggregates and Joining Tables

Instructor: Craig Duckett Lecture 03: Tuesday, April 3, 2018 SQL Sorting, Aggregates and Joining Tables 1 Assignment 1 is due LECTURE 5, Tuesday, April 10 th, 2018 in StudentTracker by MIDNIGHT MID-TERM

### MITOCW watch?v=rvrkt-jxvko

MITOCW watch?v=rvrkt-jxvko The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To

### The following content is provided under a Creative Commons license. Your support

MITOCW Recitation 1 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high-quality educational resources for free. To make

### Naming Things in Adafruit IO

Naming Things in Adafruit IO Created by Adam Bachman Last updated on 2016-07-27 09:29:53 PM UTC Guide Contents Guide Contents Introduction The Two Feed Identifiers Name Key Aside: Naming things in MQTT

### A lot of people make repeated mistakes of not calling their functions and getting errors. Make sure you're calling your functions.

Handout 2 Functions, Lists, For Loops and Tuples [ ] Functions -- parameters/arguments, "calling" functions, return values, etc. Please make sure you understand this example: def square(x): return x *

### STREAMS 10. Basics of Streams. Practice with Streams COMPUTER SCIENCE 61AS. 1. What is a stream?

STREAMS 10 COMPUTER SCIENCE 61AS Basics of Streams 1. What is a stream? A stream is an element and a promise to evaluate the rest of the stream. Streams are a clever idea that allows one to use sequence

### Racket. CSE341: Programming Languages Lecture 14 Introduction to Racket. Getting started. Racket vs. Scheme. Example.

Racket Next 2+ weeks will use the Racket language (not ML) and the DrRacket programming environment (not emacs) Installation / basic usage instructions on course website CSE34: Programming Languages Lecture

### CS61A Discussion Notes: Week 11: The Metacircular Evaluator By Greg Krimer, with slight modifications by Phoebus Chen (using notes from Todd Segal)

CS61A Discussion Notes: Week 11: The Metacircular Evaluator By Greg Krimer, with slight modifications by Phoebus Chen (using notes from Todd Segal) What is the Metacircular Evaluator? It is the best part

In every sale there is always a scenario where I can t get someone to respond. No matter what I do. I can t get an answer from them. When people stop responding I use the Permission To. This is one of

### An Illustrated Guide to Shell Magic: Standard I/O & Redirection

An Illustrated Guide to Shell Magic: Standard I/O & Redirection Created by Brennen Bearnes Last updated on 2015-03-03 05:15:07 PM EST Guide Contents Guide Contents Overview Input & Output Standard I/O

### CSE 142/143 Unofficial Commenting Guide Eric Arendt, Alyssa Harding, Melissa Winstanley

CSE 142/143 Unofficial Commenting Guide Eric Arendt, Alyssa Harding, Melissa Winstanley In Brief: What You Need to Know to Comment Methods in CSE 143 Audience o A random person you don t know who wants

### Scheme: Data. CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, Glenn G.

Scheme: Data CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, 2017 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks ggchappell@alaska.edu

### Building a system for symbolic differentiation

Computer Science 21b Structure and Interpretation of Computer Programs Building a system for symbolic differentiation Selectors, constructors and predicates: (constant? e) Is e a constant? (variable? e)

### Blitz2D Newbies: Definitive Guide to Types by MutteringGoblin

Blitz2D Newbies: Definitive Guide to Types by MutteringGoblin Types are probably the hardest thing to understand about Blitz Basic. If you're using types for the first time, you've probably got an uneasy

### CIS4/681 { Articial Intelligence 2 > (insert-sort '( )) ( ) 2 More Complicated Recursion So far everything we have dened requires

1 A couple of Functions 1 Let's take another example of a simple lisp function { one that does insertion sort. Let us assume that this sort function takes as input a list of numbers and sorts them in ascending

### Resources matter. Orders of Growth of Processes. R(n)= (n 2 ) Orders of growth of processes. Partial trace for (ifact 4) Partial trace for (fact 4)

Orders of Growth of Processes Today s topics Resources used by a program to solve a problem of size n Time Space Define order of growth Visualizing resources utilization using our model of evaluation Relating

### Introduction to Typed Racket. The plan: Racket Crash Course Typed Racket and PL Racket Differences with the text Some PL Racket Examples

Introduction to Typed Racket The plan: Racket Crash Course Typed Racket and PL Racket Differences with the text Some PL Racket Examples Getting started Find a machine with DrRacket installed (e.g. the

### Understanding Browsers

Understanding Browsers What Causes Browser Display Differences? Different Browsers Different Browser Versions Different Computer Types Different Screen Sizes Different Font Sizes HTML Errors Browser Bugs

### MITOCW watch?v=zlohv4xq_ti

MITOCW watch?v=zlohv4xq_ti The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high-quality educational resources for free. To

### Week 7 Prolog overview

Week 7 Prolog overview A language designed for A.I. Logic programming paradigm Programmer specifies relationships among possible data values. User poses queries. What data value(s) will make this predicate

### The Stack, Free Store, and Global Namespace

Pointers This tutorial is my attempt at clarifying pointers for anyone still confused about them. Pointers are notoriously hard to grasp, so I thought I'd take a shot at explaining them. The more information

### In today s video I'm going show you how you can set up your own online business using marketing and affiliate marketing.

Hey guys, Diggy here with a summary of part two of the four part free video series. If you haven't watched the first video yet, please do so (https://sixfigureinc.com/intro), before continuing with this

### Fall 2017 Discussion 7: October 25, 2017 Solutions. 1 Introduction. 2 Primitives

CS 6A Scheme Fall 207 Discussion 7: October 25, 207 Solutions Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write

### Outline for Today. Euler Tour Trees Revisited. The Key Idea. Dynamic Graphs. Implementation Details. Dynamic connectivity in forests.

Dynamic Graphs Outline for Today Euler Tour Trees Revisited Dynamic connectivity in forests. The Key Idea Maintaining dynamic connectivity in general graphs Dynamic Graphs A data structure for dynamic

### 6.001 Notes: Section 31.1

6.001 Notes: Section 31.1 Slide 31.1.1 In previous lectures we have seen a number of important themes, which relate to designing code for complex systems. One was the idea of proof by induction, meaning

Copyright This ebook is Copyright 2013 Teresa Miller (the Author ). All Rights Reserved. Published in the United States of America. The legal notices, disclosures, and disclaimers in the front and back

### An Introduction to Scheme

An Introduction to Scheme Stéphane Ducasse stephane.ducasse@inria.fr http://stephane.ducasse.free.fr/ Stéphane Ducasse 1 Scheme Minimal Statically scoped Functional Imperative Stack manipulation Specification

### Racket Style Guide Fall 2017

CS17 Integrated Introduction to Computer Science Hughes Racket Style Guide Fall 2017 Contents 1 Introduction 1 2 Naming 1 3 Formatting 1 4 Equality 3 5 Conditionals 4 5.1 Prefer Cond to If......................................

### mid=81#15143

Posted by joehillen - 06 Aug 2012 22:10 I'm having a terrible time trying to find the Lightworks source code. I was under the impression that Lightworks was open source. Usually that means that it's possible

### Interlude: Expressions and Statements

Interactive Programming In Java Page 1 Interlude: Expressions and Statements Introduction to Interactive Programming by Lynn Andrea Stein A Rethinking CS101 Project Overview This interlude explores what

### How To Test Your Code A CS 1371 Homework Guide

Introduction After you have completed each drill problem, you should make it a habit to test your code. There are good ways of testing your code and there are bad ways of testing your code. This guide

### MORE SCHEME. 1 What Would Scheme Print? COMPUTER SCIENCE MENTORS 61A. October 30 to November 3, Solution: Solutions begin on the following page.

MORE SCHEME COMPUTER SCIENCE MENTORS 61A October 30 to November 3, 2017 1 What Would Scheme Print? Solutions begin on the following page. 1. What will Scheme output? Draw box-and-pointer diagrams to help

### Advanced SQL. Chapter 8 finally!

Advanced SQL Chapter 8 finally! Views (okay so this is Ch 7) We've been saving SQL queries by saving text files Isn't there a better way? Views! basically saved SELECT queries Syntax CREATE VIEW viewname

### Scheme Quick Reference

Scheme Quick Reference COSC 18 Fall 2003 This document is a quick reference guide to common features of the Scheme language. It is not intended to be a complete language reference, but it gives terse summaries

### MITOCW watch?v=ytpjdnlu9ug

MITOCW watch?v=ytpjdnlu9ug The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high-quality, educational resources for free.

### CS103 Handout 42 Spring 2017 May 31, 2017 Practice Final Exam 1

CS103 Handout 42 Spring 2017 May 31, 2017 Practice Final Exam 1 We strongly recommend that you work through this exam under realistic conditions rather than just flipping through the problems and seeing

### CS1102: Macros and Recursion

CS1102: Macros and Recursion Kathi Fisler, WPI October 5, 2009 This lecture looks at several more macro examples. It aims to show you when you can use recursion safely with macros and when you can t. 1

### Range Minimum Queries Part Two

Range Minimum Queries Part Two Recap from Last Time The RMQ Problem The Range Minimum Query (RMQ) problem is the following: Given a fixed array A and two indices i j, what is the smallest element out of

### Functional abstraction. What is abstraction? Eating apples. Readings: HtDP, sections Language level: Intermediate Student With Lambda

Functional abstraction Readings: HtDP, sections 19-24. Language level: Intermediate Student With Lambda different order used in lecture section 24 material introduced much earlier sections 22, 23 not covered

### School of Computer Science CPS109 Course Notes 5 Alexander Ferworn Updated Fall 15

Table of Contents 1 INTRODUCTION... 1 2 IF... 1 2.1 BOOLEAN EXPRESSIONS... 3 2.2 BLOCKS... 3 2.3 IF-ELSE... 4 2.4 NESTING... 5 3 SWITCH (SOMETIMES KNOWN AS CASE )... 6 3.1 A BIT ABOUT BREAK... 7 4 CONDITIONAL

### COSC 2P95 Lab 5 Object Orientation

COSC 2P95 Lab 5 Object Orientation For this lab, we'll be looking at Object Orientation in C++. This is just a cursory introduction; it's assumed that you both understand the lecture examples, and will

### Export as DivX, Xvid, x264, MP4 Posted by DJKnuddel - 28 May :09

Export as DivX, Xvid, x264, MP4 Posted by DJKnuddel - 28 May 2011 17:09 Hi, first of all, thank you for this wonderful programme here. I am new in Video Editing and the far best piece of software out there

### ;;; Determines if e is a primitive by looking it up in the primitive environment. ;;; Define indentation and output routines for the output for

Page 1/11 (require (lib "trace")) Allow tracing to be turned on and off (define tracing #f) Define a string to hold the error messages created during syntax checking (define error msg ""); Used for fancy

### Article Buddy User Manual

Article Buddy User Manual Hello and thank you for buying Article Buddy. This guide right here focuses on the features of this absolutely amazing software and how to use it to its fullest. How Do You Use

### Back to the main page Back to the Tutorial Page Digital Audio Rules of Audacity Setup, Audio Import and Playback Recording with Audacity

Back to the main page Back to the Tutorial Page Digital Audio Rules of Audacity Setup, Audio Import and Playback Recording with Audacity Tutorial - I.Basics Part 4 - Recording with Audacity - Part 4 1.

### Scheme: Strings Scheme: I/O

Scheme: Strings Scheme: I/O CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Wednesday, April 5, 2017 Glenn G. Chappell Department of Computer Science University of

### Project 2: Scheme Interpreter

Project 2: Scheme Interpreter CSC 4101, Fall 2017 Due: 12 November 2017 For this project, you will implement a simple Scheme interpreter in C++ or Java. Your interpreter should be able to handle the same

### This exam is worth 30 points, or 18.75% of your total course grade. The exam contains

CS 60A Final May 16, 1992 Your name Discussion section number TA's name This exam is worth 30 points, or 18.75% of your total course grade. The exam contains six questions. This booklet contains eleven

### FOI. Thank you! Perfect x. Sent from my iphone. > > Hi Emma, > > Let's go 12pm on the 29th, here at the ACE offices (Bloomsbury St).

FOI From: Emma Rice < Section 40(2) Sent: 23 November 2016 17:23 To: Section 40(2) Cc: Section 40(2) Subject: Re: The future Thank you! Perfect x Sent from my iphone On 23 Nov 2016, at 17:13, Section 40(2)

### STREAMS 10. Basics of Streams. Practice with Streams COMPUTER SCIENCE 61AS. 1. What is a stream? 2. How does memoization work?

STREAMS 10 COMPUTER SCIENCE 61AS Basics of Streams 1. What is a stream? 2. How does memoization work? 3. Is a cons-stream a special form? Practice with Streams 1. Define a procedure (ones) that, when run

### The SUMO Speaker Series for Undergraduates. The Art Gallery Problem

The SUMO Speaker Series for Undergraduates (food from Pizza Chicago) Wednesday, April 21 4:40-5:30, room 380C The Art Gallery Problem Amy Pang Abstract: Imagine you are the curator of an art gallery with

### Java Programming Constructs Java Programming 2 Lesson 1

Java Programming Constructs Java Programming 2 Lesson 1 Course Objectives Welcome to OST's Java 2 course! In this course, you'll learn more in-depth concepts and syntax of the Java Programming language.

### Warm-up and Memoization

CSE341 Spring 05 Due Wednesday, May 11 Assignment 4 Part I Warm-up and Memoization Warm-up As a warm-up, write the following Scheme functions: 1. Write the function foldl of the form (foldl func initial

### Square Roots: Introduction & Simplification

Square Roots: Introduction & Simplification You already know about squaring. For instance, 2 2 = 4, 3 2 = 9, etc. The backwards of squaring is square-rooting. The symbol for square-rooting is " ", the

### The User Experience Java Programming 3 Lesson 2

The User Experience Java Programming 3 Lesson 2 User Friendly Coding In this lesson, we'll continue to work on our SalesReport application. We'll add features that make users happy by allowing them greater

### MITOCW watch?v=tkwnms5irbu

MITOCW watch?v=tkwnms5irbu The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To

### icloud Photo Library: Explained

icloud Photo Library: Explained Wednesday, Apr 8, 2015 at 3446 pm EDT icloud Photo Library was designed to keep all your personal photos and videos safe, synced, and available on all of your devices. That

### BreezingForms Custom Fields for VirtueMart 2

BreezingForms Custom Fields for VirtueMart 2 Help! If anyone can help us get these working again for VM3+ it would much appreciated! Please visit this page for more info and how to get the files you'll

### SCHEME 7. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. October 29, 2015

SCHEME 7 COMPUTER SCIENCE 61A October 29, 2015 1 Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write Scheme programs,

### GEO 425: SPRING 2012 LAB 9: Introduction to Postgresql and SQL

GEO 425: SPRING 2012 LAB 9: Introduction to Postgresql and SQL Objectives: This lab is designed to introduce you to Postgresql, a powerful database management system. This exercise covers: 1. Starting

### I always recommend diversifying and testing more than one source, but make sure it is as targeted as possible.

With traffic there are two real kinds - free and paid. I always recommend diversifying and testing more than one source, but make sure it is as targeted as possible. More often than not, I've had people

### CS103 Handout 39 Winter 2018 February 23, 2018 Problem Set 7

CS103 Handout 39 Winter 2018 February 23, 2018 Problem Set 7 What can you do with regular expressions? What are the limits of regular languages? In this problem set, you'll explore the answers to these

### Monday. A few notes on homework I want ONE spreadsheet with TWO tabs

CS 1251 Page 1 Monday Sunday, September 14, 2014 2:38 PM A few notes on homework I want ONE spreadsheet with TWO tabs What has passed before We ended last class with you creating a function called givemeseven()

### Part 1 Simple Arithmetic

California State University, Sacramento College of Engineering and Computer Science Computer Science 10A: Accelerated Introduction to Programming Logic Activity B Variables, Assignments, and More Computers

### BBC Learning English Face up to Phrasals Mark's Mistake

BBC Learning English Face up to Phrasals Mark's Email Mistake Episode 1: Email Fun? Mark: Hey Ali, did you check out that email I sent you the one about stupid Peter, saying how stupid he is? Oh dear.

Tutorials» Guided Tutorials» Previous: Introduction Next: Programming GNU Radio in Python Tutorial: GNU Radio Companion Objectives Create flowgraphs using the standard block libraries Learn how to debug

### Foundations, Reasoning About Algorithms, and Design By Contract CMPSC 122

Foundations, Reasoning About Algorithms, and Design By Contract CMPSC 122 I. Logic 101 In logic, a statement or proposition is a sentence that can either be true or false. A predicate is a sentence in

### SQL - Tables. SQL - Create a SQL Table. SQL Create Table Query:

SQL - Tables Data is stored inside SQL tables which are contained within SQL databases. A single database can house hundreds of tables, each playing its own unique role in th+e database schema. While database

### AHHHHHHH!!!! NOT TESTING! Anything but testing! Beat me, whip me, send me to Detroit, but don t make me write tests!

NAME DESCRIPTION Test::Tutorial - A tutorial about writing really basic tests AHHHHHHH!!!! NOT TESTING! Anything but testing! Beat me, whip me, send me to Detroit, but don t make me write tests! *sob*

### An array of an array is just a regular old that you can get at with two subscripts, like \$AoA[3][2]. Here's a declaration of the array:

NAME perllol - Manipulating Arrays of Arrays in Perl DESCRIPTION Declaration and Access of Arrays of Arrays The simplest thing to build is an array of arrays (sometimes imprecisely called a list of lists).

### T Mobile Manual Contract Deals Iphone 5s Work In India

T Mobile Manual Contract Deals Iphone 5s Work In India cheap. I saw that the Apple Store in Canada was selling them unlocked. I bought the no-contract T-mobile iphone 6 from Apple's website and am using

### Transcript: A Day in the Life of a K12 Seventh Grade Teacher

Transcript: A Day in the Life of a K12 Seventh Grade Teacher Transcript (Video) Transcript (Video with Audio Description) Transcript (Audio Description) Transcript (Video) 00:00:00.000 MUSIC 00:00:05.799

### How To Make 3-50 Times The Profits From Your Traffic

1 How To Make 3-50 Times The Profits From Your Traffic by Chris Munch of Munchweb.com Copyright Munchweb.com. All Right Reserved. This work cannot be copied, re-published, or re-distributed. No re-sell

### Interpreters and Tail Calls Fall 2017 Discussion 8: November 1, 2017 Solutions. 1 Calculator. calc> (+ 2 2) 4

CS 61A Interpreters and Tail Calls Fall 2017 Discussion 8: November 1, 2017 Solutions 1 Calculator We are beginning to dive into the realm of interpreting computer programs that is, writing programs that

### CS61A Notes 02b Fake Plastic Trees. 2. (cons ((1 a) (2 o)) (3 g)) 3. (list ((1 a) (2 o)) (3 g)) 4. (append ((1 a) (2 o)) (3 g))

CS61A Notes 02b Fake Plastic Trees Box and Pointer Diagrams QUESTIONS: Evaluate the following, and draw a box-and-pointer diagram for each. (Hint: It may be easier to draw the box-and-pointer diagram first.)

### How To Set Up Your Sales Funnel

1 How to Set up Your Sales Funnel ver: 1.2 Buildabizonline.com The purpose of this manual is simply to show you how to set up a simple straightforward sales funnel using the Simpe Marketing Biz method.

### The Basics of Video Editing Part I: Getting to Know Your Editing Environment

The Basics of Video Editing: Notes The Basics of Video Editing Part I: Getting to Know Your Editing Environment Adam Dachis If you've edited a few videos but have always wanted to step up your game and

Table of Contents You are here What?! A book on forms? How does React handle forms? Why not start with a form library? Forms 101 Making the simplest form How are edits handled? Validations Providing feedback

### Desktop Ponies A Beginner's Guide

Desktop Ponies A Beginner's Guide Everything you always wanted to know about desktop pony creation and never bothered to ask because it's actually quite self-explanatory and stuff... (For Desktop Ponies

### Chapter 10 Recursion

Chapter 10 Recursion Written by Dr. Mark Snyder [minor edits for this semester by Dr. Kinga Dobolyi] Recursion implies that something is defined in terms of itself. We will see in detail how code can be

### Introduction to Asymptotic Running Time Analysis CMPSC 122

Introduction to Asymptotic Running Time Analysis CMPSC 122 I. Comparing Two Searching Algorithms Let's begin by considering two searching algorithms you know, both of which will have input parameters of

### 6.034 Notes: Section 11.1

6.034 Notes: Section 11.1 Slide 11.1.1 We've now spent a fair bit of time learning about the language of first-order logic and the mechanisms of automatic inference. And, we've also found that (a) it is

### Below is the overall grade distribution for the second CS106A midterm exam:

CS106A Handout 25S Winter 2015 March 9, 2015 Second CS106A Midterm Exam Solutions Below is the overall grade distribution for the second CS106A midterm exam: 160 140 120 100 80 60 40 20 0 0-10 11-15 16-20

### Client Side JavaScript and AJAX

Client Side JavaScript and AJAX Client side javascript is JavaScript that runs in the browsers of people using your site. So far all the JavaScript code we've written runs on our node.js server. This is

### Using X-Particles with Team Render

Using X-Particles with Team Render Some users have experienced difficulty in using X-Particles with Team Render, so we have prepared this guide to using them together. Caching Using Team Render to Picture

### Arbori Starter Manual Eugene Perkov

Arbori Starter Manual Eugene Perkov What is Arbori? Arbori is a query language that takes a parse tree as an input and builds a result set 1 per specifications defined in a query. What is Parse Tree? A

### Instant Keyword Riches

Instant Keyword Riches Instant Keyword Riches Table of Contents Introduction... 3 Preliminary Keyword Research... 4 Keyword Assessment... 6 Keywords in SEO... 10 Domain Names... 10 URLs... 11 Heading Tags...

### The Design Process. General Development Issues. C/C++ and OO Rules of Thumb. Home

A l l e n I. H o l u b & A s s o c i a t e s Home C/C++ and OO Rules of Thumb The following list is essentially the table of contents for my book Enough Rope to Shoot Yourself in the Foot (McGraw-Hill,

### Scheme as implemented by Racket

Scheme as implemented by Racket (Simple view:) Racket is a version of Scheme. (Full view:) Racket is a platform for implementing and using many languages, and Scheme is one of those that come out of the