On Thu, Jul 9, 2015 at 10:59 AM, andrew cooke <and...@acooke.org> wrote: > > ah! thank-you. i had no idea about that. > > is there any kind of isbits container? will a tuple work?
The type system uses === to compare the parameters (and it has to be this way since it should be simple) so having a reference to a mutable should never work. If you want an array of `isbits` as parameter, an tuple of it should work on 0.4 Another way to see why a vector should never work is that e.g. you have a = [1, 2] T1 = A{a} push!(a, 3) T2 = A{an} T3 = A{[1, 2]} T4 = A{[1, 2]} Should any of the T*'s be equal? > > thanks again, > > andrew > > > On Thursday, 9 July 2015 11:56:45 UTC-3, Yichao Yu wrote: >> >> On Thu, Jul 9, 2015 at 10:52 AM, andrew cooke <and...@acooke.org> wrote: >> > I want to do what I wrote, I think! In particular, the type parameter >> > is >> > itself a value, the polynomial x. It's immutable and a subclass of >> > Integer. >> > So I have no idea why the code should not work. >> >> It's not `isbits` though. >> >> > >> > It's unusual to have a complex value like that in a type, I know, but it >> > makes logical sense here - it's the type of values in the quotient ring >> > with >> > that ideal. >> > >> > Andrew >> > >> > >> > >> > On Thursday, 9 July 2015 11:44:42 UTC-3, Tom Breloff wrote: >> >> >> >> I'm not 100% sure I understand what you want, but here's a stab for >> >> line >> >> 16: >> >> >> >> ZField{T1.parameters[1],T2}(x) >> >> >> >> >> >> On Thursday, July 9, 2015 at 10:32:28 AM UTC-4, andrew cooke wrote: >> >>> >> >>> >> >>> Before I raise an issue I wondered if I've made some stupid mistake >> >>> here. >> >>> The code is about as simple as I can make it. The idea behind things >> >>> is >> >>> that you have a field of integers module 2 (GF2). Then over that you >> >>> define >> >>> polynomials. And then you can define a Quotient Ring with the >> >>> polynomials, >> >>> which is analogous to the initial field, and so you can use the same >> >>> type as >> >>> the rogiinal field. But you don't need to understand that! >> >>> >> >>> Here's the code: >> >>> >> >>> immutable ZField{N, I<:Integer} <: Integer >> >>> i::I >> >>> end >> >>> >> >>> immutable ZPoly{I<:Integer} <: Integer >> >>> a::Vector{I} >> >>> end >> >>> >> >>> T1 = ZField{2,Int} >> >>> o = T1(1) >> >>> >> >>> T2 = ZPoly{T1} >> >>> x = T2([o, o]) >> >>> >> >>> ZField{x,T2}(x) >> >>> >> >>> And this is the error (from the last line, which is line 16) >> >>> >> >>> andrew@laptop:~> julia-trunk IntModN.jl >> >>> ERROR: LoadError: TypeError: apply_type: in ZField, expected Int64, >> >>> got >> >>> ZPoly{ZField{2,Int64}} >> >>> in include at ./boot.jl:254 >> >>> in include_from_node1 at loading.jl:133 >> >>> in process_options at ./client.jl:305 >> >>> in _start at ./client.jl:405 >> >>> while loading /home/andrew/IntModN.jl, in expression starting on line >> >>> 16 >> >>> >> >>> In short - I have no idea where the Int64 comes from. >> >>> >> >>> Thanks, >> >>> Andrew >> >>> >> >