KeywordDispatch.jl:派遣关键字参数

时间:2021-05-28 16:26:01
【文件属性】:
文件名称:KeywordDispatch.jl:派遣关键字参数
文件大小:8KB
文件格式:ZIP
更新时间:2021-05-28 16:26:01
Julia 关键字Dispatch.jl 派遣关键字参数。 它导出2个宏: @kwdispatch指定要用于关键字分派的函数签名 @kwmethod定义关键字参数的方法 例子 using KeywordDispatch @kwdispatch f () @kwmethod f (;a) = " a is $a " @kwmethod f (;a :: Integer ) = " a is $a , and is an Integer " @kwmethod f (;b) = " b is $b " @kwmethod f (;a,b) = " a is $a , b is $b " @kwmethod f (;) = " look mum, no args! " 在REPL: julia> f() "look mum, no args!" julia> f(a=1.0) "a is 1.0
【文件预览】:
KeywordDispatch.jl-master
----Project.toml(244B)
----.github()
--------workflows()
----test()
--------runtests.jl(7KB)
----src()
--------KeywordDispatch.jl(8KB)
----LICENSE.md(1KB)
----.gitignore(14B)
----README.md(965B)

网友评论