Suche senden
Hochladen
COSCUP: Metaprogramming in Julia
•
0 gefällt mir
•
384 views
岳華 杜
Folgen
20180811 COSCUP Speaker: Iblis Lin
Weniger lesen
Mehr lesen
Technologie
Melden
Teilen
Melden
Teilen
1 von 52
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
Python元組,字典,集合
Python元組,字典,集合
吳錫修 (ShyiShiou Wu)
Python learn guide
Python learn guide
robin yang
Python串列資料應用
Python串列資料應用
吳錫修 (ShyiShiou Wu)
Python變數與資料運算
Python變數與資料運算
吳錫修 (ShyiShiou Wu)
連淡水阿嬤都聽得懂的機器學習入門 scikit-learn
連淡水阿嬤都聽得懂的機器學習入門 scikit-learn
Cicilia Lee
Python分支作業
Python分支作業
吳錫修 (ShyiShiou Wu)
第01章 绪论(java版)
第01章 绪论(java版)
Yan Li
Python基本資料運算
Python基本資料運算
吳錫修 (ShyiShiou Wu)
Empfohlen
Python元組,字典,集合
Python元組,字典,集合
吳錫修 (ShyiShiou Wu)
Python learn guide
Python learn guide
robin yang
Python串列資料應用
Python串列資料應用
吳錫修 (ShyiShiou Wu)
Python變數與資料運算
Python變數與資料運算
吳錫修 (ShyiShiou Wu)
連淡水阿嬤都聽得懂的機器學習入門 scikit-learn
連淡水阿嬤都聽得懂的機器學習入門 scikit-learn
Cicilia Lee
Python分支作業
Python分支作業
吳錫修 (ShyiShiou Wu)
第01章 绪论(java版)
第01章 绪论(java版)
Yan Li
Python基本資料運算
Python基本資料運算
吳錫修 (ShyiShiou Wu)
Sun java
Sun java
softwaredesigner
Python速成指南
Python速成指南
March Liu
Python程式設計 - 分支作業
Python程式設計 - 分支作業
吳錫修 (ShyiShiou Wu)
手把手打開Python資料分析大門
手把手打開Python資料分析大門
Yen-lung Tsai
Keep your code clean
Keep your code clean
macrochen
Programming python - part 1
Programming python - part 1
Che-Cheng Hsu
Fp
Fp
fangjiafu
Sql培训 (1)
Sql培训 (1)
jhao niu
20161209-Julia Taiwan first meetup-julia語言入門
20161209-Julia Taiwan first meetup-julia語言入門
岳華 杜
Recurrent Neural Network 遞迴式神經網路
Recurrent Neural Network 遞迴式神經網路
Yen-lung Tsai
Arrays的Sort算法分析
Arrays的Sort算法分析
Zianed Hou
lambda/closure – JavaScript、Python、Scala 到 Java SE 7
lambda/closure – JavaScript、Python、Scala 到 Java SE 7
Justin Lin
Python入門:5大概念初心者必備 2021/11/18
Python入門:5大概念初心者必備 2021/11/18
Derek Lee
Python入門:5大概念初心者必備
Python入門:5大概念初心者必備
Derek Lee
Java Collections中的Fail Fast机制
Java Collections中的Fail Fast机制
yiditushe
jQuery源码学习
jQuery源码学习
fangdeng
[系列活動] 手把手打開Python資料分析大門
[系列活動] 手把手打開Python資料分析大門
台灣資料科學年會
Java8 lambda
Java8 lambda
koji lin
Javascript share
Javascript share
Xu Mac
页游开发中的 Python 组件与模式
页游开发中的 Python 组件与模式
勇浩 赖
[COSCUP 2023] 我的Julia軟體架構演進之旅
[COSCUP 2023] 我的Julia軟體架構演進之旅
岳華 杜
Julia: The language for future
Julia: The language for future
岳華 杜
Weitere ähnliche Inhalte
Was ist angesagt?
Sun java
Sun java
softwaredesigner
Python速成指南
Python速成指南
March Liu
Python程式設計 - 分支作業
Python程式設計 - 分支作業
吳錫修 (ShyiShiou Wu)
手把手打開Python資料分析大門
手把手打開Python資料分析大門
Yen-lung Tsai
Keep your code clean
Keep your code clean
macrochen
Programming python - part 1
Programming python - part 1
Che-Cheng Hsu
Fp
Fp
fangjiafu
Sql培训 (1)
Sql培训 (1)
jhao niu
20161209-Julia Taiwan first meetup-julia語言入門
20161209-Julia Taiwan first meetup-julia語言入門
岳華 杜
Recurrent Neural Network 遞迴式神經網路
Recurrent Neural Network 遞迴式神經網路
Yen-lung Tsai
Arrays的Sort算法分析
Arrays的Sort算法分析
Zianed Hou
lambda/closure – JavaScript、Python、Scala 到 Java SE 7
lambda/closure – JavaScript、Python、Scala 到 Java SE 7
Justin Lin
Python入門:5大概念初心者必備 2021/11/18
Python入門:5大概念初心者必備 2021/11/18
Derek Lee
Python入門:5大概念初心者必備
Python入門:5大概念初心者必備
Derek Lee
Java Collections中的Fail Fast机制
Java Collections中的Fail Fast机制
yiditushe
jQuery源码学习
jQuery源码学习
fangdeng
[系列活動] 手把手打開Python資料分析大門
[系列活動] 手把手打開Python資料分析大門
台灣資料科學年會
Java8 lambda
Java8 lambda
koji lin
Javascript share
Javascript share
Xu Mac
页游开发中的 Python 组件与模式
页游开发中的 Python 组件与模式
勇浩 赖
Was ist angesagt?
(20)
Sun java
Sun java
Python速成指南
Python速成指南
Python程式設計 - 分支作業
Python程式設計 - 分支作業
手把手打開Python資料分析大門
手把手打開Python資料分析大門
Keep your code clean
Keep your code clean
Programming python - part 1
Programming python - part 1
Fp
Fp
Sql培训 (1)
Sql培训 (1)
20161209-Julia Taiwan first meetup-julia語言入門
20161209-Julia Taiwan first meetup-julia語言入門
Recurrent Neural Network 遞迴式神經網路
Recurrent Neural Network 遞迴式神經網路
Arrays的Sort算法分析
Arrays的Sort算法分析
lambda/closure – JavaScript、Python、Scala 到 Java SE 7
lambda/closure – JavaScript、Python、Scala 到 Java SE 7
Python入門:5大概念初心者必備 2021/11/18
Python入門:5大概念初心者必備 2021/11/18
Python入門:5大概念初心者必備
Python入門:5大概念初心者必備
Java Collections中的Fail Fast机制
Java Collections中的Fail Fast机制
jQuery源码学习
jQuery源码学习
[系列活動] 手把手打開Python資料分析大門
[系列活動] 手把手打開Python資料分析大門
Java8 lambda
Java8 lambda
Javascript share
Javascript share
页游开发中的 Python 组件与模式
页游开发中的 Python 组件与模式
Mehr von 岳華 杜
[COSCUP 2023] 我的Julia軟體架構演進之旅
[COSCUP 2023] 我的Julia軟體架構演進之旅
岳華 杜
Julia: The language for future
Julia: The language for future
岳華 杜
The Language for future-julia
The Language for future-julia
岳華 杜
20190907 Julia the language for future
20190907 Julia the language for future
岳華 杜
Metaprogramming in julia
Metaprogramming in julia
岳華 杜
Introduction to julia
Introduction to julia
岳華 杜
自然語言處理概覽
自然語言處理概覽
岳華 杜
Introduction to machine learning
Introduction to machine learning
岳華 杜
Semantic Segmentation - Fully Convolutional Networks for Semantic Segmentation
Semantic Segmentation - Fully Convolutional Networks for Semantic Segmentation
岳華 杜
Batch normalization 與他愉快的小伙伴
Batch normalization 與他愉快的小伙伴
岳華 杜
從 VAE 走向深度學習新理論
從 VAE 走向深度學習新理論
岳華 杜
COSCUP: Foreign Function Call in Julia
COSCUP: Foreign Function Call in Julia
岳華 杜
COSCUP: Introduction to Julia
COSCUP: Introduction to Julia
岳華 杜
Introduction to Julia
Introduction to Julia
岳華 杜
20180506 Introduction to machine learning
20180506 Introduction to machine learning
岳華 杜
20171127 當julia遇上資料科學
20171127 當julia遇上資料科學
岳華 杜
20171117 oop and design patterns in julia
20171117 oop and design patterns in julia
岳華 杜
20171014 tips for manipulating filesystem in julia
20171014 tips for manipulating filesystem in julia
岳華 杜
20170807 julia的簡單而高效資料處理
20170807 julia的簡單而高效資料處理
岳華 杜
20170715 北Bio meetup
20170715 北Bio meetup
岳華 杜
Mehr von 岳華 杜
(20)
[COSCUP 2023] 我的Julia軟體架構演進之旅
[COSCUP 2023] 我的Julia軟體架構演進之旅
Julia: The language for future
Julia: The language for future
The Language for future-julia
The Language for future-julia
20190907 Julia the language for future
20190907 Julia the language for future
Metaprogramming in julia
Metaprogramming in julia
Introduction to julia
Introduction to julia
自然語言處理概覽
自然語言處理概覽
Introduction to machine learning
Introduction to machine learning
Semantic Segmentation - Fully Convolutional Networks for Semantic Segmentation
Semantic Segmentation - Fully Convolutional Networks for Semantic Segmentation
Batch normalization 與他愉快的小伙伴
Batch normalization 與他愉快的小伙伴
從 VAE 走向深度學習新理論
從 VAE 走向深度學習新理論
COSCUP: Foreign Function Call in Julia
COSCUP: Foreign Function Call in Julia
COSCUP: Introduction to Julia
COSCUP: Introduction to Julia
Introduction to Julia
Introduction to Julia
20180506 Introduction to machine learning
20180506 Introduction to machine learning
20171127 當julia遇上資料科學
20171127 當julia遇上資料科學
20171117 oop and design patterns in julia
20171117 oop and design patterns in julia
20171014 tips for manipulating filesystem in julia
20171014 tips for manipulating filesystem in julia
20170807 julia的簡單而高效資料處理
20170807 julia的簡單而高效資料處理
20170715 北Bio meetup
20170715 北Bio meetup
COSCUP: Metaprogramming in Julia
1.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Metaprogramming in Julia Iblis
Lin 2018/8/11 Iblis Lin Metaprogramming in Julia
2.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction 粗淺的分類 Text-based e.g. macro in
C Abstract Syntax Tree Level Lisp Julia Iblis Lin Metaprogramming in Julia
3.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction Metaprogramming 把程式本身視為 data
的一種 Iblis Lin Metaprogramming in Julia
4.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction 那麼有 data structure
跟 manipulations Iblis Lin Metaprogramming in Julia
5.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction 那麼有 data structure
跟 manipulations 在 Julia 中有 Expr 這個 type Iblis Lin Metaprogramming in Julia
6.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Construct Expressions julia 0.7/1.0: §
¤ julia> e = Meta.parse("42 + 1") :(42 + 1) ¦ ¥ julia 0.6: § ¤ julia> e = parse("42 + 1") :(42 + 1) ¦ ¥ Iblis Lin Metaprogramming in Julia
7.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Expressions § ¤ julia> typeof(e) Expr ¦
¥ Fields of Expr: head::Symbol args::Array{Any,1} Iblis Lin Metaprogramming in Julia
8.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Expressions § ¤ julia> e.head :call julia>
e.args 3-element Array{Any,1}: :+ 42 1 ¦ ¥ Iblis Lin Metaprogramming in Julia
9.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Expressions 程式已經用 Expr 來表示了,那麼怎麼執行? Iblis
Lin Metaprogramming in Julia
10.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Expressions 程式已經用 Expr 來表示了,那麼怎麼執行? §
¤ julia> e :(42 + 1) julia> eval(e) 43 ¦ ¥ Iblis Lin Metaprogramming in Julia
11.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Expressions is mutable 所以可以各種改。 §
¤ e.args[1] = :- e.args[3] = 50 ¦ ¥ Iblis Lin Metaprogramming in Julia
12.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 其他生出 Expression 的方式 1.
直接 call constructor § ¤ Expr(:call, :+, 2, 3) ¦ ¥ Iblis Lin Metaprogramming in Julia
13.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 其他生出 Expression 的方式 1.
直接 call constructor § ¤ Expr(:call, :+, 2, 3) ¦ ¥ 2. Quoting § ¤ :(1 + 2) ¦ ¥ § ¤ quote 1 + 2 2 + 3 end ¦ ¥ Iblis Lin Metaprogramming in Julia
14.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Printing Expr Instance §
¤ dump(e) ¦ ¥ § ¤ Meta.show_sexpr(e) ¦ ¥ Iblis Lin Metaprogramming in Julia
15.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The Symbol Type Iblis
Lin Metaprogramming in Julia
16.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Symbol Like symbol in
Lisp or atom in Erlang. § ¤ julia> :foo :foo julia> typeof(:foo) Symbol ¦ ¥ Iblis Lin Metaprogramming in Julia
17.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Symbol Like symbol in
Lisp or atom in Erlang. § ¤ julia> :foo :foo julia> typeof(:foo) Symbol ¦ ¥ § ¤ julia> Symbol("bar-1") Symbol("bar-1") ¦ ¥ Iblis Lin Metaprogramming in Julia
18.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Symbol 在 Expr 中的
identifier 會使用 symbol variable name function name ... Iblis Lin Metaprogramming in Julia
19.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Symbol 在 Expr 中的
identifier 會使用 symbol variable name function name ... § ¤ julia> e = :(x = 1) :(x = 1) julia> e.args 2-element Array{Any,1}: :x 1 ¦ ¥ Iblis Lin Metaprogramming in Julia
20.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Interpolation 動態的產生 Expr 的手段之一 Iblis
Lin Metaprogramming in Julia
21.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Interpolation 用 $ 來
reference 外面的變數 長得很像 string interpolation § ¤ julia> x = 42; julia> e = :($x + y) :(42 + y) ¦ ¥ Iblis Lin Metaprogramming in Julia
22.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Splatting Interpolation 可以展開整個 array §
¤ julia> A 3-element Array{Symbol,1}: :x :y :z julia> e = :(f($(A...))) :(f(x, y, z)) ¦ ¥ Iblis Lin Metaprogramming in Julia
23.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Eval and Scope 打開
REPL 後,我在哪裡? Iblis Lin Metaprogramming in Julia
24.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Eval and Scope 打開
REPL 後,我在哪裡? § ¤ julia> @__MODULE__ Main ¦ ¥ Iblis Lin Metaprogramming in Julia
25.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Eval and Scope 打開
REPL 後,我在哪裡? § ¤ julia> @__MODULE__ Main ¦ ¥ § ¤ foo = 1 e = :(foo += 42) eval(e) ¦ ¥ 請問現在 foo 是多少? Iblis Lin Metaprogramming in Julia
26.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Eval and Scope eval
的影響範圍是 module 的 global scope 能夠對 module 的 global scope 有 side effect Iblis Lin Metaprogramming in Julia
27.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Eval and Scope eval
的影響範圍是 module 的 global scope 能夠對 module 的 global scope 有 side effect § ¤ function f() e = :(foo -= 100) eval(e) end foo = 1 f() ¦ ¥ Iblis Lin Metaprogramming in Julia
28.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Eval and Scope 那麼這個呢? §
¤ e = :(bar + 1) eval(e) ¦ ¥ Iblis Lin Metaprogramming in Julia
29.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example 那麼我們現在來實際解決點問題。 Iblis Lin Metaprogramming
in Julia
30.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example 那麼我們現在來實際解決點問題。 現在希望有個 helper function,這個
function 能夠 對任意的新 struct 建立好看的 show function Iblis Lin Metaprogramming in Julia
31.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example § ¤ julia> struct
Bar a::Int b::Bool magic::Any end julia> bar = Bar(1, false, "good") Bar(1, false, "good") julia> make_show(Bar, :magic, :b) julia> bar magic -> good b -> false ¦ ¥ Iblis Lin Metaprogramming in Julia
32.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example § ¤ function make_show(T::DataType,
fields::Symbol...) fields = QuoteNode.(fields) print_exprs = [ :(println(io, "$($f) -> ", getfield(x, $f))) for f in fields] e = :(Base.show(io::IO, x::$T) = $(print_exprs...)) eval(e) end ¦ ¥ Iblis Lin Metaprogramming in Julia
33.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Macro Iblis Lin Metaprogramming
in Julia
34.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Macro Macro 能夠接受參數,而 return
一個 expression, 並且立即執行這個 expression。 Iblis Lin Metaprogramming in Julia
35.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Macro Macro 能夠接受參數,而 return
一個 expression, 並且立即執行這個 expression。 § ¤ julia> macro m() :(println("Hello, Macro")) end @m (macro with 1 method) julia> @m() Hello, Macro ¦ ¥ Iblis Lin Metaprogramming in Julia
36.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Macro 試試看參數 § ¤ julia> macro
m(name) :(println("Hello, ", $name)) end @m (macro with 2 methods) julia> @m("Iblis") Hello, Iblis ¦ ¥ Iblis Lin Metaprogramming in Julia
37.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Macro – Debugging 可以用
@macroexpand 這個 macro 來看看你的 macro 回傳了啥 § ¤ julia> @macroexpand(@m("Iblis")) :((Main.println)("Hello, ", "Iblis")) ¦ ¥ Iblis Lin Metaprogramming in Julia
38.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Macro – Syntax
Sugar 在 call 一個 macro 的時候,可以偷懶不寫括號。 § ¤ julia> @m "Iblis" Hello, Iblis ¦ ¥ 而所有參數用空白切開。 Iblis Lin Metaprogramming in Julia
39.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Macro – Syntax
Sugar 在 call 一個 macro 的時候,可以偷懶不寫括號。 § ¤ julia> @m "Iblis" Hello, Iblis ¦ ¥ 而所有參數用空白切開。 § ¤ julia> @macroexpand @m "Iblis" :((Main.println)("Hello, ", "Iblis")) ¦ ¥ Iblis Lin Metaprogramming in Julia
40.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Macro – Example §
¤ macro make_show(T::Symbol, fields::Symbol...) fields = QuoteNode.(fields) print_exprs = [ :(println(io, "$($f) -> ", getfield(x, $f))) for f in fields] :(Base.show(io::IO, x::$T) = $(print_exprs...)) end ¦ ¥ Iblis Lin Metaprogramming in Julia
41.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Macro – Parse
time and Runtime § ¤ macro m(...) # parse time # ... return :(#= excuted at runtime =#) end ¦ ¥ Iblis Lin Metaprogramming in Julia
42.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Non-Standard String Literals Iblis Lin
Metaprogramming in Julia
43.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Non-Standard String Literals 這個東西就是透過
macro 完成的 e.g. § ¤ julia> VERSION v"1.0.0" julia> v"4.2" v"4.2.0" julia> typeof(v"4.2") VersionNumber ¦ ¥ Iblis Lin Metaprogramming in Julia
44.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Non-Standard String Literals §
¤ julia> using Sockets julia> ip"1.1.1.1" ip"1.1.1.1 ¦ ¥ Iblis Lin Metaprogramming in Julia
45.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Non-Standard String Literals 只要定義
@x_str 即可。 Iblis Lin Metaprogramming in Julia
46.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Non-Standard String Literals 只要定義
@x_str 即可。 § ¤ macro foo_str(s) :(reverse($s)) end ¦ ¥ Iblis Lin Metaprogramming in Julia
47.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Non-Standard String Literals 只要定義
@x_str 即可。 § ¤ macro foo_str(s) :(reverse($s)) end ¦ ¥ § ¤ julia> foo"abc" "cba" ¦ ¥ Iblis Lin Metaprogramming in Julia
48.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Generated Functions Iblis Lin
Metaprogramming in Julia
49.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Generated Functions 當我們需要根據 Type
資訊,動態產生出不同的 function body,那麼就使用 generated functions。 Iblis Lin Metaprogramming in Julia
50.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Generated Functions 對於已經看過的 input
type 組合,generated functions 的 function body 會 cache 起來,下次直 接使用。 Iblis Lin Metaprogramming in Julia
51.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Generated Functions § ¤ @generated
function bar(x) if x <: Integer :(x ˆ 2) else :(x) end end ¦ ¥ Iblis Lin Metaprogramming in Julia
52.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Q & A Iblis
Lin Metaprogramming in Julia
Jetzt herunterladen