Commit Graph

34548 Commits

Author SHA1 Message Date
Matthew Flatt
b9d8f65fc9 reduce CPP noise 2014-11-05 09:50:31 -07:00
Vincent St-Amour
1d09fbde37 Compile the math library as part of the TR test suite. 2014-11-05 11:02:20 -05:00
Vincent St-Amour
8a0c859d14 Fix math/matrix for new type of expt. 2014-11-05 11:02:20 -05:00
Robby Findler
4afd6c86d0 fix control-[ when 'framework:automatic-parens pref is set 2014-11-04 20:38:58 -06:00
Asumu Takikawa
b374902bf3 Simplify contract generation code
Don't export type->contract except for testing. This
discourages direct use of type->contract in favor of
using the change-contract-fixup approach.

Also consolidate most of the contract-related syntax
properties into a single property containing a prefab
struct instance.
2014-11-04 18:17:22 -05:00
Asumu Takikawa
7b6ae09a2d Avoid direct use of type->contract in with-type
Eliminates the last remaining use of type->contract
outside of the type-contract.rkt file. This allows
all contract generation to go through a single point
of control.
2014-11-04 18:17:21 -05:00
Asumu Takikawa
4d806fb02d Change contract on change-contract-fixups
The context should provide a flattened list of syntax
to the function.
2014-11-04 18:17:21 -05:00
Vincent St-Amour
ff0c101a64 Fix other bugs in type of expt.
Found using the new random testing.
2014-11-04 18:12:14 -05:00
Vincent St-Amour
8b8130c38e Fix type of expt.
Add expt to random testing.

Haven't seen one of those bugs in a while. Thank you Redex.

Closes PR14823.
2014-11-04 18:12:14 -05:00
Asumu Takikawa
1c5202ade7 Eliminate special cases for top-level contract gen
Use the same mechanism as require/typed for doing all
contract gen for make-predicate, cast, etc. Also don't
special-case contract generation for top-level require/typed.
2014-11-04 15:24:33 -05:00
Asumu Takikawa
34076af389 Adjust contract generation for provides in TR
Use the same mechanism as ordinary require/typed to generate
contracts for provide forms.
2014-11-04 12:57:52 -05:00
Matthew Flatt
14de729ed4 update "news" on main web page 2014-11-04 09:45:08 -07:00
Matthew Flatt
7debaf8f0f fix the "Racket Documentation.app" icon 2014-11-04 09:37:25 -07:00
Ryan Culpepper
f15c7ee289 remove info for natipkg installers 2014-11-04 11:33:48 -05:00
Ryan Culpepper
00c9a96fcb v6.1.1 installers info 2014-11-04 09:47:41 -05:00
Ryan Culpepper
fff23e7410 v6.1.1 announcement 2014-11-04 09:47:41 -05:00
Eric Dobson
9b9ed84a18 Fix typo (does -> doesn't). 2014-11-04 04:58:07 -07:00
Matthew Flatt
8a85587178 distro-build/installer-dmg: codesign whole ".app" instead of just exe
This change is needed for the more stringent Gatekeeper introduced in
Mac OS X 10.9.5, but the build machine has to be 10.9 or later to make
10.9.5 clients happy.
2014-11-04 04:53:52 -07:00
Matthew Flatt
168e76ac0e document current-read-interaction adjustment by at-exp
i.e., document the change in commit 015986fb4f.
2014-11-03 12:52:08 -07:00
AlexKnauth
015986fb4f at-exp: extend reader for repl too 2014-11-03 12:40:40 -07:00
Matthew Flatt
0c5479a1a6 fix small doc omission 2014-11-03 07:45:05 -07:00
Sam Tobin-Hochstadt
2221fa279c Fix require/typed/provide in no-check context.
Closes PR 14821.
2014-11-03 09:14:57 -05:00
Sam Tobin-Hochstadt
96c3808460 Add support for specifying keys for ssh.
This allows non-default private keys in the `remote-shell` library.
Also, allow the appropriate private key to be specified for a pkg-build.
2014-11-03 09:14:56 -05:00
Matthew Flatt
edd50a24a8 optimizer: preserve implied properties from a let RHS
In an expression such as

 (let ([x (car y)])
   ....)

the information that `y` must be a pair didn't reach the body of the
`let` in most cases.
2014-11-03 06:06:04 -07:00
Matthew Flatt
89106b6708 optimizer: refine tracking of when space safety is a constraint
Some expression movements are limited by the possibility of retaining
a value in a way that interacts with space safety, but primitives that
return immediately shouldn't get in the way of those movements.
2014-11-03 06:06:04 -07:00
Matthew Flatt
9a94366c2c optimizer: fix reordering problems
When a variable X is bound to an expression that implies properties of
other bindings, and if X is used only once and can be replaced by
its value expression, then further optimization of that expression must
not assume the properties that are established by evaluating the
expression.

Also, don't move expressions past unsafe operations, since the expression
might implicitly guard against unsafety.

Closes PR 14819
2014-11-03 06:06:04 -07:00
Matthew Flatt
0d6deb84de README tweak
Based on a suggestion from freshlikeesch.
2014-11-03 06:06:04 -07:00
freshlikeesch
b424e97e60 Professionalism
Line 11: "may" instead of "can"
Line 11: "implies" instead of "means"
Line 14: "states" instead of "means"
Line 17: -resources should be clear and separated-
2014-11-03 06:06:04 -07:00
Matthew Flatt
823e8cf8d3 repair for more recent MinGW
I think that `-static-libgcc` didn't solve any problems with gcc
3.7.x, but with 3.8.x, divdi3() shows up, and that leads to
a "libgcc_s.dll" dependency unless `-static-libgcc` is used.
2014-11-03 06:06:04 -07:00
Asumu Takikawa
03153d46ec Update TR type for current-process-milliseconds 2014-11-03 01:25:15 -05:00
Asumu Takikawa
f59b36a951 Fix Editor<%> and Snip% types 2014-11-02 22:10:43 -05:00
Matthew Flatt
c7688818fa racket/gui gtk: fix event handling on choice%
Button-click handling foir `choice%` could continuously
re-queue an event that isn't handled by default, leading
to stack overflow and a crash.
2014-11-02 09:14:29 -07:00
Matthew Flatt
795d26a673 setup/dirs: don't include (find-dll-dir) in (get-lib-search-dirs)
I don't see a reason to include `(find-dll-dir)` in the result of
`(get-lib-search-dirs)`. It's practically always redundant, and
including it causes problems for sandboxes --- since `(find-dll-dir)`
must inspect the Racket executable on Windows and Mac OS X, and that
access is normally not allowed by a sandbox.
2014-11-02 08:40:29 -07:00
Matthew Flatt
822541e0a0 sync version in "base" package 2014-11-02 07:33:46 -07:00
Leif Andersen
627c775b6f Add 'subprocesses mode to current-process-milliseconds 2014-11-02 06:41:59 -07:00
Asumu Takikawa
566668e0b9 Adjust type of log-level? for recent changes 2014-11-01 21:48:18 -04:00
Matthew Flatt
0b200abe63 unbreak GC for Linux and some other Unix variants
Corrects another problem with cceda78374.
2014-11-01 14:08:11 -06:00
Matthew Flatt
fe557c0e93 Cygwin: one more repair
Also, add a missing dependency that caused me to miss this correction
before.
2014-11-01 10:42:28 -06:00
Matthew Flatt
cdf0dc8ed2 Windows: MinGW fixes 2014-11-01 08:17:52 -06:00
Matthew Flatt
cceda78374 restore Cygwin support
Fix various configuration problems, and make the build work with 3m
(probably for the first time).

The repairs include corrections for the manual link table, but also
switch Cygwin to relying on normal DLL exports, instead, to work
properly with the FFI.

The `--enable-shared` comfiguration option is no longer required for
Cygwin. When it is used, the `gracket` launcher does not work right,
because the Cygwin DLL is in the "bin" directory and "gracket.exe" is
in the "lib" directory. Along similar lines, stand-alone executables
won't work with `--enable-shared`.

The change to `ffi/winapi` makes it match the documentation.
2014-11-01 06:50:24 -06:00
Matthew Flatt
d7ee4c3fb5 change logger terminology: "name" => "topic"
Originally, the symbolic "name" of a logger was just a string to
prefix any message sent to a logger. The symbol has evolved instead
into a first-class component of an event to be used for message
selection and filtering; the word "topic" more clearly communicates
that role.

This is just a documentation change. The `logger-name` function would
be better called `logger-default-topic`, but it's staying the same for
compatibility.

Based on comments from Tony Garnock-Jones.
2014-10-31 16:48:41 -06:00
Matthew Flatt
58eb802468 add log-all-levels and log-level-evt
These two functions allow the creation of relays that receive events
on logger B where there are interested receivers for logger A.

Based on comments from Tony Garnock-Jones.
2014-10-31 16:48:41 -06:00
Matthew Flatt
38ac6e052c compiler/cm: filtered logging propagation instead of manual
With the new propagation-filtering support, CM's accomplice channel
doesn't need a receiver that accepts all events, and so less logging
logging work will be triggered during compilation.
2014-10-31 16:48:29 -06:00
Matthew Flatt
159c82fc4a make-logger: support specification of events to propagate
Events to propagate to a parent are described in the same way
as events to receive for a log receiver. The default is still
to propagate all events to the parent, which corresponds to
a propagation specification of 'debug.

Making a propagation-filtering specification built-in, instead of
allowing arbitrary filter functions, keeps `log-level?` efficient and
avoid hooks that might be implemented by untrusted code.
2014-10-31 16:48:29 -06:00
Matthew Flatt
83b4595741 log-level?, log-max-level: accept optional name argument
Change `log-error`, etc., to check the name that will be used for
the message, in addition to the log level.
2014-10-31 16:48:29 -06:00
Matthew Flatt
65e323d266 make-logger: rescind optional callback argument
The optional callback argument was added (by me) in f2d87085. This is
a backward-incompatible change, but allowing an arbitrary callback
on a logger now seems like an especially bad idea; forms like
`log-error` otherwise work in constrained contexts, while an arbitrary
callback function allows potentially untrusted code in those contexts.
Meanwhile, the addition doesn't satisfactorily solve the original
problem, since it intereferes with `log-level?` and similar filters.
2014-10-31 16:48:29 -06:00
Ryan Culpepper
a02beaa821 check-require: fix submod-related bugs 2014-10-31 15:13:14 -04:00
Robby Findler
73f4fa86a3 Replace the racket/list shuffle function with
the fisher-yates shuffling algorithm.

Thanks to Daniel Prager for the push to fix this and doing
most of the work.

The timing tests below seem to indicate that it takes a constant
amount of time per element (about 1/7th of a microsecond per element
on my laptop) and even for 10 element lists it runs faster than
the sort-based version that this code replaces.

Below is some code that I used to explore the shuffles. I used Mike
Bostock diagrams (http://bost.ocks.org/mike/shuffle/compare.html)
to double check that the FY algorithm was implemented properly.

 #lang racket/gui
(require pict)

;; some shuffling algorithms:

(define (st-shuffle l)
  (sort l < #:key (λ(_) (random)) #:cache-keys? #t))

(define (fy-shuffle l)
  (define a (make-vector (length l)))
  (for ([x (in-list l)] [i (in-naturals)])
    (define j (random (add1 i)))
    (unless (= j i) (vector-set! a i (vector-ref a j)))
    (vector-set! a j x))
  (vector->list a))

(define (naive-swap-random->random l)
  (define v (apply vector l))
  (define len (vector-length v))
  (for ([x (in-range len)])
    (define n (random len))
    (define m (random len))
    (define t (vector-ref v n))
    (vector-set! v n (vector-ref v m))
    (vector-set! v m t))
  (vector->list v))

;; replication of the ``Will it Shuffle?'' diagram

(define green '(0 100 0))
(define red '(165 42 42))

(define (shuffle-pict shuffle size)
  (define pict-size 300)
  (define sq-size (/ pict-size size))
  (define v (build-vector size (λ (i) (make-vector size 0))))
  (define ht (make-hash))
  (define l (build-list size values))
  (define shuffles 10000)
  (for ([x (in-range shuffles)])
    (for ([x (in-list (shuffle l))] [i (in-naturals)])
      (define r (vector-ref v x))
      (vector-set! r i (+ (vector-ref r i) 1))))
  (apply
   hc-append
   (for/list ([r (in-vector v)])
     (apply
      vc-append
      (for/list ([e (in-vector r)])
        (colorize (filled-rectangle sq-size sq-size #:draw-border? #f)
                  (triple->color
                   (sq-color shuffles size e))))))))

(define (sq-color shuffles size n)
  (define mid-point (/ shuffles size))
  (cond
    [(<= n mid-point)
     (interp-color red
                   (- 1 (map-between (/ mid-point 3) mid-point n)))]
    [else
     (interp-color green (map-between mid-point (* mid-point 3) n))]))

(define (map-between lower-bound upper-bound n)
  (cond
    [(<= lower-bound n upper-bound)
     (/ (- n lower-bound) (- upper-bound lower-bound))]
    [(<= n lower-bound) 0]
    [else 1]))

(define (interp-color color %)
  (define (i n) (- 255 (* (- 255 n) %)))
  (list (i (list-ref color 0))
        (i (list-ref color 1))
        (i (list-ref color 2))))

(define (triple->color triple)
  (define (get n) (inexact->exact (floor (list-ref triple n))))
  (make-object color% (get 0) (get 1) (get 2)))

(module+ test
  (require rackunit)
  (check-equal? (map-between 10 110 0) 0)
  (check-equal? (map-between 10 110 10) 0)
  (check-equal? (map-between 10 110 20) 1/10)
  (check-equal? (map-between 10 110 100) 9/10)
  (check-equal? (map-between 10 110 150) 1)
  (check-equal? (sq-color 1000 10 0) red)
  (check-equal? (sq-color 1000 10 100) (list 255 255 255))
  (check-equal? (sq-color 1000 10 1000) green))

(define (pictures)
  (values
   (shuffle-pict st-shuffle 60)
   (shuffle-pict fy-shuffle 60)
   (shuffle-pict naive-swap-random->random 60)))

;; timing tests

(define (time-it a-shuffler size iters)
  (printf "~a ~a ~a " (object-name a-shuffler) size iters)
  (flush-output)
  (define l (build-list size values))
  (collect-garbage) (collect-garbage) (collect-garbage)
  (time (for ([x (in-range iters)])
          (a-shuffler l))))

(define (timings)
  (time-it fy-shuffle 10 100000)
  (time-it fy-shuffle 100 10000)
  (time-it fy-shuffle 1000 1000)
  (time-it fy-shuffle 10000 100)

  (time-it st-shuffle 10 100000)
  (time-it st-shuffle 100 10000)
  (time-it st-shuffle 1000 1000)
  (time-it st-shuffle 10000 100))

(module+ main (timings))
2014-10-31 13:26:50 -05:00
Asumu Takikawa
d6b3434cc6 Fix type for window<%> for TR
Closes PR 14812
2014-10-31 11:16:03 -04:00
Asumu Takikawa
b7eeaf7608 Fix ordering issue in typechecking inner calls
Closes PR 14810
2014-10-30 03:22:09 -04:00