arc3 is a major change from arc2, with about 3000 lines and most files changed. The following gratuitous pie chart illustrates that the largest number of changes are in the news server (news.arc), with many changes to the fundamental language (ac.scm and arc.arc) as well as the web and application servers (app.arc and srv.arc).
The news server has been heavily modified with new ranking, support for polls, and improved spam rejection, among other features. A new "how-to-run-news" file explains how to set up your own Hacker News-like server. I will discuss the news server, web server, app server, and html library in more detail in a future article. I will focus this article on the language and main libraries.
If you're looking to try arc3, it can be downloaded here. Arc3 has significant incompatibilities with previous versions that will cause problems if you're not prepared.
Incompatibilities
- Arc now requires mzscheme 372. Arc will not work with the version 352 required by arc2, or with the newer versions of mzscheme.
flush-output
is disabled by default onwrite
,disp
, and functions that use these. Seedeclare
below.- The result of accum is no longer in reverse order.
news.arc
is no longer loaded as part of arc.a.b.c
is now((a b) c)
, not(a b c)
a!b!c
is now((a 'b) 'c)
, not(a 'b 'c)
- The
set
function has been renamedassign
, and theassert
function has been renamedset
. writefile1
removed.flat
no longer supportsstringstoo
option.to-nearest
renamed tonearest
.random-elt
renamed torand-elt
.firstn-that
renamed toretrieve
.plural
renamed topluralize
.
New functions
int
function coerces to an integer.force-close
discards buffered output and closes the descriptor.mvfile
moves a file.memory
returns the current memory use.sin
,cos
,tan
, andlog
are finally available.declare
is used to set system variables:explicit-flush
to control automatic output flushing, anddirect-calls
for the function call optimization.timedate
converts seconds to date.copylist
copies a list.defs
appliesdef
to name, args, body triples to define multiple functions at once.get
provides simpler table / array lookup.get!foo
creates a function that takes a table and looks up'foo
. (Actually, it's a generic mechanism to create a function to apply an argument to something.)writefile
writes to a temporary file first.letter
tests if a character is a letter.sum
sums up function results.med
returns median of list.minutes-since
returns minutes since a time.defcache
wrapper aroundcache
to reduce boilerplate.datestring
creates "y - m - d" string.or=
modifies a variable if the variable is false.out
evaluates and prints an expression.fromdisk
,diskvar
,disktable
, andtodisk
provide a simplified mechanism for loading and storing data.halve
splits a string in two on the first separator.positions
returns a list of positions where a test is true.lines
splits a string into lines.urlencode
urlencodes a string.nonblank
returns a string if it's nonblank.plural
returns a count and pluralized word.
Bug fixes
atomic-invoke
fixed.socket-accept
uses custodians so web servers can forcibly close connections if the clients aren't reading data.coerce
of string into int rounds the value as does number to char.list
modified to copy the list.safeset
now writes warnings to stderr.each
fixed to avoid conflict withafn
.cut
fixed.trues
fixed.whiler
fixed.rand-string
now more random to help fix huge security hole.split
fixed for negative positions..memo
now memoizesnil
results too.readline
will terminate onnil
.copy
fixed.hours-since
fixed.date
fixed to avoid system operation.intersperse
now works withnil
.load
fixed.posmatch
fixed.num
fixed to handle negative numbers.
Optimizations
-
complement
in function position - The
<
,>
, and+
operations when applied to two arguments. -
(foo bar)
is optimized to callfoo
directly iffoo
is a global bound to a function. This is controlled bydeclare
.
Other changes
- Debugging has been improved by giving the Arc names of things to Scheme, and turning on line counting.
- A default value can be provided when accessing a hash table.
- Currying was largely implemented but not enabled.
Disclaimers: I have provided my interpretations of the changes in arc3, and I'm sure there are some errors; please provide feedback if you find mistakes. Note that I am not connected with the arc team in any way, and this is not an "official" list of changes. In addition, arc3 may change without warning, so any of the above can be obsoleted. (There are some good reasons for real version numbers, bug tracking, and source code control, but I won't belabor that point.)
Impressive; thanks. But I think out= should be just out.
ReplyDeleteThanks for looking it over. Yes, I got out and or= mixed up.
ReplyDeleteAlso a.b.c and a!b!c are now ((a b) c) and ((a 'b) 'c)
ReplyDeletehttp://arclanguage.org/item?id=9163
Thanks, Anonymous. I've fixed that.
ReplyDeleteDid only get in before arc3? The timing is off.
ReplyDeleteKartik, the "only" function has been in arc for a long time: (documentation)
ReplyDelete