Skip to content

Primi 0.2.4

Compare
Choose a tag to compare
@smuuf smuuf released this 06 Nov 08:43
· 321 commits to master since this release
  • NEW: Range definition literals
    • Syntax:
      • left .. right
        • Creates an array having integer values from left to right using steps of (minus) 1.
      • left ..[step..] right
        • Creates an array having values from left to right using steps of step.
    • Only integer numbers and integer number variables can be used as boundaries for range/step definition. (Current implementation will coerce floats into integers.)
    • Example:
      r = 1 .. 5; // (array) [0: 1, 1: 2, 2: 3, 3: 4, 4: 5]
      r = 1 .. -2 // (array) [0: 1, 1: 0, 2: -1, 3: -2]
      a = 1; b = 5; r = a .. b // (array) [0: 1, 1: 2, 2: 3, 3: 4, 4: 5] 
      r = 1 ..2.. 5; // (array) [0: 1, 1: 3, 2: 5]
      r = 1 ..4.. 7; // (array) [0: 1, 1: 5]
      r = 1 ..4.. 3; // ERR: Invalid step '4' for range
      
      The syntax is still experimental and may be subject to change.
  • NEW: Added two hashing functions to Primi Standard Library.
    • hash_md5(string|number)
      • Returns a string containing MD5 hash of string or number.
      • Example:
        "hello".hash_md5(); // (string) "5d41402abc4b2a76b9719d911017c592"
    • hash_sha256(string|number)
      • Returns a string containing SHA256 hash of string or number.
      • Example:
        "hello".hash_sha256(); // (string) "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"
        
  • Minor optimizations and fixes.