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
struct AString | |
buf::Vector{Char} | |
end | |
function convert(::Type{AString}, str::String) | |
n = ncodeunits(str) | |
buf = Char[] | |
i = 1 | |
while i <= n | |
chr = str[i]::Char |
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
_isinstance = isinstance | |
def test_mm(data): | |
isinstance = _isinstance | |
# +pattern-matching | |
for d in data: | |
with match(d): | |
if [a, isinstance(str) and b, c]: | |
"%s(%s)%s" % (a, b, c) | |
if (isinstance(str) and s, isinstance(int) and i): | |
s * i |
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
using MLStyle | |
using Libdl | |
struct DLL | |
path :: String | |
handle::Ptr{Nothing} | |
end | |
function DLL(path::String) | |
handle = dlopen_e(path) |
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
using MLStyle | |
import Base | |
@data Nat begin | |
Z() | |
S{N <: Nat} :: () => Nat | |
end | |
StoInt(s::Type{Z}) = 0 | |
StoInt(s::Type{S{N}}) where N = StoInt(N) + 1 |
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
type _ df = | |
| EmptyDF : unit df | |
| JoinDF : 'a array * 'b df -> ('a * 'b) df | |
type (_, _) index = | |
| TOS : ('e * 'o, 'e) index | |
| NEXT : ('o, 'e) index -> ('tos * 'o, 'e) index | |
let rec get : type a e. (a, e) index -> a df -> e array = | |
fun ind df -> |
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
Weekly development breakdown |
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
export PYTHONIOENCODING=utf8 | |
PROMPT_COMMAND="prompt-command" | |
# cache init | |
source activate base | |
if [[ -z "$my_pragma_once" ]]; then | |
export PATH="$HOME/.local/bin:$PATH" | |
source ~/.bashfiles/color.sh | |
source "$(scoop prefix git)\etc\profile.d\git-prompt.sh" | |
source /usr/share/bash-completion/bash_completion |
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
""" | |
modules that provides convenient pointer operations. | |
```julia | |
struct C | |
a :: Cint | |
end | |
struct A | |
a :: Cint | |
b :: Cdouble |
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
[[293, 346], [293, 343], [288, 339], [276, 351], [293, 346]] (0, 20, 28) | |
[[353, 342], [347, 329], [346, 328], [341, 330], [339, 331], [344, 340], [353, 342]] (0, 20, 28) | |
[[354, 327], [350, 327], [347, 329], [353, 342], [354, 342], [359, 342], [359, 330], [354, 327]] (0, 20, 28) | |
[[381, 341], [366, 324], [364, 325], [360, 327], [359, 330], [359, 342], [365, 344], [381, 341]] (0, 20, 28) | |
[[381, 341], [385, 341], [371, 321], [370, 321], [367, 324], [366, 324], [381, 341]] (0, 20, 28) | |
[[405, 315], [400, 312], [392, 316], [388, 321], [392, 341], [411, 350], [405, 315]] (0, 20, 28) | |
[[313, 314], [316, 311], [312, 308], [308, 311], [309, 313], [310, 314], [313, 314]] (0, 20, 28) | |
[[320, 307], [314, 302], [312, 305], [312, 308], [316, 311], [317, 311], [320, 309], [320, 307]] (0, 20, 28) | |
[[312, 305], [308, 304], [304, 307], [304, 307], [305, 309], [308, 311], [312, 308], [312, 305]] (0, 20, 28) | |
[[395, 310], [394, 310], [392, 316], [400, 312], [399, 311], [395, 310]] (0, 20, 28) |
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
from wisepy2 import wise | |
def main(filename: str): | |
"""return a pair: | |
- non-empty character count | |
- non-empty line count | |
""" | |
l = 0 | |
c = 0 | |
for line in open(filename, 'r', encoding='utf8'): |