## Nickle

{{language |site=http://nickle.org/ |gc=yes |parampass=value |express=implicit |checking=dynamic }}

Nickle is a numerically oriented prototyping and scripting environment, with a syntax resembling C.

By Keith Packard and Bart Massey. Debuted in 2001, the most common version in use is probably 2.79 from 2017. 2.85 was tagged on 2019-07-31

Originally a command line desk calculator, Nickle was extended with more sophisticated programming features.

The numeric datatypes within Nickle make it a good choice for the design and implementation of numeric algorithms. Nickle provides three numeric data types: arbitrary precision integers, arbitrary-precision rationals and unbounded floating-point "reals" with specifiable precision.

Other datatypes include multi-dimensional arrays, strings, structures, tagged unions and pointers. Higher level types include file, semaphore and thread. Functions are fully call by value, arrays and structures are copied, not referenced.

The reference implementation includes an interactive top level with byte code compilation before evaluation.

Example:

```/* Arrays to JSON */
autoimport JSON;
int [*] d = {1,2,3};
poly [*] p = {1, "abc", 42};

printf("%s\n", to_json(d));
printf("%s\n", to_json(p));

/* digits, %v spec for any "poly" types */
printf("%g\n", 1/3);
printf("%g\n", imprecise(1/3, 8));   /* 8 bit internal precision */
printf("%v\n", imprecise(1/3, 32));  /* 32 bit precision  */
printf("%v\n", imprecise(1/3, 500)); /* 500 bit precision */
int f = 50!;
print f;

/* looping */
for (int i = 0; i < dim(p); i++) {
printf("%v ", p[i]);
}
printf("\n");
```

{{out}}

```prompt\$ nickle sampler.5c
[
1,
2,
3
]
[
1,
"abc",
42
]
0.333333333333333
0.33
0.333333333
0.333333333333333
global int f = 30414093201713378043612608166064768844377641568960512000000000000;
1 "abc" 42
```

While very suitable for general purpose programming, Nickle excels at prototyping numeric algorithms, and can be a nice complement to tools like Perl and AWK.