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
#include <cassert> | |
#include <iostream> | |
template<typename T, typename R=void> | |
struct ExtMethod { | |
ExtMethod& operator - () { | |
return *this; | |
} | |
template<typename U> |
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
# Downloaded from: https://gist.github.com/eksperimental/55f1e207ab5878a668668546f57a3f90 | |
# | |
# Lists all the types that have the problem reported in | |
# https://github.com/elixir-lang/elixir/issues/10140 | |
# create an Elixir project, and save this file in lib/typespec_example.ex | |
# Start IEx with: iex -S mix | |
# then run: TypespecExample.types() | |
# and paste the output into the shell. | |
defmodule TypespecExample 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
{:beam_file, Addition, | |
[ | |
{:__info__, 1, 2}, | |
{:"__type_check_spec_for_add/2__", 0, 18}, | |
{:add, 2, 8}, | |
{:baseline_add, 2, 16}, | |
{:module_info, 0, 20}, | |
{:module_info, 1, 22} | |
], [vsn: [337339698024769425821845159222917769638]], | |
[ |
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
{-# LANGUAGE QuasiQuotes, TemplateHaskell, ScopedTypeVariables #-} | |
module BakedVector where | |
import qualified Data.ByteString.Lazy as BSL | |
import Data.ByteString.Lazy (unpack) | |
import Data.ByteString.Builder (toLazyByteString) | |
import Data.ByteString.Builder.Prim | |
import Foreign.Storable | |
import qualified Data.Vector.Storable as VS |
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
{-# LANGUAGE StaticPointers #-} | |
{-# LANGUAGE InstanceSigs #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
import Data.Binary | |
import System.IO.Unsafe | |
import GHC.StaticPtr |
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
*> Compile using GNU Cobol, e.g.: `cobc -x gcd_maxmin.cob` | |
IDENTIFICATION DIVISION. | |
PROGRAM-ID. gcd-maxmin. | |
ENVIRONMENT DIVISION. | |
DATA DIVISION. | |
WORKING-STORAGE SECTION. | |
01 NUMS. | |
05 NUMS-ELEMS PIC 9(9) | |
OCCURS 0 TO 9999 TIMES DEPENDING ON NUMS-LEN. | |
77 NUMS-IDX PIC 9(9) COMP. |
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
defmodule Capturepipe do | |
@doc """ | |
A pipe-operator that extends the normal pipe | |
in one tiny way: | |
It allows the syntax of having a bare `&1` capture | |
to exist inside a datastructure as one of the pipe results. | |
This is useful to insert the pipe's results into a datastructure | |
such as a tuple. |
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
# Example of how to integrate doctests with Ruby Minitest | |
# | |
# Besides depending on `minitest`, | |
# this functionality depends on the `doctest-core` gem, c.f. https://www.rubydoc.info/gems/doctest-core/ | |
class YourAppName::TestCase < MiniTest::Test | |
# To be used inside the body of a tests-class | |
# It will automatically create test cases for all | |
# 'documentation test' snippets that exist in the comments |
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
defmodule Decode do | |
@moduledoc """ | |
Extracted from https://github.com/ewildgoose/elixir-float_pp | |
""" | |
use Bitwise | |
@float_bias 1022 | |
############################################################################ |
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
Mix.install([ | |
:benchee, | |
{:okasaki, "~> 1.0"}, # <- used by Qqwy's Okasaki solution | |
:nx, # <- used by Qqwy's Nx solution | |
{:exla, "~> 0.5"}, # <- used by Qqwy's Nx solution | |
], | |
config: [nx: [default_backend: EXLA.Backend]] # <- used by Qqwy's Nx solution | |
) | |
inputs = %{ |