UtilAutoOpens Module

Contains auto-opened utilities related to the DiffSharp programming model.

Functions and values

Function or value Description

!r

Full Usage: !r

Parameters:
    r : 'T ref

Returns: 'T
r : 'T ref
Returns: 'T

r := v

Full Usage: r := v

Parameters:
    r : 'T ref
    v : 'T

r : 'T ref
v : 'T

bytesReadable i

Full Usage: bytesReadable i

Parameters:
    i : int64

Returns: string

Return a human-readable string representation of the given value in Bytes.

i : int64
Returns: string

fileToBase64String fileName

Full Usage: fileToBase64String fileName

Parameters:
    fileName : string

Returns: string

Returns the file contents as Base64 encoded string

fileName : string
Returns: string

indentNewLines str numSpaces

Full Usage: indentNewLines str numSpaces

Parameters:
    str : String
    numSpaces : int

Returns: string

Indents all lines of the given string by the given number of spaces.

str : String
numSpaces : int
Returns: string

loadBinary fileName

Full Usage: loadBinary fileName

Parameters:
    fileName : string

Returns: 'T

Loads the given value from the given local file using binary serialization.

fileName : string
Returns: 'T

log10Val

Full Usage: log10Val

Returns: float

Value of log(10).

Returns: float

logSqrt2Pi

Full Usage: logSqrt2Pi

Returns: float

Value of log(sqrt(2*Math.PI)).

Returns: float

memoize fn

Full Usage: memoize fn

Parameters:
    fn : 'a -> 'b

Returns: 'a -> 'b

Returns a function that memoizes the given function using a lookaside table.

fn : 'a -> 'b
Returns: 'a -> 'b

pngToHtml fileName widthPixels

Full Usage: pngToHtml fileName widthPixels

Parameters:
    fileName : string
    widthPixels : int

Returns: string

Given a PNG image file name, returns an HTML image element with the image content included as a Base64 encoded string

fileName : string
widthPixels : int
Returns: string

saveBinary object fileName

Full Usage: saveBinary object fileName

Parameters:
    object : 'T
    fileName : string

Saves the given value to the given local file using binary serialization.

object : 'T
fileName : string

stringPad s width

Full Usage: stringPad s width

Parameters:
    s : string
    width : int

Returns: string

Left-pads a string up to the given length.

s : string
width : int
Returns: string

stringPadAs s1 s2

Full Usage: stringPadAs s1 s2

Parameters:
    s1 : string
    s2 : string

Returns: string

Left-pads a string to match the length of another string.

s1 : string
s2 : string
Returns: string

thousandsFloat x

Full Usage: thousandsFloat x

Parameters:
    x : float

Returns: string

Formats an integer as a string with comma as thousands separator

x : float
Returns: string

thousandsInt x

Full Usage: thousandsInt x

Parameters:
    x : int

Returns: string

Formats an integer as a string with comma as thousands separator

x : int
Returns: string

© Copyright 2021, DiffSharp Contributors.