Commit Graph

35893 Commits

Author SHA1 Message Date
Vincent St-Amour
c47c0ebfca sequence-length: special case O(1) cases. 2016-01-02 20:05:04 -06:00
Vincent St-Amour
47f06f11e1 random: encourage inlining.
Reduces overhead to 6% over #%kernel's  for the integer case.
2016-01-02 20:02:30 -06:00
Vincent St-Amour
740b6dc198 random: Remove redundant checking. 2016-01-02 20:02:30 -06:00
Vincent St-Amour
acb7d999ba Comment typo.
Pointed out by Gustavo.
2016-01-02 20:02:30 -06:00
Vincent St-Amour
707f9bffa6 random: move sequence support to random-ref, in racket/random.
And add `random-sample`.
2016-01-02 20:02:30 -06:00
Vincent St-Amour
6af2f711b7 Fix optimization tests. 2016-01-02 20:02:30 -06:00
Vincent St-Amour
0796350a88 Extend random to work with ranges and sequences.
Requested by Matthias.
2016-01-02 20:02:30 -06:00
Robby Findler
36b3493e45 Change contracts of the form (-> any/c ... any) to not be flat contracts
The issue is what happens when the actual function has other arities.
For example, if the function were (λ (x [y 1]) y) then it is not okay
to simply check if procedure-arity-includes? of 1 is true (what the
code used to do) because then when the function is applied to 2
arguments, the call won't fail like it should. It is possible to check
and reject functions that don't have exactly the right arity, but if
the contract were (-> string? any), then the function would have been
allowed and only when the extra argument is supplied would the error
occur. So, this commit makes it so that (-> any/c any) is like
(-> string? any), but with the optimization that if the procedure
accepts only one argument, then no wrapper is created.

This is a backwards incompatible change because it used to be the
case that (flat-contract? (-> any)) returned #t and it now returns #f.
2016-01-02 17:29:58 -06:00
Matthew Flatt
fdf56dfebf fix calculation of unexported bindings
When a module defines <name-1> and doesn't export it, but when
the module imports <name-2> and re-exports that refers to another
module's definition of <name-1>, then <name-1> wasn't properly
registered as an unexported binding.

Most of the implementation change is just a clean-up of an
unnecessary traversal from before the addition of a `count`
field in each hash table.
2016-01-02 15:10:23 -07:00
Matthew Flatt
190925ee32 avoid a compiler warning 2016-01-02 07:46:42 -07:00
Robby Findler
2529e63b74 make stronger recognize any/c on the right as stronger than any flat contracts 2016-01-01 19:49:38 -06:00
Robby Findler
b24882fd18 implement the (-> any/c ... any) special case for the new -> contract combinator
(new is being used in a relative sense here; it is the newer of the
two -> combinators; the old one is used currently only for ->m)
2016-01-01 19:49:38 -06:00
Matthew Flatt
fd7b8b29ea avoid compiler warning 2016-01-01 14:33:16 -07:00
Matthew Flatt
c0915b02b0 pathlist-closure, tar, and tar-gzip: add #:path-filter
Also, add `#:skip-filtered-directory?` to `find-files`.

