A variable declaration has three basic parts.
TYPE NAME = VALUE;
for(vector<int>::iterator itr = people.begin(); itr != people.end(); itr++) { | |
// do something | |
} |
template <typename T> | |
auto makeSomething(T& t) -> decltype(t.makeSomething()) { | |
auto thing = t.makeSomething(); | |
// edit thing's properties | |
return thing; | |
} |
{-# LANGUAGE GADTs, KindSignatures #-} | |
data Tree :: * where | |
Leaf :: Int -> Tree | |
Node :: Tree -> Tree -> Tree | |
deriving (Show,Eq,Ord) | |
-- Write a function that sums the leaf values in a tree | |
summation :: Tree -> Int | |
summation (Leaf v) = v | |
summation (Node l r) = (summation l) + (summation r) |
# An implementation of the Maybe monad for Nim | |
# This implements the traditional operations, bind(called chain) | |
# and return(called box) as well as a few useful operators for | |
# cleaning up usage of the monad. Also implemented the functor | |
# operation fmap(called map) which allows a procedure to be called | |
# on a wrapped value | |
type | |
Maybe*[T] = object | |
case valid*: bool |
Disclaimer: This is not a comprehensive review. It is to help you emphasize important sections, but it is your responsibility to review all previous labs and relevant chapters in the text.
# Use Xft? | |
use_xft yes | |
xftfont Trebuchet MS:size=8 | |
xftalpha 0.8 | |
text_buffer_size 2048 | |
# Up interval in seconds | |
update_interval 1 | |
# This is the number of times Conky will update before quitting. |
// Sample algorithm, lab 11: bubble sort | |
// Josh Filstrup, GTA EECS Dept @ KU | |
// November 17th, 2014 | |
public class bubble { | |
// A function to swap two elements of an array | |
public static void swap(int[] xs, int i, int j) { | |
// Create a temporary value so we don't lose | |
// it when assigning to xs[i] in the next line. | |
int tmp = xs[i]; |
import java.io.BufferedReader; | |
import java.io.FileReader; | |
public class test { | |
public static void main(String[] args) { | |
// We must put bufferedIO type work in a try-catch block | |
// because it could throw an exception. | |
try { | |
// Create a new buffered reader object, |