Consider the following code
def do_some_stuff(x)
try:
val = f(x)
except NameError, e:
val = False
return va;
################################################################ | |
# BASICS: LAMBDA VS LIST COMPREHENSION | |
################################################################ | |
# Filter | |
filter(lambda x: x % 2, range(10)) | |
[x for x in range(10) if x % 2] | |
# Map | |
map(lambda x: x*x, range(10)) |
/*! | |
* Description: | |
* Fill variable child containers to 100% width | |
* http://stackoverflow.com/a/5862782 | |
*/ | |
.control-container { | |
width: 100%; | |
display: table; | |
table-layout: fixed; |
function A = generate_a( N ) | |
% Generates matrix A | |
% N: Integer of size of mesh | |
n = N-1; | |
meshsize = n*n; | |
% Build matrix D | |
D_block = triu(tril(ones(n), 1), -1) - 5*eye(n); | |
D_repeat = repmat({D_block}, n, 1); | |
D_matrix = blkdiag(D_repeat{:}); |