Will do. Thanks, John
On Wednesday, November 19, 2014 11:45:17 AM UTC-6, John Myles White wrote: > > Hi Frederick, > > You'll want to read a bit more about what invariance means in computer > science: > http://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science) > > In particular, Array{S} <: Array{T} is false for all types S and T with S > != T in Julia. This isn't an inconsistency -- it's an important part of > what makes Julia Julia. > > -- John > > On Nov 19, 2014, at 5:35 PM, Frederick <fpmen...@hotmail.com <javascript:>> > wrote: > > > > Hello, > > While I understand that Strings will be overhauled in 0.4 > <https://groups.google.com/forum/?fromgroups=#!searchin/julia-users/substrings/julia-users/xCB8LeGFYcw/lNpEi3wh2qYJ>, > > I would like help in understanding why the following: > > First there is this inconsistency: > > > In [16]: SubString{ASCIIString} <: String > > Out[16]: true > In [18]: Array{SubString{ASCIIString},1}<:Array{String,1} > > Out[16]: false > > Leading to the following, which didn't work... > In [19]: > > function firstletter(stringarray::Array{String,1}) > [s[1] for s in stringarray] > end > > stringarray = split("ABCDE FGHIJ KLMNO PQRST"," ") > print(typeof(stringarray)) > firstletter(stringarray) > > Array{SubString{ASCIIString},1} > > `firstletter` has no method matching firstletter(::Array{SubString{ > ASCIIString},1}) > while loading In[19], in expression starting on line 7 > > > There is no clear documentation on Substrings, convert operations, nor > what types are subtypes of what other types. (Although I found code to > generate type graph <http://pastebin.com/En28tWjS>, I did not see > SubStrings in the graph.) > > From what I can tell from the postings in this group and others, the > above should work according to Leah in String from a substring Jul 21 > (2014?) > <https://groups.google.com/forum/?fromgroups=#!searchin/julia-users/array$20substring/julia-users/AlIbGTS_15w/0l5Qoh2bjfoJ> > > and Patrick O'Leary | 4 Feb 06:35 2014 in SubString{ASCIIString} causing > issues <http://comments.gmane.org/gmane.comp.lang.julia.devel/13400>. > But it seems something about Arrays causes the difficulty. Jack Holland > encountered a similar problem in Type variables acting differently when > accessed through an array Jun 17 (2014?) > <https://groups.google.com/forum/?fromgroups=#!searchin/julia-users/array$20substring/julia-users/VvVRW9Llc_0/JqcmlmhQgyYJ> > . > > Thanks for the help, Frederick > > >