Julia 中的“符號”是什麼? - What is a "symbol" in Julia?


Specifically: I am trying to use Julia's DataFrames package, specifically the readtable() function with the names option, but that requires a vector of symbols.具體來說:我正在嘗試使用 Julia 的 DataFrames 包,特別是帶有名稱選項的 readtable() 函數,但這需要一個符號向量。

  • what is a symbol?什麼是符號?
  • why would they choose that over a vector of strings?爲什麼他們會選擇它而不是字符串向量?

So far I have found only a handful of references to the word symbol in the Julia language.到目前爲止,我在 Julia 語言中只發現了少數對單詞符號的引用。 It seems that symbols are represented by ":var", but it is far from clear to me what they are.似乎符號由“:var”表示,但我不清楚它們是什麼。

Aside: I can run旁白:我可以跑

df = readtable( "table.txt", names = [symbol("var1"), symbol("var2")] )

My two bulleted questions still stand.我的兩個項目符號問題仍然有效。


參考一: https://en.stackoom.com/question/1aWPK
參考二: https://stackoom.com/question/1aWPK
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.