Some tips:
- USE DEFERRED SPECS
TODO:
// definitions | |
typealias RequestOptions = (HTTPMethod, Set<HeaderOption>, String, String, Encodable?) | |
protocol RequestOptionsConvertible { | |
func asRequestOptions() throws -> RequestOptions | |
} | |
// "rigging" | |
enum PaymentMappings: RequestOptionsConvertible { | |
case .listAvailablePaymentMethods(PaymentMethodsRequest) |
let mergeStrings a b c = // string -> (string -> (string -> string)) | |
a + b + c | |
let test = mergeStrings "foo" "bar" | |
printfn "%A" (test "kalle") | |
printfn "%A" ("foo", 2) | |
//[<CLIMutable>] | |
type Dep = { | |
getIt : string -> string | |
kind : string |
# call this before the code under inspection | |
defp clock_start(x) do | |
now = :erlang.timestamp() | |
Process.put(:"$clock_start", now) | |
Process.put(:"$clock_step_start", now) | |
Process.put(:"$clock_steps", []) | |
x | |
end |
defmodule RLE do | |
defp run_length_encode(terms, encoding) do | |
terms = Enum.map(terms, &encoding[&1]) | |
Enum.reduce(tl(terms), [{hd(terms), 1}], fn | |
c, [{c, count} | rest] -> [{c, count + 1} | rest] | |
c, [{c_prime, count} | rest] -> [{c, 1}, {c_prime, count} | rest] | |
end) | |
|> Enum.map(fn {c, count} -> "#{c}#{inspect(count)}" end) | |
|> Enum.reverse() |
# works, yay \o/ | |
a1 = {<<1::1>>, <<0::1>>} | |
a2 = {"", ""} | |
reducer = fn {bw, accent}, {bw_acc, accent_acc} -> {{<<bw_acc::bitstring, bw::bits-1>>}, {<<accent_acc::bitstring, accent::bits-1>>}} end | |
reducer.(a1, a2) |
defmodule TftRpi3.MixProject do | |
use Mix.Project | |
@app :tft_rpi3 | |
@version Path.join(__DIR__, "VERSION") | |
|> File.read!() | |
|> String.trim() | |
def project do | |
[ |
defmodule SpecCheck do | |
defmodule MockInteractionException do | |
@moduledoc """ | |
A structured representation of one of: | |
- unmet expectation | |
- missing interactions | |
- unexpected interactions | |
""" | |
defexception message: "Interaction with mock did not match expectation.", | |
description: nil, |
"Functions as named case-expressions"
defp derive_chunk_fallback(chunk_tag, chunk_type) do
case {chunk_tag, chunk_type} do
{"", :start} ->
:missing
{"", :append} ->
:no_chunk