- Invalid signature
void main()
(… I mean, seriously?!) - Missing namespace qualifiers throughout
- Missing include for
accumulate
- Missing
)
inaccumulate
call - Invalid arguments to
accumulate
call:init
missingop
has wrong function type (expected(T, T) -> T
; got(T) -> void
)- — in fact, it seems they actually meant
std::for_each
.
- … but using
std::accumulate
correctly would have been way easier, without a gratuitous lambda.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <initializer_list> | |
#include <iostream> | |
#include <iterator> | |
#include <string_view> | |
#include <type_traits> | |
#include <unordered_map> | |
namespace stats { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
os_error = function (message, call = NULL) { | |
class = c('os_error', 'error', 'condition') | |
structure(list(message = message, call = call), class = class) | |
} | |
value_error = function (message, call = NULL) { | |
class = c('value_error', 'error', 'condition') | |
structure(list(message = message, call = call), class = class) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fib(n: int) -> int: | |
def f(n, a, b): | |
if n == 0: return a | |
if n == 1: return b | |
return f(n - 1, b, a + b) | |
return f(n, 0, 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace OperatorTest { | |
public interface ICalculator { } | |
public interface ICalculator<T> : ICalculator { | |
T Add(T a, T b); | |
T Divide(T a, T b); | |
T Multiply(T a, T b); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.blob-code span:before { | |
background: #fdfd9c; | |
color: #a2a2a2; | |
content: attr(class); | |
font-family: sans-serif; | |
font-size: 0.7em; | |
padding: 0 0.2em; | |
vertical-align: middle; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Color = System.Drawing.Color; | |
namespace CsTest { | |
// Generic interfaces. // (1) | |
interface IEquatable<in T> { | |
bool Equals(T other); | |
} | |
interface ICloneable<out T> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
summary.tbl_df = function (object, ...) { | |
dots = rlang::quos(...) | |
stopifnot(length(dots) == 1) | |
name = rlang::quo_name(dots[[1]]) | |
do(object, as_data_frame(as.list(summary(.[[name]])))) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
tmup() { | |
local IFS=$'\n' | |
for line in $(tmux showenv -t $(tmux display -p '#S')); do | |
case $line in | |
-*) unset ${line:1} ;; | |
*) export $line ;; | |
esac | |
done |