Skip to content

Instantly share code, notes, and snippets.

// include your class here
#include <iostream>
#include <sstream>
#include <string>
void unless( const bool condition, const std::string& error )
{
if( !condition )
{
BOOST_AUTO_TEST_CASE( call_and_return_factorial )
{
auto code = create_code_segment(
// stack: [-4: n] (supplied by executor)
opcode::relative_load_stack, std::uint32_t( 4 ), std::int32_t( -4 ),
// stack: [-8: n (return value memory, to be overwritten)] [-4: n]
// result = factorial( n )
opcode::call, label_reference( "factorial" ),
// stack: [factorial( n )]
opcode::exit,
3>P:\Programming\Libraries\boost_1_58_0\boost/variant/variant.hpp(978): error C3066: there are multiple ways that an object of this type can be called with these arguments
3> P:\Programming\Libraries\perseus\code\src\executable\perseus_print.cpp(37): note: could be 'void print_visitor::operator ()(const perseus::detail::ast::void_expression &) const'
3> P:\Programming\Libraries\perseus\code\src\executable\perseus_print.cpp(42): note: or 'void print_visitor::operator ()(const perseus::detail::ast::string_literal &) const'
3> P:\Programming\Libraries\perseus\code\src\executable\perseus_print.cpp(47): note: or 'void print_visitor::operator ()(uint32_t) const'
3> P:\Programming\Libraries\perseus\code\src\executable\perseus_print.cpp(52): note: or 'void print_visitor::operator ()(bool) const'
3> P:\Programming\Libraries\perseus\code\src\executable\perseus_print.cpp(57): note: or 'void print_visitor::operator ()(const perseus::detail::ast::identifier &) const'
3> P:\Programming\Librari
#include "astar.hpp"
#include "vector.hpp"
#include <algorithm>
#include <iterator>
#include <vector>
#include <queue>
#include <cassert>
using Index = int;
-##- -##- -##- -##- -##- -##- -##- -##- -##-
-##- -##- -##- -##--##- -##--##-
-##- -##- -##- -##-
-##- -##--##- -##- -##- -##- -##-
-##- -##- -##--##- -##--##- -##- -##-
-##- -##- -##- -##- -##- -##-
-##- -##--##--##- -##- -##-
-##- -##--##--##- -##- -##--##- -##-
-##- -##- -##- -##- -##- -##-
-##- -##- -##-
#pragma once
#include <cstddef>
#include <cctype>
#include <algorithm>
#include <istream>
#include <streambuf>
#include <utility>
#include "gsl.h"
#pragma once
#include <array>
#include <utility>
#include <cassert>
#include <cstddef>
#include <algorithm>
#include "qcommon/q_platform.h"
/*
main = interact(decode tail(lines) ctree . head . lines)
-- the parens here are misleading, this is really just:
main = interact(decode tail lines ctree . head . lines)
-- which comes down to this due to operator precedence:
main = interact((decode tail lines ctree) . head . lines)
*/
int main()
{
@mrwonko
mrwonko / polish.hs
Last active November 23, 2015 18:04
module Main( main ) where
data PolishElement = PolishPlus | PolishNumber Integer deriving (Show)
polish :: [PolishElement] -> (Integer, [PolishElement])
polish (PolishNumber x : tail) = (x, tail)
polish (PolishPlus : tail) = (x + y, tail'')
where
(x, tail') = polish tail
(y, tail'') = polish tail'
@mrwonko
mrwonko / Main.hs
Last active November 30, 2015 19:15
module Main where
main :: IO ()
main = interact $ \ input ->
let (serializedTree:encodedMessages) = lines input
tree = deserialize serializedTree
messages = map (decode tree) encodedMessages in
unlines messages
data PrefixTree = Leaf Char | Node PrefixTree PrefixTree