Skip to content

Instantly share code, notes, and snippets.

namespace Test
type Ternary<'S, 'U, 'Err> =
| Success of 'S
| Undecidable of 'U
| Failure of 'Err
module Ternary =
let map fs fu ff t =
match t with
fn main() {
let data = ["1", "2", "3"]
.into_iter()
.map(|x| x.parse())
.collect::<Result<Vec<u32>, _>>();
println!("{:?}", data);
let data = ["1", "2", "3"]
.into_iter()
#[derive(Debug)]
enum A {
Integer(u32),
Text(String),
}
fn double_it(a: A) -> A {
match a {
A::Integer(i) => A::Integer(i + i),
A::Text(t) => A::Text(t.clone() + &t),
#include <iostream>
#include <string>
#include <variant>
using A = std::variant<int, std::string>;
template<class... Ts>
struct overloaded : Ts...
{
using Ts::operator()...;
#[macro_use]
extern crate error_chain;
use std::env::current_dir;
use std::ffi::OsStr;
use std::process::{Child, Command, Stdio};
error_chain! {
foreign_links {
Io(std::io::Error);
#[macro_use]
extern crate error_chain;
use std::process::{Command, Stdio};
use std::env::current_dir;
error_chain! {
foreign_links {
Io(std::io::Error);
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate bincode;
use bincode::{serialize, Infinite};
#[derive(Serialize, Debug, PartialEq)]
#[repr(C, packed)]
(mapcar (function (lambda (x) (concat "std::" x)))
(sort '("iota" "cout") 'modern-c++-string-lenght>))
(add-to-list 'load-path "~/modern-cpp-font-lock/")
(require 'modern-cpp-font-lock)
(modern-c++-font-lock-global-mode t)