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 Tokenize | |
| import Tokenize.Lexers:peekchar, readchar, is_identifier_char, accept_batch, eof | |
| import Tokenize.Tokens: FUNCTION, ABSTRACT, IDENTIFIER, BAREMODULE, BEGIN, BITSTYPE, BREAK, CATCH, CONST, CONTINUE, DO, ELSE, ELSEIF, END, EXPORT, FALSE, FINALLY, FOR, FUNCTION, GLOBAL, LET, LOCAL, IF, IMMUTABLE, IMPORT, IMPORTALL, MACRO, MODULE, QUOTE, RETURN, TRUE, TRY, TYPE, TYPEALIAS, USING, WHILE | |
| function tryread(l, str, k, start_loc) | |
| for s in str | |
| c = readchar(l) | |
| if c!=s |
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 Distributions, KernelDensity, QuadGK | |
| function gini(x) | |
| n = length(x) | |
| xx = sort(x) | |
| 2*(sum(collect(1:n).*xx))/(n*sum(xx))-1 | |
| end | |
| gini(d::Exponential) = 0.5 | |
| gini(d::Beta) = (2/d.α)*beta(d.α+d.β, d.α+d.β)/(beta(d.α,d.α)*beta(d.β, d.β)) |
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
| import LanguageServer: get_docs, Location | |
| import Base.REPLCompletions: get_value | |
| function modnames(m::AbstractString, top) | |
| s = Symbol(m) | |
| eval(:(using $s)) | |
| M, exists = get_value(s, Main) | |
| if !(s in keys(top)) | |
| modnames(M, top) |
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
| ns = Expr(:module, true, :Namespace, Expr(:block)) | |
| meth = Expr(:type, true, :Meth, Expr(:block, :parameters, :(file::AbstractString), :(line::Int))) | |
| func = Expr(:type, true, :Func, Expr(:block, :(methods::Vector{Meth}))) | |
| push!(ns.args[3].args, Expr(:type, true, :Meth, Expr(:block, :parameters, :(file::AbstractString), :(line::Int)))) | |
| push!(ns.args[3].args, Expr(:type, true, :Func, Expr(:block, :(methods::Vector{Meth})))) | |
| M = Core | |
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 LanguageServer | |
| import LanguageServer: Location, URIParser | |
| import LanguageServer: get_docs, get_sym | |
| const basenames = Symbol.(Base.REPLCompletions.completions("Base.",5)[1]) | |
| function cachemodule(modulename::AbstractString) | |
| mdir = Pkg.dir(modulename) | |
| !Base.isdir(mdir) && error("Module `$modulename` is not installed") | |
| jlfiles = filter!(f->ismatch(r".jl$", f), readdir(joinpath(mdir,"src"))) |
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
| # Structure | |
| # client sends : message::String | |
| # JSON.parse() : message::String -> message_json::Dict | |
| # Request() : message_json::Dict -> req::Request{method,parametertype} | |
| # Respond{m,pt}() : req::Request{m,pt} -> resp::Response{m,returntype} | |
| # JSON.json() : resp::Response{m,returntype} -> retmessage::String | |
| # return : retmessage::String | |
| # A whole load of these for all parameter structures listed in the language-server protocol |
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
| #G.n::Int64 | |
| #G.d::Int64 | |
| #G.q::Int64 | |
| #G.grid::Array{Float64,G.n,G.d} | |
| #G.lvl_s::Array{Float64,G.n,G.d} | |
| #G.lvl_l::Array{Float64,G.q+1} indices partitioning 1:G.n | |
| function basis_func(x::Float64,xij::Float64,mi::Float64) :inline | |
| if (mi==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
| #G.n::Int64 | |
| #G.d::Int64 | |
| #G.q::Int64 | |
| #G.grid::Array{Float64,G.n,G.d} | |
| #G.lvl_s::Array{Float64,G.n,G.d} | |
| #G.lvl_l::Array{Float64,G.q+1} indices partitioning 1:G.n | |
| using Sparse |
NewerOlder