Samarium 0.5.0
Added
collections.Queue
now supports membership checkingcollections.Set
now uses the built-in set-based Array operations (working with small sets can be up to 3,600x faster)- Files are now iterable
iter.filter
anditer.map
now adapt to functions based on their number of parametersmath.is_int
math.ceil
math.floor
math.round
math.to_bin
(to replaceInteger$
)- Number type (in place of the Integer type):
- supports floats
x$
now floors the numberx -- y
now does true division rather than floor division
- Number literals, using
`
as the decimal point (meaning that it's no longer ignored by the tokenizer) - Nulls can now be cast to Numbers
- Parallel assignment
random.sample
now supports slices- Set-based Array operations:
-x
returns a copy ofx
with duplicates removedx -- y
("difference") tries removing elements ofy
fromx
, even if they're not presentx --- y
removes all duplicates ofy
inx
x | y
("union") creates an array with elements that appear in eitherx
ory
(duplicates possible)x & y
("intersection") creates an array with elements that appear in bothx
andy
(duplicates possible)x ^ y
("symmetric difference") creates an array with elements that appear in eitherx
ory
, but not both (duplicates possible)
- Slices are now hashable
String -- String
(oldString - String
behavior)String++
(equivalent toString ++ /\
)string.split
now accepts multiple separators- String→Number now supports scientific notation
string.split_lines
- Strings can have their characters shifted by adding or subtracting Integers
types.Frozen
Changed
- Flipped argument order for
iter.reduce
- Improved Array/Slice/String index typechecking
- Improved CLI error messages
- Improved error messages
- Improved
File.__str__
- Improved implicit null detection
- Improved slice transpilation
random.shuffle
now does type checking againast slicesString - String
now removes only the first occurence- The main function is no longer required
- Two or more consecutive logical NOTs are now considered a syntax error
Fixed
- Comments are now correctly tokenized
- Fixed
...
special method not being detected - Fixed Slice→Array construction
- Fixed some yield statements crashing the transpiler
- Functions are now correctly displayed in Arrays/Tables
- Logical NOT (
~~
) no longer lets Python'sbool
slip in - Multiline strings are now correctly tokenized
Number ++ String
is no longer detected as an invalid operation- Slices are now correctly detected as objects directly after scope exit
String.__repr__
now correctly handles escape sequencesType(a) != B
no longer yields incorrect resultsUserAttrs
can no longer show up when usingx!?
- Varargs functions now work correctly with recursive functions and decorators
Removed
collections.StaticArray
- Integer type
The Examples page was also updated with new examples.
Thanks to @DancingGrumpyCat for improving the documentation!