API Reference
Calling functions and procedures
MagmaCall.magcall
— Functionmagcall(Val(C), f, args...; opts...)
Call the Magma function f
with the given arguments and keyword options according to calling convention C
.
If f
is a Symbol
, then it is interpreted as the name of a Magma intrinsic.
C
may be:
:p
:f
is a procedure andnothing
is returned. Note that iff
is actually a function, its return value will be printed.:f
:f
is a function and its first return value is returned.:fN
:f
is a function and its firstN
return values are returned as a tuple.:b
:f
is a function returning a boolean, which is returned as aBool
.:i
:f
is a function returning an integer, which is returned as anInt
.:g
:f
is a function returning a structureS
.args[1]
is a tuple of generator names, which are applied toS
. Returns a tuple ofS
and generator names.:pN
: Same as:p
(procedure) but theN
th argument is passed by reference.
Equivalently, you can call magcallC(f, args...; opts...)
or magC.f(args...; opts...)
.
MagmaCall.magcallp
— Functionmagcallp(f, args...; opts...)
Call the Magma procedure f
with the given arguments and keyword options.
Equivalent to magcall(Val(:p), f, args...; opts...)
.
MagmaCall.magcallf
— Functionmagcallf(f, args...; opts...)
Call the Magma function f
with the given arguments and keyword options. Return the first return value.
Equivalent to magcall(Val(:f), f, args...; opts...)
.
MagmaCall.magcallf2
— Functionmagcallf2(f, args...; opts...)
Call the Magma function f
with the given arguments and keyword options. Return the first two return values.
Equivalent to magcall(Val(:f2), f, args...; opts...)
.
MagmaCall.magcallf3
— Functionmagcallf3(f, args...; opts...)
Call the Magma function f
with the given arguments and keyword options. Return the first three return values.
Equivalent to magcall(Val(:f3), f, args...; opts...)
.
MagmaCall.magcallf4
— Functionmagcallf4(f, args...; opts...)
Call the Magma function f
with the given arguments and keyword options. Return the first four return values.
Equivalent to magcall(Val(:f4), f, args...; opts...)
.
MagmaCall.magcallf5
— Functionmagcallf5(f, args...; opts...)
Call the Magma function f
with the given arguments and keyword options. Return the first five return values.
Equivalent to magcall(Val(:f5), f, args...; opts...)
.
MagmaCall.magcallf6
— Functionmagcallf6(f, args...; opts...)
Call the Magma function f
with the given arguments and keyword options. Return the first six return values.
Equivalent to magcall(Val(:f6), f, args...; opts...)
.
MagmaCall.magcallf7
— Functionmagcallf7(f, args...; opts...)
Call the Magma function f
with the given arguments and keyword options. Return the first seven return values.
Equivalent to magcall(Val(:f7), f, args...; opts...)
.
MagmaCall.magcallf8
— Functionmagcallf8(f, args...; opts...)
Call the Magma function f
with the given arguments and keyword options. Return the first eight return values.
Equivalent to magcall(Val(:f8), f, args...; opts...)
.
MagmaCall.magcalli
— Functionmagcalli(f, args...; opts...)
Call the Magma function f
with the given arguments and keyword options. It must return an integer, which is returned as an Int
.
Equivalent to magcall(Val(:i), f, args...; opts...)
.
MagmaCall.magcallb
— Functionmagcallb(f, args...; opts...)
Call the Magma function f
with the given arguments and keyword options. It must return a boolean, which is returned as a Bool
.
Equivalent to magcall(Val(:b), f, args...; opts...)
.
MagmaCall.magcallp1
— Functionmagcallp1(f, args...; opts...)
Call the Magma procedure f
with the given arguments and keyword options, passing the first argument by reference.
Equivalent to magcallp1(Val(:p1), args...; opts...)
.
MagmaCall.magcallp2
— Functionmagcallp2(f, args...; opts...)
Call the Magma procedure f
with the given arguments and keyword options, passing the second argument by reference.
Equivalent to magcallp2(Val(:p2), args...; opts...)
.
MagmaCall.magcallp3
— Functionmagcallp3(f, args...; opts...)
Call the Magma procedure f
with the given arguments and keyword options, passing the third argument by reference.
Equivalent to magcallp3(Val(:p3), args...; opts...)
.
MagmaCall.magcallp4
— Functionmagcallp4(f, args...; opts...)
Call the Magma procedure f
with the given arguments and keyword options, passing the fourth argument by reference.
Equivalent to magcallp4(Val(:p4), args...; opts...)
.
MagmaCall.magcallg
— Functionmagcallg(f, names, args...; opts...)
Call the Magma function f
with the given arguments and keyword options. Assign the given names
to the result. Return a tuple of the result and the generators.
Equivalent to magcall(Val(:g), f, names, args...; opts...)
.
MagmaCall.magcallm
— Functionmagcallm(f, args...; opts...)
Call the Magma function f
with the given arguments and keyword options. If the first return value is true, return the second return value, else return nothing
.
Equivalent to magcall(Val(:m), args...; opts...)
.
Binary operators
MagmaCall.magadd
— Functionmagadd(x, y)
Equivalent to x + y
in Magma.
MagmaCall.magsub
— Functionmagsub(x, y)
Equivalent to x - y
in Magma.
MagmaCall.magmul
— Functionmagmul(x, y)
Equivalent to x * y
in Magma.
MagmaCall.magtruediv
— Functionmagtruediv(x, y)
Equivalent to x / y
in Magma.
MagmaCall.magpow
— Functionmagpow(x, y)
Equivalent to x ^ y
in Magma.
MagmaCall.magdiff
— Functionmagdiff(x, y)
Equivalent to x diff y
in Magma.
MagmaCall.magdiv
— Functionmagdiv(x, y)
Equivalent to x div y
in Magma.
MagmaCall.magjoin
— Functionmagjoin(x, y)
Equivalent to x join y
in Magma.
MagmaCall.magmeet
— Functionmagmeet(x, y)
Equivalent to x meet y
in Magma.
MagmaCall.magmod
— Functionmagmod(x, y)
Equivalent to x mod y
in Magma.
MagmaCall.magsdiff
— Functionmagsdiff(x, y)
Equivalent to x sdiff y
in Magma.
MagmaCall.magcat
— Functionmagcat(x, y)
Equivalent to x cat y
in Magma.
MagmaCall.mageq
— Functionmageq(x, y)
True if x eq y
in Magma.
MagmaCall.magne
— Functionmagne(x, y)
True if x ne y
in Magma.
MagmaCall.magcmpeq
— Functionmagcmpeq(x, y)
True if x cmpeq y
in Magma.
MagmaCall.magcmpne
— Functionmagcmpne(x, y)
True if x cmpne y
in Magma.
MagmaCall.magle
— Functionmagle(x, y)
True if x le y
in Magma.
MagmaCall.maglt
— Functionmaglt(x, y)
True if x lt y
in Magma.
MagmaCall.magge
— Functionmagge(x, y)
True if x ge y
in Magma.
MagmaCall.maggt
— Functionmaggt(x, y)
True if x gt y
in Magma.
MagmaCall.magin
— Functionmagin(x, y)
True if x in y
in Magma.
MagmaCall.magnotin
— Functionmagnotin(x, y)
True if x notin y
in Magma.
MagmaCall.magadj
— Functionmagadj(x, y)
True if x adj y
in Magma.
MagmaCall.magnotadj
— Functionmagnotadj(x, y)
True if x notadj y
in Magma.
MagmaCall.magsubset
— Functionmagsubset(x, y)
True if x subset y
in Magma.
MagmaCall.magnotsubset
— Functionmagnotsubset(x, y)
True if x notsubset y
in Magma.
Reductions
MagmaCall.magsum
— Functionmagsum(x)
Equivalent to &+ x
in Magma.
MagmaCall.magprod
— Functionmagprod(x)
Equivalent to &* x
in Magma.
MagmaCall.magreduceand
— Functionmagreduceand(x)
Equivalent to &and x
in Magma.
MagmaCall.magreduceor
— Functionmagreduceor(x)
Equivalent to &or x
in Magma.
MagmaCall.magreducejoin
— Functionmagreducejoin(x)
Equivalent to &join x
in Magma.
MagmaCall.magreducemeet
— Functionmagreducemeet(x)
Equivalent to &meet x
in Magma.
MagmaCall.magreducecat
— Functionmagreducecat(x)
Equivalent to &cat x
in Magma.
Containers
MagmaCall.maglist
— Functionmaglist([xs])
A new Magma list, equivalent to [* *]
.
Optionally, values can be specified with iterable xs
.
MagmaCall.magtuple
— Functionmagtuple([xs])
A new Magma tuple, equivalent to < >
.
Optionally, values can be specified with iterable xs
.
MagmaCall.magseq
— Functionmagseq([xs]; [universe])
A new Magma sequence, equivalent to [ universe | ]
.
Optionally, values can be specified with iterable xs
.
MagmaCall.magset
— Functionmagset([xs]; [universe])
A new Magma set, equivalent to { universe | }
.
Optionally, values can be specified with iterable xs
.
MagmaCall.magmset
— Functionmagmset([xs]; [universe])
A new Magma multiset, equivalent to {* universe | *}
.
Optionally, values can be specified with iterable xs
.
MagmaCall.magiset
— Functionmagiset([xs]; [universe])
A new Magma indexed set, equivalent to {@ universe | @}
.
Optionally, values can be specified with iterable xs
.
Constructors
MagmaCall.magrecformat
— Functionmagrecformat(field, ...)
Create a record format with the given fields.
Each field
may be a symbol, giving the name, or a name=>type
pair.
MagmaCall.magrec
— Functionmagrec(fmt; vals...)
A record with the given format and values.
Other operators
MagmaCall.magprint
— Functionmagprint(io::IO, x, level=:default)
Print x
to io
at the given level
, which must be one of :default
, :magma
, :maximal
or :minimal
.
MagmaCall.magsprint
— Functionmagsprint(x, level=:default)
String representation of x
at the given level
(see magprint
).
MagmaCall.maggetindex
— Functionmaggetindex(o, i, ...)
Equivalent to o[i, ...]
in Magma.
MagmaCall.magsetindex!
— Functionmagsetindex!(o, x, i...)
Equivalent to o[i, ...] := x
in Magma.
MagmaCall.maglength
— Functionmaglength(o)
The length of o
, equivalent to # o
.
MagmaCall.magimage
— Functionmagimage(x, f)
The image of x
under f
, equivalent to x @ f
.
MagmaCall.magpreimage
— Functionmagpreimage(x, f)
The preimage of x
under f
, equivalent to x @@ f
.
MagmaCall.magcoerce
— Functionmagcoerce(s, x)
Coerce x
into structure s
, equivalent to s ! x
.
MagmaCall.maggen
— Functionmaggen(x, n)
The n
th generator of x
, equivalent to x.n
.
MagmaCall.maggetattr
— Functionmaggetattr(x, k)
Get attribute k
from x
, equivalent to x`k
.
MagmaCall.magsetattr!
— Functionmagsetattr!(x, k, v)
Set attribute k
of x
to v
, equivalent to x`k := v
.
MagmaCall.magattrnames
— Functionmagattrnames(x)
The attribute names of x.
MagmaCall.mageval
— Functionmageval(ex; vars...)
Evaluate the Magma expression ex
and return its value.
Keyword arguments can be used to name variables refereced by ex
, e.g. mageval("x+x", x=3)
returns 6
.
This is the worker function behind @mag_str
.
MagmaCall.maghelp
— Functionmaghelp(query)
Equivalent to ? query
.
MagmaCall.magassigned
— Functionmagassigned(o::MagmaObject)
True if o
is assigned. This should only occur if o = MagmaObject()
or if magdelete(o)
has been called.
Most functions do not expect unassigned values, and undefined behaviour occurs.
MagmaCall.magdelete
— Functionmagdelete(o::MagmaObject)
Delete the object referenced by o
.
Most functions do not expect deleted values, and undefined behaviour occurs.
Other helpers
MagmaCall.magtypeof
— Functionmagtypeof(o)
The Magma type of o
.
MagmaCall.magetypeof
— Functionmagetypeof(o)
The Magma extended type of o
.
MagmaCall.magissubtype
— Functionmagissubtype(t1, t2)
True if Magma type t1
is a subtype of t2
.
Symbol
arguments are interpreted as types.
MagmaCall.magisinstance
— Functionmagisinstance(o, t)
True if o
is an instance of Magma type t
.
If t
is a Symbol
, it is interpreted as a type.
Magma values and conversion
MagmaCall.MagmaValue
— TypeMagmaValue <: Any
MagmaValue(x)
Abtract type for any kind of Magma value. Most functions accept any MagmaValue
and return a MagmaObject
.
Subtypes include MagmaObject
, MagmaRef
, MagmaExpr
.
Overload MagmaValue(x)
to provide conversions from Julia values to Magma ones.
MagmaCall.MagmaObject
— TypeMagmaObject <: MagmaValue
MagmaObject(x)
A Magma object value. Most functions return a MagmaObject
.
It is represented by a handle to a variable in the Magma interpreter.
MagmaCall.MagmaRef
— TypeMagmaRef <: MagmaValue
MagmaRef(o::MagmaObject)
A reference to a Magma object, suitable for passing to mutating procedures such as Append
or Sort
.
MagmaCall.MagmaExpr
— TypeMagmaExpr <: MagmaValue
MagmaExpr(ex::String)
A literal Magma value, represented by an expression which evaluates to the value.
For simple values such as integers and strings, MagmaValue(x)
will return a MagmaExpr
.
MagmaCall.MagmaIntrinsic
— TypeMagmaIntrinsic <: MagmaValue
MagmaIntrinsic(name)
The Magma intrinsic with the given name.
MagmaCall.MagmaType
— TypeMagmaType <: MagmaValue
MagmaType(name, ...)
The Magma type with the given name.
Extra arguments make an extended type, e.g. MagmaType(:RngUPol, :RngInt)
is Magma's RngUPol[RngInt]
.
MagmaCall.MagmaCallable
— TypeMagmaCallable{C} <: MagmaValue
MagmaCallable{C}(o)
Wrap the value o
, declaring it to be callable with calling convention C
(see magcall
).
The resulting object can use the usual function call syntax, instead of magcall
.
MagmaCall.magconvert
— Functionmagconvert(T, o)
Convert the Magma object o
to a T
.
MagmaCall.@mag_str
— Macromag"..."[C]
Evaluates the given string as a Magma expression.
Julia values may be interpolated with $
as usual.
If C
is given, the returned value is wrapped as a MagmaCallable{C}
, for example:
f = mag"func<x, y | x^2 + 3*x*y + y^2>"f
f(2, 3)