Polski
huginn - programming language with no quirks, so simple every child can master it.
Fork me on GitHub git clone https://codestation.org/repo/huginn.git
git clone https://github.com/AmokHuginnsson/huginn.git
git clone https://bitbucket.org/huginn/huginn.git
  1. Syntax
  2. Keywords
  3. Types

    Huginn provides several built-in scalar and collection types, as well as user defined compound types.

    integer real string number character boolean list deque dict order lookup set
  4. Built-ins
  5. Core library classes
  6. Packages

The number is a scalar type that is used to represent and operate on fixed point numbers of arbitrary size. It supports basic operations of addition, subtraction, multiplication, division, modulo, power, factorial and comparisons, it can also be used as an argument in functions and algorithms from Mathematics package. The range of possible values it can hold is limited only by size of your hardware resources.

Methods
  • get_precision() - get maximum precision of this number
  • is_exact() - tell if this number is an exact representation
  • is_integral() - tell if this number does not have any decimal digits
  • set_precision( prec ) set maximum precision of this number to prec (increasing precision works only on numbers that currently have exact representation)
Editor (vim) - number.hgn (Try it online!) [+line no]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#! /bin/sh
exec huginn --no-argv -E "${0}" "${@}"
#! huginn

import Mathematics as math;

main() {
	R = $5280;
	a = $236674;
	m = $30303;
	n = $61;
	u = $744;
	j = $427;
	print( "R = {}\n".format( R ) );
	print( "type of R is {}\n".format( type( R ) ) );
	q = ( a + m * math.square_root( n ) ) ^ $3;
	print( "q = {}\n".format( q ) );
	print( "type of q is {}\n".format( type( q ) ) );
	num = math.natural_logarithm( R ^ $3 * q + u );
	den = math.square_root( j );
	pi = num / den;
	pi.set_precision( 52 );
	print( "pi ~~ {}\n".format( pi ) );
	print( "type of pi is {}\n".format( type( pi ) ) );
	return ( 0 );
}

Program output:

Terminal - shell session [–line no]
[amok@vegeta](2/1)~/$ ./number.hgn
R = 5280
type of R is number
q = 106057559228295403.9999999325311176773626832885616386104425641989819140683187235271293993712901086590796610943379852311
type of q is number
pi ~~ 3.1415926535897932384626433832795028841971693993751059
type of pi is number
[amok@vegeta](2/1)~/$