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
import argparse, json | |
parser = argparse.ArgumentParser(description='take a json as param') | |
parser.add_argument('json', metavar='N', type=str, nargs='?', | |
help='some json') | |
args = parser.parse_args() | |
print (json.loads(args.json)) |
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 Main exposing (..) | |
import Browser | |
import Html exposing (text, div, button, Html) | |
import Html.Events exposing (onClick) | |
import Http exposing (get) | |
import Image exposing (Image) | |
type alias Model = String |
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
fn main() { | |
println!("Hello, world!"); | |
} | |
fn process(input: &str) -> Vec<Vec<String>> { | |
input.split("\n") | |
.map(|line| line.split(',')) | |
.map(|fields| fields.map(|field| field.to_string())) | |
.map(|fields| fields.collect::<Vec<_>>()) | |
.collect::<Vec<_>>() |
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
use std::io::{self, BufRead}; | |
fn main() { | |
let stdin = io::stdin(); | |
let problem = stdin.lock().lines().map(|x| x.unwrap()).collect::<Vec<String>>(); | |
let result = solve_problem(&problem[0][..], &problem[1][..]); | |
println!("{}", result); | |
} | |
fn solve_problem(start_line: &str, target_line: &str) -> i32 { |
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
use std::io::{self, BufRead}; | |
fn main() { | |
let stdin = io::stdin(); | |
let problem = stdin.lock().lines().map(|x| x.unwrap()).collect::<Vec<String>>(); | |
let result = solve_problem(&problem[0][..], &problem[1][..], &one_then_zeros()[..]); | |
println!("{}", result); | |
} | |
fn solve_problem(start_line: &str, target_line: &str, modification_requirement :&str) -> i32 { |
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
use std::io::{self, BufRead}; | |
macro_rules! parse_input { | |
($x:expr, $t:ident) => ($x.trim().parse::<$t>().unwrap()) | |
} | |
fn main() { | |
let stdin = io::stdin(); | |
let problem = stdin.lock().lines().map(|x| x.unwrap()).collect::<Vec<String>>(); | |
let mut result = Vec::new(); |
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
use std::io::{self, BufRead}; | |
fn main() { | |
let stdin = io::stdin(); | |
let problem = stdin.lock().lines().map(|x| x.unwrap()).collect::<Vec<String>>(); | |
let result = solve_problem(&problem[0][..], &problem[1][..]); | |
println!("{}", result); | |
} | |
fn solve_problem(start_line: &str, target_line: &str) -> i32 { |
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
import Test.Hspec | |
import Data.Function ((&)) | |
main :: IO () | |
main = hspec $ do | |
describe "the car insurance" $ do | |
it "new drivers pay their full premium" $ do | |
premium NewDriver `shouldBe` 100 | |
it "drivers get 5% rebate after 1 year" $ do |
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 Lib | |
( Program | |
, Cursor | |
, eval | |
, (|+|) | |
, at, writeIn | |
, Value(..) | |
) where | |
import Control.Monad (liftM2) |
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
Coeffect :: { Coeffect } | |
: INT { let TokenInt _ x = $1 in CNat x } | |
| '∞' { infinity } | |
| FLOAT { let TokenFloat _ x = $1 in CFloat $ myReadFloat x } | |
| CONSTR { case (constrString $1) of | |
"Public" -> Level publicRepresentation | |
"Private" -> Level privateRepresentation | |
"Unused" -> Level unusedRepresentation | |
"Inf" -> infinity |
NewerOlder