How do I build a constructor with fewer inputs than values? I have an Int64 
array of numbers where each number represents 24 boolean values. The best 
situation would be that I could send in the array and get back a composite 
type with arrays of each component. Here is the code I've tried.

type Status Valve1::Array{Bool}
   Valve2::Array{Bool}
   Valve3::Array{Bool}
   Valve4::Array{Bool}
   Valve5::Array{Bool}
   Valve6::Array{Bool}
   Valve7::Array{Bool}
   Valve8::Array{Bool}
 
   # Constructor for Status type
   function Status(vals::Array{Int64})
   l = int64(length(vals))
 
   Valve1 = Array(Bool,l)
   Valve2 = Array(Bool,l)
   Valve3 = Array(Bool,l)
   Valve4 = Array(Bool,l)
   Valve5 = Array(Bool,l)
   Valve6 = Array(Bool,l)
   Valve7 = Array(Bool,l)
   Valve8 = Array(Bool,l)
 
   # Parse Inputs
   for i=1:l
      # Byte 1
      Valve1[i] = vals[i] & 2^(1-1) > 0
      Valve2[i] = vals[i] & 2^(2-1) > 0
      Valve3[i] = vals[i] & 2^(3-1) > 0
      Valve4[i] = vals[i] & 2^(4-1) > 0
      Valve5[i] = vals[i] & 2^(5-1) > 0
      Valve6[i] = vals[i] & 2^(6-1) > 0
      Valve7[i] = vals[i] & 2^(7-1) > 0
      Valve8[i] = vals[i] & 2^(8-1) > 0
   end # End of conversion
 

   new(Valve1,Valve2,Valve3,Valve4,Valve5,Valve6,Valve7,Valve8)
 

   end # End of constructor
end # End of type


no method convert(Type{Bool},Array{Bool,1})


Reply via email to