GAP (Utils) - Chapter 6: Various other functions

Goto Chapter: Top 1 2 3 4 5 6 7 Bib Ind
[Top of Book] [Contents] [Previous Chapter] [Next Chapter]

[MathJax on]

6 Various other functions
6.1 Operations on folders
6.1-1 FindMatchingFiles
6.2 File operations
6.2-1 Log2HTML
6.3 LaTeX strings
6.3-1 IntOrOnfinityToLaTeX
6.3-2 LaTeXStringFactorsInt
6.4 Applicable methods
6.4-1 PrintApplicableMethod

### 6 Various other functions

#### 6.1 Operations on folders

##### 6.1-1 FindMatchingFiles

`‣ FindMatchingFiles`( pkg, dirs, extns ) | ( function )

`‣ CreateDirIfMissing`( str ) | ( function )

These functions have been transferred from package AutoDoc where they were named `AutoDoc_FindMatchingFiles` and `AutoDoc_CreateDirIfMissing`.

`FindMatchingFiles` scans the given (by name) subdirectories of a package directory for files with one of the given extensions, and returns the corresponding filenames, as paths relative to the package directory.

`CreateDirIfMissing` checks whether the given directory exists and, if not, attempts to create it. In either case `true` is returned.

Warning: this function relies on the undocumented library function `CreateDir`, so use it with caution.

    gap> FindMatchingFiles( "utils", [ "/", "tst" ], [ "g", "txt" ] );
    [ "/LICENSE.txt", "/PackageInfo.g", "/init.g", "/makedoc.g", "/read.g",
      "tst/testall.g" ]
    gap> CreateDirIfMissing( "/Applications/gap/temp/" );
    true

#### 6.2 File operations

##### 6.2-1 Log2HTML

`‣ Log2HTML`( filename ) | ( function )

This function has been transferred from package RCWA.

This function converts the GAP logfile logfilename to HTML. The extension of the input file must be `*.log`. The name of the output file is the same as the one of the input file except that the extension `*.log` is replaced by `*.html`. There is a sample CSS file in `utils/doc/gaplog.css`, which you can adjust to your taste.

    gap> LogTo("mar2.log");
    gap> FindMatchingFiles( "utils", [""], ["g"] );
    [ "/PackageInfo.g", "/init.g", "/makedoc.g", "/read.g" ]
    gap> LogTo();
    gap> Log2HTML( "mar2.log" );
    gap> FindMatchingFiles( "utils", [""], ["html", "log"] );
    [ "/mar2.html", "/mar2.log" ]

#### 6.3 LaTeX strings

##### 6.3-1 IntOrOnfinityToLaTeX

`‣ IntOrOnfinityToLaTeX`( n ) | ( function )

This function has been transferred from package ResClasses.

`IntOrInfinityToLaTeX(n)` returns the LaTeX string for n.

    gap> IntOrInfinityToLaTeX( 10^3 );
    "1000"
    gap> IntOrInfinityToLaTeX( infinity );
    "\\infty"

##### 6.3-2 LaTeXStringFactorsInt

`‣ LaTeXStringFactorsInt`( n ) | ( function )

This function has been transferred from package RCWA.

It returns the prime factorization of the integer n as a string in LaTeX format.

    gap> LaTeXStringFactorsInt( Factorial(12) );
    "2^{10} \\cdot 3^5 \\cdot 5^2 \\cdot 7 \\cdot 11"

#### 6.4 Applicable methods

##### 6.4-1 PrintApplicableMethod

`‣ PrintApplicableMethod`( arg ) | ( function )

This function combines calls to `ApplicableMethod`, `FilenameFunc`, `StartlineFunc` and `EndlineFunc` and prints the location of the file containing the method found, and a listing of that method. In its simplest form it is called as `PrintApplicableMethod(f,L)` for a function `f` and a list of parameters `L`. Alternatively, it is called as `PrintApplicableMethod(f,L,0,n)` and then prints the method returned by `ApplicableMethod(f,L,0,n)`.

    gap> PrintApplicableMethod( IsCyclic, [ Group((1,2,3),(4,5)) ] );
    this method is contained in lines [30,36] of file:
        /Applications/gap/gapdev/lib/grp.gi
    function ( G )
        if Length( GeneratorsOfGroup( G ) ) = 1  then
            return true;
        else
            return TRY_NEXT_METHOD;
        fi;
        return;
    end
    gap> PrintApplicableMethod( IsCyclic, [ Group((1,2,3),(4,5)) ], 0, 2 );
    this method is contained in lines [41,63] of file:
        /Applications/gap/gapdev/lib/grp.gi
    function ( G )
        if HasGeneratorsOfGroup( G ) and Length( GeneratorsOfGroup( G ) ) = 1
             then
            SetMinimalGeneratingSet( G, GeneratorsOfGroup( G ) );
            return true;
        elif not IsCommutative( G )  then
            return false;
        elif IsFinite( G )  then
            return ForAll( Set( FactorsInt( Size( G ) ) ), function ( p )
                    return
                     Index( G,
                         SubgroupNC( G,
                           List( GeneratorsOfGroup( G ), function ( g )
                                  return g ^ p;
                              end ) ) ) = p;
                end );
        else
            return AbelianInvariants( G ) = [ 0 ];
        fi;
        return;
    end

[Top of Book] [Contents] [Previous Chapter] [Next Chapter]
Goto Chapter: Top 1 2 3 4 5 6 7 Bib Ind

generated by GAPDoc2HTML