This file contains hidden or 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
| 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 |
This file contains hidden or 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
| 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() |
This file contains hidden or 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
| #[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), |
This file contains hidden or 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> | |
| #include <string> | |
| #include <variant> | |
| using A = std::variant<int, std::string>; | |
| template<class... Ts> | |
| struct overloaded : Ts... | |
| { | |
| using Ts::operator()...; |
This file contains hidden or 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
| #[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); |
This file contains hidden or 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
| #[macro_use] | |
| extern crate error_chain; | |
| use std::process::{Command, Stdio}; | |
| use std::env::current_dir; | |
| error_chain! { | |
| foreign_links { | |
| Io(std::io::Error); |
This file contains hidden or 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
| #[macro_use] | |
| extern crate serde_derive; | |
| extern crate serde; | |
| extern crate bincode; | |
| use bincode::{serialize, Infinite}; | |
| #[derive(Serialize, Debug, PartialEq)] | |
| #[repr(C, packed)] |
This file contains hidden or 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
| (mapcar (function (lambda (x) (concat "std::" x))) | |
| (sort '("iota" "cout") 'modern-c++-string-lenght>)) |
This file contains hidden or 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
| (add-to-list 'load-path "~/modern-cpp-font-lock/") | |
| (require 'modern-cpp-font-lock) | |
| (modern-c++-font-lock-global-mode t) |