I'm very pleased to announce the release of Factor 0.98!
OS/CPU Windows Mac OS X Linux x86 x86-64 Source code: 0.98
This release is brought to you with almost 4,300 commits by the following individuals:
Alexander Ilin, Arkady Rost, Benjamin Pollack, Björn Lindqvist, Cat Stevens, Chris Double, Dimage Sapelkin, Doug Coleman, Friedrich von Never, John Benediktsson, Jon Harper, Mark Green, Mark Sweeney, Nicolas Pénet, Philip Dexter, Robert Vollmert, Samuel Tardieu, Sankaranarayanan Viswanathan, Shane Pelletier, @catb0t, @hyphz, @thron7, @xzenf
Besides several years of bug fixes and library improvements, I want to highlight the following changes:
- Improved user interface with light and dark themes and new icons
- Fix GTK library issue affecting some Linux installations
- Support Cocoa TouchBar on MacOS
- Factor REPL version banner includes build information.
- Bindings for ForestDB
- New graphical demos including Minesweeper, Game of Life, Bubble Chamber, etc.
- Better handling of "out of memory" errors
- Improved VM and compiler documentation, test fixtures, and bug fixes
- Much faster Heaps and Heapsort
- Support for Adobe Brackets, CotEditor, and Microsoft Visual Studio Code editors
- On Mac OS X, allow use of symlinks to factor binary
- Lots of improvements to FUEL (Factor's emacs mode)
Some possible backwards compatibility issues:
- Flattened
unicode
namespace (eitherUSE: ascii
orUSE: unicode
). - Unified
CONSTRUCTOR:
syntax to include generated word name - Returning a struct by value with two register-sized values on 64bit now works correctly
- Since shutdown hooks run first, calling exit will now unconditionally exit even if there is an error
- On Windows, don't call
cd
to change directory when launching processes; there is another mechanism for that - In
libc
, renamed(io-error)
tothrow-errno
- In
match
, renamed?1-tail
to?rest
- In
sequences
, renamediota
to<iota>
- In
sequences
, renamedstart
/start*
tosubseq-start
/subseq-start-from
- In
syntax
, renamedGENERIC#
toGENERIC#:
- Improve command-line argument parsing of "executable"
- Make
buffered-port
not have a length, because of problem with Linux virtual files and TCP sockets - Fix broken optimization that made floats work for integer keys in
case
statements - Growable sequences expand by factor of 2 (instead of 3) when growing
- Removed support for "triple-quote" strings
What is Factor
Factor is a concatenative, stack-based programming language with high-level features including dynamic types, extensible syntax, macros, and garbage collection. On a practical side, Factor has a full-featured library, supports many different platforms, and has been extensively documented.
The implementation is fully compiled for performance, while still supporting interactive development. Factor applications are portable between all common platforms. Factor can deploy stand-alone applications on all platforms. Full source code for the Factor project is available under a BSD license.
New Libraries:
- backticks: process backtick syntax for processes
- bencode: support for bencoding
- boolean-expr: simple boolean expression evaluator and simplifier
- bubble-chamber: variation of Jared Tarbell's Bubble Chamber
- calendar.elapsed: rendering elapsed time to text
- calendar.english: separated out English localization
- checksums.crc16: CRC16 checksum implementation
- checksums.metrohash: MetroHash checksum implementation
- checksums.multi: support multiple checksums in one pass
- checksums.process: support for using command-line checksums
- checksums.ripemd: RIPEMD checksum implementation
- checksums.sodium: Sodium crypto library checksum implementation
- cocoa.touchbar: support for the Apple Touchbar
- colors.flex-hex: implement "flex hex" color algorithm
- crontab: parsing the cron format
- cuckoo-filters: implementation of Cuckoo Filter data structure
- dbf: parsers for DBase file format
- editors.brackets: support for Adobe Brackets
- editors.cot: support for CotEditor
- editors.visual-studio-code: support for Microsoft Visual Studio Code
- emojify: add emoji's to text (
"I :heart: Factor :+1:"
) - english: tools for English language words
- enigma: implementation of Enigma cipher machine
- escape-strings: minimal string escaping algorithm
- etc-hosts: cross-platform
/etc/hosts
file parser - file-monitor: cross-platform file change event monitor
- file-picker: cross-platform file picker user interface
- file-server: cross-platform file server web interface
- flip-text: fun with "uʍop ǝpᴉsdn" text flipping
- forestdb: bindings for ForestDB
- game-of-life: implementation of John Conway's Game of Life
- google.gmail: adding Google GMail API support
- gopher: library for querying Gopher servers
- gopher.server: cross-platform Gopher file server
- gopher.ui: interface for viewing Gopher servers
- ifaddrs: list network interfaces
- ip-parser: parsing IPv4 and IPv6 addresses
- ldcache: parsing
/etc/ld.so.cache
file - libtls: wrapper for using
libtls
functions - linked-sets: sets that yield items in insertion order
- lru-cache: least recently used cache algorithm
- machine-learning: experiments with some machine learning algorithms
- math.factorials: adding reverse-factorial
- math.functions.integer-logs: support for integer log2 and log10
- math.primes.erato.fast: faster Sieve of Eratosthenes
- metar: parsers for METAR and TAF weather reports
- midi: reading MIDI files and writing MIDI files
- minesweeper: playing the classic game of Minesweeper
- named-tuples: using tuples as a sequence and assoc
- oauth1: support OAuth 1.0
- oauth2: support OAuth 2.0
- odbc: support ODBC database query
- picomath: implement picomath.org small math words
- robohash: adding a robot-based hashing tool
- sequences.frozen: virtual "frozen" sequence
- sequences.interleaved: virtual "interleaved" sequence
- shapefiles: parser for ESRI Shapefiles
- shell.parser: parser for shell expressions
- snake-game: implementation of the snake video game
- sodium: wrapper for libsodium
- sorting.bubble: adding Bubblesort
- stream.extras: few helper words
- subrip-subtitles: parser for SubRip
.SRT
files - successor: algorithm to find successor to a given string
- text-analysis: analyze the complexity of English text
- text-to-pdf: simple "Text to PDF" utility
- text-to-speech: cross-platform "Text to Speech" utility
- tools.cal: command-line "cal" tool
- tools.cat: command-line "cat" tool
- tools.copy: command-line "copy" tool
- tools.echo: command-line"echo" tool
- tools.grep: command-line"grep" tool
- tools.image-analyzer: examine Factor image files
- tools.move: command-line "move" tool
- tools.seq: command-line "seq" tool
- tools.tree: command-line "tree" tool
- tools.uniq: command-line "uniq" tool
- tools.wc: command-line "wc" tool
- ui.gadgets.charts: UI gadget for rendering line charts
- ui.gadgets.frame-buffer: UI gadget that supports a couple games
- ui.theme: support for light and dark themes
- windows.comdlg32: using
comdlg32.dll
functions - windows.crypt32: using
crypt32.dll
functions - windows.dragdrop-listener: allow dropping files into the Listener
- windows.dropfiles: implementing "file drop" gesture on Windows
- windows.surface-dial: support for Microsoft Surface Dial
- xdg: support for XDG Base Directory Specification
- zealot: continuous build and testing library
Improved Libraries:
- boids: adding Cocoa TouchBar buttons
- cap: support for screenshot on retina displays
- checksums: cleanup and improved checksum API
- color-table: add columns for filled color and hex code
- cpu.architecture: adding Bit Test primitive
- cpu.x86.64: fix for return register on x86.64
- colors.hex: support varying length hex notations
- combinators.extras: adding
swap-when
- compiler.cfg: fix scheduling issue
- concurrency.distributed: fix serializing of remote threads
- elf: cleanup and performance improvements
- formatting: support "space" prefix for numbers
- furnace.utilities: improve template path resolution
- heaps: performance improvements to the heap algorithm
- help: default word help (if not provided)
- html.parser.printer: improved plain text printer
- http.client: support HTTP proxies and bug fixes
- http.server: fix use of port remapping
- http.server.static: support sorting by columns
- images.png: support reading color profiles
- images.tiff: fix bugs exposed by AFL test suite
- interpolate: simplify and some minor improvements
- io.directories.search: simplify interface and allow BFS and DFS searches
- io.encodings.8-bit: more encodings and simplify hierarchy
- io.files.info.windows: fix
file-readable?
to check current user's permissions - io.files.unique: create multiple unique files at same time
- io.launcher: cleanup interface and support hidden processes on Windows
- io.streams.c: faster
M\ c-reader stream-read-until
- json.writer: better support for non-string keys, unicode and special floats
- lexer: support universal comments
- logging.server: simplify code
- macho: updated structures and tests
- mason.release: code signing on macOS and Windows
- math.binpack: faster
binpack
andmap-binpack
- math.combinatorics: performance improvements
- math.extras: adding Möbius function and Kelly criterion
- math.functions: adding
logn
- math.parser: faster
format-float
for known format strings - math.primes.erato: performance improvements
- math.primes.factors: command-line support
- math.primes.solovay-strassen: adding Solovay-Strassen primality test
- math.statistics: fixes and new words
- math.text.french: more proper use of French
- math.transforms.bwt: performance improvements
- math.vectors: adding
v>integer
- mime.types: update for new mime types
- multiline: support "Lua-style" strings
- peg.ebnf: handle escapes in strings better
- pong: bug fixes and a bit fancier graphics
- readline-listener: adding vocab word completions
- reddit: fix for Reddit API changes
- sequences.extras: some possibly useful new words
- simple-tokenizer: consider TAB, CR, LF as spaces
- smalltalk: cleanup grammar and fix underscore bug
- splitting.monotonic: faster
monotonic-split
. - sorting: faster
sort-keys
andsort-values
onhashtables
- sorting.extras: faster
map-sort
- strings.parser: allow both
\u{snowman}
and\u{2603}
- terminfo: look in multiple directories for terminfo files
- tools.disassembler: allow disassemble of compose and curry
- tools.dns: enable use from command-line
- tools.hexdump: support stdin hexdump
- tools.scaffold: Better examples scaffold. Add more types.
- tools.test: adding
with-test-file
andwith-test-directory
helper words - tools.which: enable use from command-line
- ui.tools.browser: adding Cocoa TouchBar buttons
- ui.tools.inspector: improved performance with large arrays and hashtables
- ui.tools.listener: adding Cocoa TouchBar buttons, Ctrl-Break support on Windows, and vocab word completions
- unicode: simplified hierarchy
- urls: improved parsing of scheme component
- wrap: performance improvements using better algorithm
- xkcd: fix mouseover text.
- xml.data: make tags support assoc protocol
- z-algorithm: faster
z-values
14 comments:
Hi factor team,
Thanks very much for the new release,
What are the plans for release 0.99 or even 1.0?
Regards
Folkert
Could you tell me, where is matrix multiplication?
George
https://docs.factorcode.org/content/vocab-math.matrices.html
Look at m* and related math words.
John, tell me please. I want to use map-reduce to get 2*3 + 2*3
I write
: fff ( -- n m )
2 { 3 3 } [ [ dup ] dip * ] [ + ] map-reduce ;
and get 24. Why?
Stack effect of map-reduce
..a map-quot: ( ..a elt -- ..b intermediate ) reduce-quot: (..b prev intermediate -- ..a next ) -- ..a result
Can we apply reduce-quot only after two applying of map-quot? How can we apply map-quot to the second element?
Sorry, stack effect is
..a seq map-quot
and so on. But all problems are the same.
The map-reduce will "map" over the first two values, before reducing them, you can see that by putting a breakpoint in:
2 { 3 3 } [ B dupd * ] [ B + ] map-reduce
When you are trying to use values under the stack, there are various ways, one is to curry them into the quotation:
2 { 3 3 } swap '[ _ * ] [ + ] map-reduce
Or pass them as a named value:
:: fff ( x -- y )
{ 3 3 } [ x * ] [ + ] map-reduce ;
Feel free to send me an email if you want to start a discussion, join Gitter.im, Discord, Slack, the mailing list, or file a bug on GitHub and we can chat there -- I don't always notice comments on this blog promptly.
John, optimizing compiler does not check stack effect properly. Can I discuss it with Pestov?
George
Feel free to email the mailing list or open a GitHub issue. Or describe the issue here. I’d love to address whatever the deficiency is. Slava isn’t as actively involved these days, but could be contacted if we had a sufficient test case that isn’t easy to resolve.
Stack effect of map-reduce
..a seq map-quot: ( ..a elt -- ..b intermediate ) reduce-quot: (..b prev intermediate -- ..a next ) -- ..a result
Try to compute 2*3+2*3
2 { 3 3 } [ dupd * ] [ + ] map-reduce
Why we obtain 24? Because the first [ dupd * ] put the result 2*3=6 to stack
2 6 { 3 3 }
The second [ dupd * ] get 6*3=18
The proper stack effect of map-reduce is
seq map-quot: ( elt -- intermediate ) reduce-quot: ( prev intermediate -- next ) -- result
but compiler does not give an error. I am trying to find the error in the vocab stack-checker and want to discuss it with Pestov (in Russian)
It looks like the map quotation is applied twice, and the arguments are preserved on the stack for the second call, that's not quite what the stack effect implies, so that is a bug of sorts. I will look at this.
This is a possible fix:
https://github.com/factor/factor/issues/2476
Hi, John. I think the "right" definition of map-reduce is following
: (map-reduce) ( acc seq map-quot reduce-quot -- acc )
[ dup length 0 swap ] 2dip '[ [ swap n-th @ @ ] 2keep 1 + ] times 2drop ;
but it doesn't work:) I have a strategic plan: replace all recursive definitions with "times" (mathematicians calls it "primitive recursion") and rewrite "stack-cheker" vocab to do correct stack-checking.
Post a Comment