Skip to content

Latest commit

 

History

History
53 lines (46 loc) · 1.48 KB

README.md

File metadata and controls

53 lines (46 loc) · 1.48 KB

Hedgehog-Standard-Library

A library that can be imported directly at Hedgehog Lab

Each file contains a single function, which can be imported using "*import std: LIB_NAME" or *import Hedgehog-Standard-Library: LIB_NAME, for example:

// qr.hhs at http://github.com/....../hedgehog-standard/library/qr.hhs

function qr(A){
    let q=mat(); let r = mat(); class QRResult{q;r;}
    ...
    return qrResult;
}

You can easily import the file qr.hhs and function qr(A) above in this way:

*import std:qr, svd, fibonacci, magic
A = getMyMatrix();
print( qr(A).q );
print( svd(A).U );
print( magic(15) );

Notice: Each function library must be registered at the list of includes at the hedgehog-package.json file. It includes a json file like:

{
    "name": "Hedgehog-Standard-Library",
    "includes" : ["magic", "qr", "fibonacci"]
}

in which user can import any valid libraries LIB_NAME from the list of "libs", and Hedgehog Lab will automatically include the corresponding "hhs" file by concatenating string "root" + LIB_NAME + ".hhs", for example:

myQR = *import std:qr

is the same as

myQR = *import Hedgehog-Standard-Library:qr

and also is the same as

myQR = *import  https://raw.githubusercontent.com/Hedgehog-Computing/Hedgehog-Standard-Library/main/qr.hhs

or

*import std:qr

is also the same as

*import  https://raw.githubusercontent.com/Hedgehog-Computing/Hedgehog-Standard-Library/main/qr.hhs