Thank you! :)
Isaiah於 2014年11月4日星期二UTC+8上午11時16分20秒寫道: > > I guess, a function has one name and many defs(definition?). And Julia >> will do dispatch base on the "sig". > > > Correct. See the Functions and Methods sections of the manual. Beyond > that, for a nice overview of multiple dispatch (and some consequences), see: > > http://nbviewer.ipython.org/gist/StefanKarpinski/b8fe9dbb36c1427b9f22 > > For some lower-level details, I would suggest to start with Jeff's talk > from JuliaCon: > > > https://www.youtube.com/watch?v=osdeT-tWjzk&list=PLP8iPy9hna6TSRouJfvobfxkZFYiPSvPd&index=10 > > (some other videos linked here: http://julialang.org/learning/) > > > > > On Mon, Nov 3, 2014 at 6:59 PM, <[email protected] <javascript:>> wrote: > >> They seem have similar "code". >> >> eg: >> >> function fun(x::Int) >> x >> end >> >> function fun(x) >> x >> end >> >> fun.env.defs.func.code >> >> AST(:($(Expr(:lambda, {:x}, {{},{{:x,:Any,0}},{}}, :(begin >> return >> end))))) >> >> func2 = (x) -> x >> func2.code >> >> AST(:($(Expr(:lambda, {:(x::Any)}, {{},{{:x,:Any,0}},{}}, :(begin # >> none, line 1: >> return x >> end))))) >> >> And function has sig(signature?) >> >> fun.env.defs.sig >> (Any,) >> >> I guess, a function has one name and many defs(definition?). And Julia >> will do dispatch base on the "sig". >> >> Is it right? Please correct me, if I made any mistakes. Please tell me >> more about Julia function! >> >> But how Julia do dispatch base on the "sig"? Where is the "function" code >> in Julia source code? >> >> >
