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
| """ | |
| modules that provides convenient pointer operations. | |
| ```julia | |
| struct C | |
| a :: Cint | |
| end | |
| struct A | |
| a :: Cint | |
| b :: Cdouble |
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
| 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 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
| Weekly development breakdown |
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
| 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 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
| module type TNT = sig | |
| type 'a typed_name | |
| val inj : string -> 'a typed_name | |
| val prj : 'a typed_name -> string | |
| end | |
| module TN : TNT = struct | |
| type 'a typed_name = string | |
| let inj = fun x -> x | |
| let prj = fun x -> x |
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
| 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 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
| using MLStyle | |
| using Libdl | |
| struct DLL | |
| path :: String | |
| handle::Ptr{Nothing} | |
| end | |
| function DLL(path::String) | |
| handle = dlopen_e(path) |
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
| _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 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
| 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 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
| function sort_type(ts :: Vector{Type}) | |
| n = length(ts) | |
| if n == 1 | |
| ts | |
| elseif n == 2 | |
| a, b = ts[1], ts[2] | |
| if a <: b | |
| [a, b] | |
| elseif b <: a | |
| [b, a] |