diff options
-rw-r--r-- | books/wanted-books.page | 2 | ||||
-rw-r--r-- | film/to-watch.page | 9 | ||||
-rw-r--r-- | software/c.page | 44 | ||||
-rw-r--r-- | software/debian.page | 3 | ||||
-rw-r--r-- | software/functional programming.page | 23 |
5 files changed, 67 insertions, 14 deletions
diff --git a/books/wanted-books.page b/books/wanted-books.page index 6193aa5..7a09dcd 100644 --- a/books/wanted-books.page +++ b/books/wanted-books.page @@ -56,4 +56,6 @@ Novels Other ------- * **Pictures Showing What Happens on Each Page of Thomas Pynchon's Novel Gravity's Rainbow** by Zak Smith + * **The Influence of Sea Power Upon History, 1660-1783** by A.T. Mahan + * **Tempo** by Venkatesh Rao diff --git a/film/to-watch.page b/film/to-watch.page index e6e2df8..0bb81b4 100644 --- a/film/to-watch.page +++ b/film/to-watch.page @@ -23,15 +23,18 @@ Films To Watch * Du Levande * Rykjavik 101 * Dummy - * Cypher - * Silent Running * WestWorld * Logan's Run + * Sleep Dealer + * Tetsuo: Iron Man + * Magnolia + * Babel + * At the Edge of Russia + * Cypher * Mondo Cane Documentaries: - * Helvetica * The Shock of the New * Project Grizzly * Manufacturing Consent diff --git a/software/c.page b/software/c.page new file mode 100644 index 0000000..910a5de --- /dev/null +++ b/software/c.page @@ -0,0 +1,44 @@ + +C Programming Language +======================= + +K&R Notes (unstructured) +----------------------------- + +With pointer arithmatic, the type of ``foo *p`` is taken into account +automagically. Eg, ``p+3`` -> ``0xFEFE0000 + 3 * (sizeof foo)``. + +Examples of tricky pointer sytax:: + + int *ip; + (++*p) + (*p++) + ++(*p) + *(++p) + +In the context of references like function declarations, only the size of the +first dimension of a multi-dimensional array is free; the others must be +specified explicitly:: + + void copy_2d_array(int a[][10], int b[][10]); // Ok + void copy_2d_array(int a[][], int b[][]); // Invalid + void copy_2d_array(int a[10][], int b[10][]); // Invalid + +Negative indexing of arrays is "allowed" (reads ahead of the array in memory); +need to check for that case explicitly. + +``_FORTIFY_SOURCE`` does what it says. + +In C99 can ``int* p`` replace ``int *p``? Seems like yes. + +The "update statement" of a for loop gets executed at the /end/ of every loop, +which means an iteration variable gets updated once more than might be +expected:: + + int i; + for(i = 0; i < 10; i++) { + } + printf("%d\n", i); // prints 10, not 9 + +Any 'inline' should probably be 'static' (local linkage). + diff --git a/software/debian.page b/software/debian.page index f4a2468..a36fec8 100644 --- a/software/debian.page +++ b/software/debian.page @@ -46,3 +46,6 @@ Some gotchas from installing debian a few times: * For the usual system man pages ("Linux Programmer's Manual"), you may need to install 'manpages-dev' + + * To install emacs without an X environment, use ``emacs23-nox`` (or a more + recent version). diff --git a/software/functional programming.page b/software/functional programming.page index 7fa1358..2858a99 100644 --- a/software/functional programming.page +++ b/software/functional programming.page @@ -24,31 +24,32 @@ or variables in layer after layer of functions and just holding on to the outermost layer. For instance, the typical way to write a ``length`` function in python would be:: - def how-long(x): + def how_long(x): l = 0 - while x.has_next() + while x.has_next(): l = l+1; x.pop() return l Using recursion, we could do:: - def how-long-recurse(x): - if x.has_next() + def how_long_recurse(x): + if x.has_next(): x.pop() - return how-long-recurse(x) + 1 - else + return how_long_recurse(x) + 1 + else: return 0 Using the collector paradigm, we could do:: - def add1(x): return a+1; - def how-long-col(x, col): - if x.has_next() + def add1(x): return x+1; + def how_long_col(x, col): + """call this as how_long_col(<collection>, lambda b: b)""" + if not x.has_next(): return col(0) - else + else: x.pop() - return how-long-col(x, lambda a: col(add1(a))) + return how_long_col(x, lambda a: col(add1(a))) The first two ways, the plus one operation is actually executed at any given time, while with the collector implementation we're really creating a |