Skip to content

Releases: Shen-Language/shen-sources

Shen OS Kernel 20.1

02 May 02:03
Compare
Choose a tag to compare

Added

  • (command-line) function that returns a list of command line fragments. By default it returns ["shen"], ports can override this function or set the value of the *argv* variable on startup.

Fixed

  • Fixed dict-fold.
  • Handle integer overflows in prolog's complexity calculation function. Solves issues in ports with 32bit integers.
  • In the 20.0 release, *sterror* was not properly set as external in make.shen, fixed now.

Shen OS Kernel 20.0

24 Apr 00:55
Compare
Choose a tag to compare

Added

  • Documentation for system functions (doc/system-functions.md).
  • Character based I/O, makes Shen work on environments where I/O streams are multibyte encoded (SBCL >= 1.1.2 on Windows).
  • Dict datatype with API:
    • (dict Size) — returns dictionary object.
    • (dict? Dict) — predicate.
    • (dict-count Dict) — returns dictionary items count.
    • (dict-> Dict Key Value) — stores value.
    • (<-dict Dict Key) — retrieves value if it exists or throws an error.
    • (<-dict/or Dict Key OrDefault) — like <-dict but returns the result of thawing OrDefault instead of throwing an error when the key is missing.
    • (dict-rm Dict Key) — removes value from a dictionary.
    • (dict-fold F Dict Acc) — walks the dictionary, calling (F Key Value Acc) for each item in it. The result of each call is the new value of Acc, once no more items are left, the final value of Acc is returned.
    • (dict-keys Dict) — Returns a list containing all keys in Dict.
    • (dict-values Dict) — Returns a list containing all values in Dict.
  • Added get/or, value/or, <-address/or and <-vector/or. These work like their /or-less counterparts, but accept as an extra argument a continuation ((freeze ...)). Whenever their original versions would raise an exception, these variants will instead thaw the continuation and return it's result.
  • Added (fold-left F Acc List). Calls (F Acc Elt) for every Elt element in List. The result of each call to F is used as the new Acc for the next call. The final result is the return value of the last call to F.
  • Added (fold-right F List Acc). Calls (F Elt Acc) for every Elt element in List. The result of each call to F is used as the new Acc for the next call. The final result is the return value of the last call to F.
  • Added (for-each F List). Calls F on every element of List (in order), ignoring the results.
  • Added (filter Predicate List). Returns a new lost with all elements to which (Predicate Elt) returns true.
  • Added (exit ExitCode). Exits the program using the specified error code. The default implementation just ends the REPL loop, ports have to override exit if they want the exit code to have any effect.
  • Added *sterror* and (sterror), STDERR port. Defaults to an alias of *stoutput*.
  • Added (read-char-code Stream). Reads a character from a stream, and returns its numeric value.
  • Added (read-file-as-charlist Name). Reads the contents of a file as a sequence of characters. The result if a list of numeric character codes.

Changed

  • Reader is now built on top of read-char-code instead of read-byte. As a result, Shen's REPL now works on multibyte environments, like SBCL >= 1.1.2 on Windows.
  • Reimplemented put and get on top of dicts.
  • Reimplemented runtime function lookup using put and get.
  • Changed hash so that 0 is a valid return value.
  • Changed make.shen so that 19.2 can correctly compile the new version without needing two passes.
  • Ctrl+D (EOF) in the REPL when the line is empty, exits Shen.

Fixed

  • Declared arity for system functions that were missing it.
  • Fixed package prefix handling for internal package symbols.