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
--- a/src/core/main.c 2019-10-19 18:11:23.000000000 +0200 | |
+++ b/src/core/main.c 2019-10-19 17:41:36.465000943 +0200 | |
@@ -1265,6 +1265,7 @@ | |
} | |
static int bump_rlimit_nofile(struct rlimit *saved_rlimit) { | |
+ struct rlimit new_rlimit; | |
int r, nr; | |
assert(saved_rlimit); |
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
class Canoa | |
{ | |
private double pos; // m | |
private double vel; // m/s | |
public Canoa(double init_pos, double v) { | |
this.vel = v; | |
this.pos = init_pos; | |
} |
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
// see https://www.reddit.com/r/cpp_questions/comments/afp4ae/dynamic_argumentbased_dispatch_will_it_ever_be/eeh8qe7/ | |
// credits to https://www.reddit.com/user/alfps | |
// I've modified it so that it can be compiled with a C++14 compliant compiler, plus minor style | |
// modifications, e.g., I've changed the syntax auto x()->ReturnValue in function declaration and defines, | |
// since there's no point in using it. | |
#include <array> // std::array | |
#include <functional> // std::function | |
#include <iostream> | |
#include <map> // std::map |
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
package Counting is | |
type Element is | |
record | |
S : String (1 .. 3); | |
E1 : Integer; | |
E2 : Integer; | |
end record; | |
type Elements is array (Positive range <>) of Element; | |
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
module Counter | |
(Element(..), | |
countUnique, | |
countUnique2) where | |
data Element = Element { s :: String, | |
e1 :: Int, | |
e2 :: Int } deriving (Show, Eq) |
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
module counter2 | |
implicit none | |
type element | |
character(len=16) :: s | |
integer :: e1, e2 | |
end type element | |
contains | |
function count_unique(s) result(c) |
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 "Element.hpp" | |
#include <vector> | |
#include <string> | |
size_t count_uniques(const std::vector<SElement> v) | |
{ | |
size_t c = 0; | |
bool found; |
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 "elements.h" | |
#include <stddef.h> | |
#include <stdbool.h> | |
static int compare(const element *a, const element *b) | |
{ | |
if (a->e2 == b->e2) | |
return 0; | |
else if (a->e1 != b->e1) |
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
-- interpreter of + and . | |
data StackEl = Onum Integer | Ostr String | |
instance Show StackEl where | |
show (Onum a) = show a | |
show (Ostr s) = "\"" ++ s ++ "\"" | |
plus (Onum a) (Onum b) = Onum $ a+b | |
plus (Onum a) (Ostr b) = Ostr $ (show a) ++ 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
#include <iostream> | |
// likely you'd like to use this someway; instead, this code | |
// simply ignores and accepts memory leaks. | |
//#include <memory> | |
#include <string> | |
#include <stack> | |
#include <sstream> |
NewerOlder