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 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 >> >>