API Reference

Calling functions and procedures

MagmaCall.magcallFunction
magcall(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 and nothing is returned. Note that if f 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 first N return values are returned as a tuple.
  • :b: f is a function returning a boolean, which is returned as a Bool.
  • :i: f is a function returning an integer, which is returned as an Int.
  • :g: f is a function returning a structure S. args[1] is a tuple of generator names, which are applied to S. Returns a tuple of S and generator names.
  • :pN: Same as :p (procedure) but the Nth argument is passed by reference.

Equivalently, you can call magcallC(f, args...; opts...) or magC.f(args...; opts...).

source
MagmaCall.magcallpFunction
magcallp(f, args...; opts...)

Call the Magma procedure f with the given arguments and keyword options.

Equivalent to magcall(Val(:p), f, args...; opts...).

source
MagmaCall.magcallfFunction
magcallf(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...).

source
MagmaCall.magcallf2Function
magcallf2(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...).

source
MagmaCall.magcallf3Function
magcallf3(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...).

source
MagmaCall.magcallf4Function
magcallf4(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...).

source
MagmaCall.magcallf5Function
magcallf5(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...).

source
MagmaCall.magcallf6Function
magcallf6(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...).

source
MagmaCall.magcallf7Function
magcallf7(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...).

source
MagmaCall.magcallf8Function
magcallf8(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...).

source
MagmaCall.magcalliFunction
magcalli(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...).

source
MagmaCall.magcallbFunction
magcallb(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...).

source
MagmaCall.magcallp1Function
magcallp1(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...).

source
MagmaCall.magcallp2Function
magcallp2(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...).

source
MagmaCall.magcallp3Function
magcallp3(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...).

source
MagmaCall.magcallp4Function
magcallp4(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...).

source
MagmaCall.magcallgFunction
magcallg(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...).

source
MagmaCall.magcallmFunction
magcallm(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...).

source

Binary operators

Reductions

Containers

MagmaCall.maglistFunction
maglist([xs])

A new Magma list, equivalent to [* *].

Optionally, values can be specified with iterable xs.

source
MagmaCall.magtupleFunction
magtuple([xs])

A new Magma tuple, equivalent to < >.

Optionally, values can be specified with iterable xs.

source
MagmaCall.magseqFunction
magseq([xs]; [universe])

A new Magma sequence, equivalent to [ universe | ].

Optionally, values can be specified with iterable xs.

source
MagmaCall.magsetFunction
magset([xs]; [universe])

A new Magma set, equivalent to { universe | }.

Optionally, values can be specified with iterable xs.

source
MagmaCall.magmsetFunction
magmset([xs]; [universe])

A new Magma multiset, equivalent to {* universe | *}.

Optionally, values can be specified with iterable xs.

source
MagmaCall.magisetFunction
magiset([xs]; [universe])

A new Magma indexed set, equivalent to {@ universe | @}.

Optionally, values can be specified with iterable xs.

source

Constructors

MagmaCall.magrecformatFunction
magrecformat(field, ...)

Create a record format with the given fields.

Each field may be a symbol, giving the name, or a name=>type pair.

source

Other operators

MagmaCall.magprintFunction
magprint(io::IO, x, level=:default)

Print x to io at the given level, which must be one of :default, :magma, :maximal or :minimal.

source
MagmaCall.magevalFunction
mageval(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.

source
MagmaCall.magassignedFunction
magassigned(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.

source
MagmaCall.magdeleteFunction
magdelete(o::MagmaObject)

Delete the object referenced by o.

Most functions do not expect deleted values, and undefined behaviour occurs.

source

Other helpers

MagmaCall.magissubtypeFunction
magissubtype(t1, t2)

True if Magma type t1 is a subtype of t2.

Symbol arguments are interpreted as types.

source
MagmaCall.magisinstanceFunction
magisinstance(o, t)

True if o is an instance of Magma type t.

If t is a Symbol, it is interpreted as a type.

source

Magma values and conversion

MagmaCall.MagmaValueType
MagmaValue <: 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.

source
MagmaCall.MagmaObjectType
MagmaObject <: 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.

source
MagmaCall.MagmaRefType
MagmaRef <: MagmaValue
MagmaRef(o::MagmaObject)

A reference to a Magma object, suitable for passing to mutating procedures such as Append or Sort.

source
MagmaCall.MagmaExprType
MagmaExpr <: 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.

source
MagmaCall.MagmaTypeType
MagmaType <: 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].

source
MagmaCall.MagmaCallableType
MagmaCallable{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.

source
MagmaCall.@mag_strMacro
mag"..."[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)
source