Less significantly, adjust `pathlist-closure` to be consistent in the
way that it includes a separator at the end of a directory path.
2016-01-01 13:52:37 -07:00
Matthew Flatt
c9a1dc781e raco setup: use lazy ".zo" parsing for dpeendency checking
Lazy ".zo" parsing make the dependency check take about half as
long.
2016-01-01 13:52:37 -07:00
Matthew Flatt
d3bb9d0412 fix bytecode-reading time-complexity bug
When a tree marshaled to bytecode form has many shared pieces,
the unmarshaling process can lose track of the sharing in one
place and traverse too much of the structure as pieces are
loaded.
2016-01-01 13:52:37 -07:00
Matthew Flatt
8b7f5bc046 faster xexpr->string 2016-01-01 13:52:37 -07:00
Vincent St-Amour
923b5864a5 Small guide fixes.
Closes PR 15109.
2016-01-01 12:52:14 -06:00
Vincent St-Amour
8c8a76979b Fix keyword argument name.
Closes PR 15089.
2016-01-01 12:52:14 -06:00
Vincent St-Amour
4c04d4afce Fix discussion of filter.
Closes PR 15083.
2016-01-01 12:52:14 -06:00
Robby Findler
110f1bd9b0 different, more likely fix 2015-12-31 15:36:33 -06:00
Robby Findler
357b692d33 fix typo 2015-12-31 15:33:59 -06:00
Matthew Flatt
567679bf0a {impersonate,chaperone}-hash: add equal-key-proc wrapper
The optional `equal-key-proc` wrapper effectively interposes on calls
to `equal?` and `equal-hash-code` for hash-table keys.
2015-12-31 09:22:57 -07:00
Robby Findler
e92b8610f2 port id-set/c to late-neg 2015-12-30 19:16:36 -06:00
Robby Findler
85c781452d wording tweaks 2015-12-30 17:57:36 -06:00
Benjamin Greenman
0f7a946dba put contract-property accessors in an itemlist 2015-12-30 17:52:33 -06:00
Benjamin Greenman
61e21dba22 typo: is-flat-contract? -> is-list-contract? 2015-12-30 17:52:26 -06:00
Robby Findler
df382ca939 improve warnings and fix small problems with contract combinator constructors 2015-12-30 17:13:23 -06:00
Robby Findler
cb2af327e6 port async-channel/c to late-neg proj
and drop other projection implementations
(mostly to reduce the testing burden)
2015-12-30 17:13:22 -06:00
Robby Findler
9ee264a0ea improve performance of define-generic-created contracts and port to late-neg
This program runs about 10x faster than it did before this commit, but
seems to still be about 100x slower than the version where you change
an-s to just be (s).

  #lang racket/base
  (require racket/contract/base racket/generic)
  (define-generics id [m id x])
  (struct s () #:methods gen:id [(define (m g x) x)])
  (define an-s
    (contract (id/c [m (-> any/c integer? integer?)])
              (s)
              'pos 'neg))
  (time
   (for ([x (in-range 100000)])
     (m an-s 2)))
2015-12-30 17:13:22 -06:00
Robby Findler
a97aa8389b port id-table/c to flat-neg projection 2015-12-30 17:13:22 -06:00
Sam Tobin-Hochstadt
1c3422d420 Fix CI tests for match test move. 2015-12-30 10:39:45 -05:00
Robby Findler
f2f38cdf4a remove overly aggressive use of procedure-specialize 2015-12-30 09:28:58 -06:00
Robby Findler
a5b3d6b3d0 uncopy some code 2015-12-29 21:46:06 -06:00
Robby Findler
46ace3172f clean up interaction between strict set/c contracts and mutable sets 2015-12-29 20:28:22 -06:00
Robby Findler
757adac568 make #f always convert into the same (eq?) contract 2015-12-29 16:13:01 -06:00
Robby Findler
4bdde405f6 improve the way that 'struct-out' cooperates with the
rest of the contract system, creating and using a slightly
more legitmate blame record and calling into the late-neg
projections instead of using `contract`
2015-12-29 15:48:17 -06:00
Sam Tobin-Hochstadt
893bb56762 Rename to make it clear what to run. 2015-12-29 16:01:22 -05:00
Mira Leung
e2bd1b51bc Using in-list in for/list 2015-12-29 15:59:40 -05:00
Mira Leung
404c5b2699 Better code style for f3d888 2015-12-29 15:59:40 -05:00
Mira Leung
56ea9f8b9a Specify names of missing fields for match on structs 2015-12-29 15:59:40 -05:00
Robby Findler
22adc0253b change sets generics so they default to supplying the optional argument
if the given procedure accepts it
2015-12-29 11:26:17 -06:00
Robby Findler
2c5aa96031 change some potentially error-prone provide all-from-outs to explicit provides
and make set load its implementation via relative requires
2015-12-29 11:25:45 -06:00
Robby Findler
7056cd5f2a improve ->i in the case that the dependent contract
turns out to be a predicate.

In that case, just call it instead of creating all of the extra junk
that would normally be created by coercing the predicate to a contract
and invoking it
2015-12-29 11:20:59 -06:00
Matthew Flatt
a516304f6b fix specialization over a nested lambda 2015-12-29 07:04:17 -06:00
Matthew Flatt
26560240f1 adjust "racket-playsound.exe" return code 2015-12-29 07:04:17 -06:00
Robby Findler
d4ca825640 fix set/c name method 2015-12-29 06:56:20 -06:00
Robby Findler
a44ce40b56 fix a bug in 50405a2ca 2015-12-28 22:17:39 -06:00
Robby Findler
f7465f81f1 convert stream/c to late-neg-projection
Also, tune the projection to get a few modest performance gains.

This program gets about 20% faster:

  #lang racket
  (define s (contract (stream/c exact-nonnegative-integer?)
                      (in-naturals) 'pos 'neg))
  (time
   (for ([x (in-range 1000)])
     (for/fold ([s s])
               ([x (in-range 100)])
       (stream-rest s))))

and this program gets about 15% faster:

  #lang racket
  (define f (contract (-> (stream/c exact-nonnegative-integer?)
                          any)
                      (λ (x) 1)
                      'pos 'neg))
  (define l (make-list 10000 0))
  (time (for ([x (in-range 1000)])
          (f l) (f l) (f l) (f l) (f l)))
2015-12-28 21:57:03 -06:00
Robby Findler
ff31b01505 add some error checking for custom set type constructors 2015-12-28 16:59:43 -06:00