About
Calculator
Ordering
FAQ
Download
Download Magma
Databases
User Contributions
Documentation
Handbook
Overview
Release Notes
Discovering Maths with Magma
First Steps in Magma (pdf)
Solving Problems with Magma (pdf)
Acknowledgements
Citations
Conferences
Links
Contact
CAG
Login
Magma
Computer • algebra
Documentation
Up
Contents
Index
Search
Expand all
Collapse all
Introduction
Functions and Procedures
Functions
function
func
function
func
Example
Func_Recursion (H2E1)
Example
Func_Parameters (H2E2)
Example
Func_Underscore (H2E3)
Example
Func_Variadic (H2E4)
Procedures
procedure
proc
procedure
proc
Example
Func_Procedures (H2E5)
The forward Declaration
forward f;
Example
Func_forward (H2E6)
Packages
Introduction
Intrinsics
intrinsic
Example
Func_intrinsic (H2E7)
Resolving Calls to Intrinsics
Example
Func_intrinsic-lookup (H2E8)
Attaching and Detaching Package Files
Attach(F) : MonStgElt ->
Detach(F) : MonStgElt ->
freeze;
Related Files
Importing Constants
import "filename": ident_list;
Example
Func_import (H2E9)
Argument Checking
require condition: print_args;
requirerange v, L, U;
requirege v, L;
Example
Func_require (H2E10)
The Number of Results
NumberOfResults() : -> RngIntElt, [ BoolElt ]
Example
Func_Nresults (H2E11)
Package Specification Files
AttachSpec(S) : MonStgElt ->
DetachSpec(S) : MonStgElt ->
Example
Func_spec (H2E12)
User Startup Specification Files
Example
Func_startup-spec (H2E13)
Attributes
Predefined System Attributes
User-defined Attributes
AddAttribute(C, F) : Cat, MonStgElt -> ;
declare attributes C: F
1
, ..., F
n
;
Accessing Attributes
S`fieldname : Str, Fieldname -> Elt
assigned S`fieldname : Str, Fieldname -> BoolElt
S`fieldname := expression;
delete S`fieldname;
GetAttributes(C) : Cat -> [ MonStgElt ]
ListAttributes(C) : Cat ->
User-defined Verbose Flags
declare verbose F, m;
Examples
Example
Func_SystemAttributes (H2E14)
Example
Func_InteractiveUserAttributes (H2E15)
Example
Func_PackageUserAttributes (H2E16)
User-Defined Types
Declaring User-Defined Types
declare type T;
declare type T: P
1
, ..., P
n
;
declare type T[E];
declare type T[E]: P
1
, ..., P
n
;
Creating an Object
New(T) : Type -> T
Special Intrinsics Provided by the User
Examples
Example
Func_MyRat (H2E17)
Example
Func_UserTypes2 (H2E18)
Up
Contents
Index
Search
V2.28, 28 February 2025