Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

If you apply it to a single number, the "mag" primitive gives the absolute value:

mag -23    # 23
mag 5      # 5

In the more general case, "mag" gives the magnitude of a vector of numbers, also known as the Euclidean distance:

mag 3,4    # 5
mag 3,7    # 7.615773

If you want the absolute value of each element in a list, you can "push" mag down to each number with @:

mag @ -3,4,-5   # (3,4,5)