# miekg/gobook

### Subversion checkout URL

You can clone with
or
.

update exercises

commit 4e71fae1cf92d13854516ef2a0a5dc5a996e68b3 1 parent f37b9eb
authored
2  ex-basics/ex-average-no-func.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Average},difficulty=4] +\begin{Exercise}[title={Average},difficulty=1] \label{ex:average no func} \Question\label{ex:average no func q1} Give the code that calculates the average of a \type{float64} slice. In
2  ex-basics/ex-fizzbuzz.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={FizzBuzz},difficulty=1] +\begin{Exercise}[title={FizzBuzz},difficulty=0] \label{ex:fizzbuzz} \Question \label{ex:fizzbuzz q1} Solve this problem, called the Fizz-Buzz \cite{fizzbuzz} problem:
2  ex-basics/ex-for.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={For-loop},difficulty=1] +\begin{Exercise}[title={For-loop},difficulty=0] \label{ex:for-loop} \Question \label{ex:for-loop q1} Create a simple loop with the \key{for} construct. Make it loop 10 times and print out the loop counter with the \package{fmt} package.
2  ex-beyond/ex-cat.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Cat},difficulty=6] +\begin{Exercise}[title={Cat},difficulty=1] \label{ex:cat} \Question \label{ex:cat q1} Write a program which mimics the Unix program \prog{cat}. For those who don't know this program, the following
2  ex-beyond/ex-map.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Map function with interfaces},difficulty=6] +\begin{Exercise}[title={Map function with interfaces},difficulty=2] \label{ex:map function interfaces} \Question Use the answer from exercise Q\ref{ex:map function}, but now
2  ex-beyond/ex-pointer-arith.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Pointer arithmetic},difficulty=4] +\begin{Exercise}[title={Pointer arithmetic},difficulty=1] \label{ex:pointer arithmetic} \Question In the main text on page \pageref{main:pointer arithmetic}
2  ex-beyond/ex-pointers-method.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Method calls},difficulty=8] +\begin{Exercise}[title={Method calls},difficulty=2] \label{ex:methodcalls} \Question \label{ex:methodcalls q1} Suppose we have the following program. Note the package \package{container/vector} was once part
2  ex-beyond/ex-pointers.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Pointers},difficulty=6] +\begin{Exercise}[title={Pointers},difficulty=1] \label{ex:pointers} \Question
2  ex-channels/ex-fib.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Fibonacci II},difficulty=7] +\begin{Exercise}[title={Fibonacci II},difficulty=2] \label{ex:fibonaci II} \Question\label{ex:fibonaci II q1} This is the same exercise as the one given page \pageref{ex:fibonaci}
2  ex-channels/ex-for-channels.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Channels},difficulty=4] +\begin{Exercise}[title={Channels},difficulty=1] \label{ex:channels} \Question\label{ex:channels q1} Modify the program you created in exercise Q\ref{ex:for-loop}
2  ex-functions/ex-average.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Average},difficulty=4] +\begin{Exercise}[title={Average},difficulty=0] \label{ex:average} \Question\label{ex:average q1} Write a function that calculates the average of a \type{float64} slice.
2  ex-functions/ex-bubblesort.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Bubble sort},difficulty=5] +\begin{Exercise}[title={Bubble sort},difficulty=1] \label{ex:bubble} \Question\label{ex:bubble q1} Write a function that performs Bubble sort on slice of ints. From \cite{bubblesort}:
2  ex-functions/ex-fib.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Fibonacci},difficulty=5] +\begin{Exercise}[title={Fibonacci},difficulty=1] \label{ex:fibonaci} \Question\label{ex:fibonaci q1} The Fibonacci sequence starts as follows: $1, 1, 2, 3, 5, 8, 13, \ldots$
2  ex-functions/ex-for.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={For-loop II},difficulty=1] +\begin{Exercise}[title={For-loop II},difficulty=0] \label{ex:for-loop II} \Question Remember Q\ref{ex:for-loop} (see page \pageref{ex;for-loop}? We extend this a little and now ask you to put the body of the for loop
2  ex-functions/ex-funcfunc.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Functions that return functions},difficulty=6] +\begin{Exercise}[title={Functions that return functions},difficulty=1] \label{ex:function} \Question\label{ex:function q1} Write a function that returns a function that performs a $+2$ on integers. Name the function \func{plusTwo}.
2  ex-functions/ex-map.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Map function},difficulty=4] +\begin{Exercise}[title={Map function},difficulty=1] \label{ex:map function} A \func{map()}-function is a function that takes a function and a list. The function is applied to
2  ex-functions/ex-minmax.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Minimum and maximum},difficulty=3] +\begin{Exercise}[title={Minimum and maximum},difficulty=0] \label{ex:minmax} \Question\label{ex:minmax q1} Write a function that calculates the maximum value in an \type{int} slice (\type{[]int}).
2  ex-functions/ex-order.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Integer ordering},difficulty=3] +\begin{Exercise}[title={Integer ordering},difficulty=0] \label{ex:ordering function} \Question Write a function that returns its (two) parameters in the right, numerical (ascending) order:\newline
2  ex-functions/ex-scope.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Scope},difficulty=4] +\begin{Exercise}[title={Scope},difficulty=1] \label{ex:scope} \Question\label{ex:scope q1} What is wrong with the following program?
2  ex-functions/ex-stack.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Stack},difficulty=5] +\begin{Exercise}[title={Stack},difficulty=1] \label{ex:stack} \Question \label{ex:stack q1} Create a simple stack which can hold a fixed amount of ints. It does not have to grow beyond this limit.
2  ex-functions/ex-vararg.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Var args},difficulty=5] +\begin{Exercise}[title={Var args},difficulty=1] \label{ex:varargs} \Question\label{ex:varargs q1} Write a function that takes a variable numbers of ints and prints
2  ex-interfaces/ex-interfaces.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Interfaces and compilation},difficulty=6] +\begin{Exercise}[title={Interfaces and compilation},difficulty=1] \Question The code in listing \ref{src:interface fail} on page \pageref{src:interface fail} compiles OK --- as stated
2  ex-interfaces/ex-minmax.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Interfaces and max()},difficulty=7] +\begin{Exercise}[title={Interfaces and max()},difficulty=2] \Question In exercise Q\ref{ex:minmax} we created a max function that works on a slice of integers.
2  ex-interfaces/ex-pointers-and-reflect.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Pointers and reflection},difficulty=5] +\begin{Exercise}[title={Pointers and reflection},difficulty=1] \label{ex:pointers and reflection} \Question One of the last paragraphs in section \titleref{sec:introspection and reflection}''
2  ex-packages/ex-calc.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Calculator},difficulty=7] +\begin{Exercise}[title={Calculator},difficulty=2] \label{ex:calc} \Question\label{ex:calc q1} Create a reverse polish calculator. Use your stack package.
2  ex-packages/ex-stack-package.tex
 @@ -1,4 +1,4 @@ -\begin{Exercise}[title={Stack as package},difficulty=2] +\begin{Exercise}[title={Stack as package},difficulty=0] \label{ex:stack-package} \Question\label{ex:stack-package q1} See the Q\ref{ex:stack} exercise. In this exercise we want to create