Commit Graph

550 Commits

Author SHA1 Message Date
Matthew Flatt
d7b18e7a9c adjust map and for ... in-list to not retain their lists
Adjust list and stream handling as sequences so that during the body

 (for ([i (in-list l)])
   ....)

then `i` and its cons cell in `l` are not implicitly retained while
the body is evaluated. A `for .... in-stream` similarly avoids
retaining the stream whose head is being used in the loop body.

The `map`, `for-each`, `andmap`, and `ormap` functions are similarly
updated.

The `make-do-sequence` protocol allows an optional extra result so
that new sequence types could have the same properties. It's not clear
that using `make-do-sequence` is any more useful than creating the new
sequence as a stream, but it was easier to expose the new
functionality than to hide it.

Making this work required a repair to the optimizer, which would
incorrectly move an `if` expression in a way that could affect
space complexity, as well as a few repairs to the run-time system
(especially in the vicinity of the built-in `map`, which we should
just get rid of eventually, anyway).
2016-12-13 19:20:41 -07:00
Ben Greenman
8de6f581f3 doc: fix types in regexp constructors
- change return types of `pregexp` etc. to use the right predicate
- change input of `byte-regexp` and `byte-pregexp` from `string?` to `bytes?`
2016-12-13 01:43:43 -05:00
Alexis King
62170e6218 Add index(es)-of and index(es)-where to racket/list 2016-12-10 13:01:12 -08:00
Robby Findler
31ca626910 document a default 2016-11-25 09:17:28 -06:00
Sam Tobin-Hochstadt
34fdd2863a Avoid traversing immutable vectors when specified.
This adds #:eager as an option for controlling this behavior.

Using `#:eager 10` is a 2x improvement in performance for configuration 010001
of the suffixtree benchmark from Takikawa et al, POPL 2016.

The default behavior is unchanged. This is configurable because some
programs are much faster when eager checking is performed. For example:

(require racket/contract)
(collect-garbage)
(time (for/sum ([_ 100000])
        (vector-ref (contract (vectorof integer? #:eager #t) #(1) 'pos 'neg)
                    0)))
(collect-garbage)

(time (for/sum ([_ 100000])
        (vector-ref (contract (vectorof integer? #:eager #f) #(1) 'pos 'neg)
                    0)))

The second loop is 3-4 times slower than the first. However, making
the vector much larger will make the difference go the other way.
2016-11-22 11:28:30 -05:00
Robby Findler
09c1174f7e add the #:extra-delay argument to recursive-contract 2016-11-19 15:56:18 -06:00
Leif Andersen
1582178982 Add example for dict-implements/c 2016-11-15 08:29:51 -05:00
Vincent St-Amour
81cd3622d3 Update docs to reflect xrepl being enable by default. 2016-11-08 08:58:21 -06:00
Robby Findler
1b834d010a fix wrong name in docs 2016-10-23 22:54:46 -05:00
Georges Dupéron
153dc01ccd Some small fixes to the documentation
* Wrong contract for syntax-local-value in the documentation.
* Clarified signature in documentation for expand-import, expand-export and pre-expand-export
* Corrected typo in documentation for "for".
* Fixed error message for function which seems to have been renamed in the docs
* Fixed typo in a comment in the tests
* Fixed a typo in the documentation for set-subtract.
* Use double ellipses for the free-id-table-set*, free-id-table-set*!, bound-id-table-set* and bound-id-table-set*! operations
2016-10-19 20:52:45 -05:00
Matthew Flatt
ddf6985020 fix docs on PLT_COMPILED_FILE_CHECK
Merge to v6.7
2016-10-15 07:28:52 -06:00
Matthew Flatt
ff7f1ce9ff update "More" now that xrepl is on by default
Merge to v6.7
2016-10-15 07:28:43 -06:00
Vincent St-Amour
ecadde3a65 Add #:logger keyword argument to with-intercepted-logging.
Closes #1486.
2016-10-11 11:50:33 -05:00
Stephen Chang
58d9b3eb19 add doc example for make-provide-pre-transformer 2016-10-11 11:40:13 -04:00
Vincent St-Amour
241d87c011 Avoid tech collision.
Closes #1484.
2016-10-09 10:54:53 -05:00
Ben Greenman
65a69417cc doc: clarify elements vs values in sequence/c 2016-10-06 18:46:46 -04:00
Ben Greenman
684dd2d1cb typo: redeclaration 2016-10-06 08:57:05 -04:00
Matthew Flatt
cfb2a7aa32 in-directory: sort entries
Make `in-directory` more like `directory-list` by sorting
directory content.
2016-09-15 06:11:30 -06:00
Ryan Culpepper
fd4ce5afe4 add more codes to lookup-errno, relax contract (#1433)
lookup-errno now returns #f when given an unknown symbol instead
of raising a contract error. It should not return #f for any
symbol that it previously accepted.
2016-09-12 18:07:44 -04:00
Alex Knauth
1952bc4ede fix typo in the syntax-arm docs (#1447) 2016-09-07 14:27:35 -04:00
Andrew Kent
42f4784735 add vector-sort to racket/vector (#1398)
* add vector interface to private/sort.rkt
2016-09-06 17:07:20 -04:00
AlexKnauth
17db8e57f0 update read-cdot documentation 2016-09-01 16:28:06 -04:00
Ben Greenman
5708526055 add index for 'chmod' 2016-08-30 17:55:38 -04:00
Stephen Chang
1ddb4d025c doc typo: nonnegative-exact -> exact-nonnegative 2016-08-30 13:34:22 -04:00
Stephen De Gabrielle
5ef5a4f3cf struct is preferred
changed 'make-struct' to struct
2016-08-25 10:37:06 -05:00
Vincent St-Amour
00f0311473 setup-plt -> raco setup
Survived unnoticed for 6+ years.
2016-08-24 15:33:07 -05:00
Matthew Flatt
a5f0e6dcfc identifier-binding: add mode to report top-level binding info 2016-08-22 08:54:34 -06:00
Matthew Flatt
c3355f6df2 remove spaces around em dashes 2016-08-19 07:05:47 -06:00
Matthew Butterick
aef8f3e7bd clarify role of empty stop-ids list in local-expand (#1335) 2016-08-19 07:03:54 -06:00
Matthew Butterick
88292a6e13 add a more concise example of patching a phase mismatch (#1331)
* add a more concise example of patching a phase mismatch

* Update phases.scrbl

Clarifications
2016-08-19 07:03:43 -06:00
Matthew Butterick
787915155f add example of negative phase level (#1330)
* add example of negative phase level

* Update proc-macros.scrbl

Remove `eval:error`

* correct dashes
2016-08-19 07:03:19 -06:00
gus-massa
70adb6a502 Fix typo in string-ci=? docs (#1424)
After case-folding the strings, they are compared with equal? instead of eqv?
2016-08-19 06:33:45 -06:00
Matthew Butterick
9f7a0af3e5 update #lang tutorial to use reader submodule (#1409) 2016-08-19 06:33:36 -06:00
Robby Findler
2c7db537cc add indexing for contract syntax properties 2016-08-18 13:16:14 -05:00
Robby Findler
30f946fc4b add history, typos 2016-08-17 15:48:22 -05:00
AlexKnauth
1b1b400f91 add #:newline? argument to pretty-printing functions 2016-08-17 15:44:39 -05:00
Benjamin Greenman
1478f64c14 doc: fix broken link to contract-generate
Replaced with `contract-random-generate`
2016-08-15 20:43:47 -04:00
Matthew Flatt
84793e80ff doc corrections
Fix inacurracies noticed while reimplementing the module and macro system.
2016-08-13 14:15:54 -06:00
Matthew Flatt
71b4f5f6c0 doc corrections for syntax-make-delta-introducer 2016-08-13 14:15:54 -06:00
Matthew Flatt
c9da43378f restore SCHEME_INPORT_VAL and SCHEME_OUTPORT_VAL 2016-08-13 14:15:54 -06:00
Matthew Flatt
21d5d909a6 doc correction for ffi/unsafe/alloc 2016-08-13 14:15:54 -06:00
Matthew Flatt
0034c31820 track cumulative allocation
Extend `current-memory-use` to accept a 'cumulative flag.
2016-08-13 14:15:54 -06:00
Matthew Flatt
ad230d2ca0 improve structure-type property handling
Make the optimizer recognize and track `make-struct-property-type`
values, and use that information to recognize `make-struct-type`
calls that will defnitely succeed because a property that hs no
guard is given a value in the list of properties.

Combined with the change to require-keyword expansion, this
change allows the optimizer to inline `f` in

 (define (g y)
   (f #:x y))

 (define (f #:x x)
   (list x))

because the `make-struct-type` that appears between `g` and `f`
is determined to have no side-effect that would prevent `f` from
having its expected value.
2016-08-07 15:59:02 -06:00
Leif Andersen
dc13793c24 sandwitch -> sandwich
(Apparently the other way was incorrectly in my dictionary.)
2016-08-01 12:41:56 -04:00
Leif Andersen
cb1a1e233e Cannot show system build paths in docs 2016-08-01 09:34:12 -04:00
Leif Andersen
1b050905e9 Add example for collection-file-path 2016-07-31 23:19:49 -04:00
Ben Greenman
22546a3f22 typo: description of module-compiled-name argument 2016-07-30 02:14:01 -04:00
Stephen Chang
c56efb22a6 remove mention of syntax-id-rules in Macros section of Guide 2016-07-29 16:19:43 -04:00
Marc Burns
ef41bf21cb fix wrong pluralization 2016-07-28 15:33:13 -05:00
Marc Burns
cdf9da7da4 an string -> an immutable string 2016-07-28 15:33:13 -05:00
Alexis King
1b63703ac0 Fix for-label requires for some struct documentation 2016-07-28 15:33:13 -05:00
Matthew Flatt
fc345ed249 add use-compiled-file-check
Along with the `PLT_COMPILED_FILE_CHECK` environment variable, allows
the timestamp check to be disabled when deciding whether to use a
compiled bytecode file.

In accomodating this change, `raco make` and `raco setup` in all modes
check whether the SHA1 hash of a module source matches the one
recorded in its ".dep" file, even if the timestamp on the bytecode
file is newer. (If the compile-file check mode is 'exists, the
timestamp is completely ignored.)
2016-07-26 10:27:08 -06:00
Leif Andersen
c65ad1efad Moved racket/gui/init and racket/gui/interactive to the gui-lib 2016-07-26 10:14:38 -04:00
Leif Andersen
28f693a976 A few more changes based on Matthew's feedback.
Updated docs
2016-07-26 10:14:38 -04:00
Leif Andersen
a6b7af9733 Made changes based on Matthew's comments.
1. Changed the API documentation for scheme_make_hash_tree, adding primitives for:

* SCHEME_hashtr_eq
* SCHEME_hashtr_equal
* SCHEME_hashtr_eqv

2. Changed direct uses of scheme_make_hash_tree to use these enumed values.

3. Fixed bugs in documentation

4. Defaults to racket/interactive (and racket/gui/interactive) if there is nothing in the config file
2016-07-26 10:14:38 -04:00
Leif Andersen
237418ba0c Added documentation for the racket/interactive module 2016-07-26 10:14:38 -04:00
Leif Andersen
933a494fe0 Fix a few typos in the existing docs. 2016-07-26 10:14:38 -04:00
Leif Andersen
e5ff658875 Add docs for hash trees. 2016-07-26 10:14:38 -04:00
Matthew Butterick
b62d0c80e4 Update examples for equal? eqv? eq? (#1391)
Use the same examples for each so it's easier to compare how the behavior differs.
2016-07-26 01:21:45 -05:00
Tony Garnock-Jones
1ba42bb70d Skip whitespace more liberally when parsing PLTSTDERR and friends.
Now accepts any whitespace, not just spaces, ignores both leading and
trailing whitespace, and accepts multiple whitespace characters
separating subterms.
2016-07-25 19:17:35 -04:00
Leif Andersen
02fa5e06b2 Update docs for racket/init 2016-07-19 17:52:43 -04:00
Asumu Takikawa
ad2c229af1 Add doc examples for FFI union types 2016-07-14 17:30:58 -04:00
Benjamin Greenman
956d10432b typo: argument to 'module-compiled-submodules' (#1370)
Changed from `pre-module?` to `non-star?`
2016-07-10 18:46:24 -04:00
Robby Findler
fdc3b4a685 improve docs for and/c
please merge to the release branch
2016-07-08 15:35:58 -05:00
Sam Tobin-Hochstadt
8d698389e7 Add a way to recognize cpointer predicates. (#1368)
Similar to `struct-predicate-procedure?`. Allows Typed Racket
(and the contract system generally) to avoid chaperone wrapping
for cpointer predicates.
2016-07-08 12:40:03 -04:00
Robby Findler
bdd11100bb add explanation for and/c 2016-07-04 08:08:51 -05:00
Matthew Flatt
8dec2485d6 adjust docs for read-language 2016-07-01 13:30:50 -06:00
Leif Andersen
ebe3a77c2b Update namespace-attach-module docs 2016-06-30 14:20:27 -04:00
Matthew Flatt
3fbb384604 add hash-keys-subset?
This function exposes the fast subset operation that is built in for
immutable hash tables (and used by the set-of-scopes implementation).

Also, make the space optimization implicit for `eq?`-based hash tables
that contain only #t values (instead of explicit and only available
internally). It turns out to be easy and efficient to make the
representation automatic, because the HAMT implementation can support
a mixture of nodes with some containing explicit values and some
containing implicit #t values.
2016-06-30 08:22:18 -06:00
Alexis King
e86fa9f055 Improve with-disappeared-uses and add record-disappeared-use
Now with-disappeared-uses surrounds its body with let, so it can contain
multiple body expressions. The record-disappeared-use function is like
record-disappeared-uses but for a single identifier.
2016-06-29 12:50:14 -05:00
Matthew Flatt
871392f09a add inspector-superior? 2016-06-17 10:23:47 -06:00
Bernardo Sulzbach
b0978652b3 Should call vector vec, not lst 2016-06-15 21:21:14 -05:00
Asumu Takikawa
51bd8f3de5 Fix typo for in-combinations contract 2016-06-15 15:08:48 -04:00
Sam Tobin-Hochstadt
547ddaa6f5 Clarify contract comparison for characters. 2016-06-13 10:27:45 -04:00
Matthew Flatt
8d5f196f96 clairfy 'add default of make-syntax-delta-introducer result 2016-06-10 04:34:52 -06:00
Matthew Flatt
9ca0513875 examples and docs for new define-serializable-cstruct version 2016-06-10 04:34:52 -06:00
Ben Greenman
c21d5e780b typo: with-immed-mark-val -> with-immed-mark-def-val 2016-06-08 18:34:36 -04:00
Asumu Takikawa
5e2caa169e Fix Guide link to scmindent 2016-06-08 17:11:15 -04:00
Asumu Takikawa
2a222a8f15 Add examples for _? C type 2016-06-07 15:19:59 -04:00
Asumu Takikawa
f0003da766 Improve docs for _box C type 2016-06-07 14:37:12 -04:00
Asumu Takikawa
d9cf3c0805 Add examples for _list and _vector in the FFI docs 2016-06-03 17:01:48 -04:00
Leif Andersen
81eb6bf4c0 The 'dummy' field in 'mod' really should be in its own paragraph. 2016-06-01 15:22:04 -04:00
Matthew Flatt
9b60f6b767 fix typo 2016-05-27 07:27:04 -06:00
Leif Andersen
fe03198211 Updated docs to add examples for module->* functions. 2016-05-19 19:01:04 -04:00
Ben Greenman
afec68f639 typo: can #f -> can be #f 2016-05-19 17:43:48 -04:00
Leif Andersen
8111e4ec99 Updated docs to cause resolve-module-path-index and module-path-index-resolve to link to each other. 2016-05-19 12:23:50 -04:00
Leif Andersen
eb17a041ab Updated ZO documentation for global-bucket. 2016-05-18 16:32:38 -04:00
Matthew Flatt
c0fa2eecd5 add module-compiled-indirect-exports and co.
That information is needed sometimes to compile expanded syntax to
bytecode form.
2016-05-18 13:13:15 -06:00
Matthew Flatt
a134d0c0a3 racket/serialize: support keywords and regexp values 2016-05-15 20:03:15 -06:00
Matthew Flatt
b09b5c6184 fix doc link 2016-05-13 11:56:48 -06:00
Matthew Flatt
1149d6cdcd ffi/unsafe: add checking of _array values
When an array value is provided, make sure that it's an array
with at least the expected length (or longer) and same element
layout. That's weaker than checking that the array elements have
the right type, because an `eq?` check at the ctype layer seems
too strong, and the ctype API doesn't provide enough information
for a more flexible equality.
2016-05-10 10:56:32 -06:00
Matthew Flatt
9046d30bcf fix grammar in docs for #%provide 2016-05-05 15:19:47 -06:00
Pedro Caldeira
551ef55535 Add examples for _enum and _bitmask usage. (Close #1317) 2016-05-02 11:21:22 -05:00
Robby Findler
244d9957f1 fix syntax error in flat-contract-with-reason docs 2016-05-01 06:27:44 -05:00
Robby Findler
999f026f55 add docs for flat-contract-with-explanation, clarify make-flat-contract docs
closes #1313, related to #1314
2016-04-30 21:06:41 -05:00
Robby Findler
9acd36724d clarify test argument to make-contract, make-chaperone-contract, and make-flat-contract
closes #1313
2016-04-30 21:06:41 -05:00
Matthew Flatt
99b3ed55be make syntax objects work as preserved syntax properties
Syntax objects generally make sense as properties in other syntax
objects, but they require special care when marshaling to bytecode
(as syntax objects do in general). To make that special handling
possible and reliable, constrain the shape of allowed values.
2016-04-26 10:18:46 -06:00
Leif Andersen
f549724e36 Updated scribble docs for make-constructor-style-printer
It should be using gen:custom-write rather than prop:custom-write.
2016-04-25 19:18:11 -04:00
Vincent St-Amour
264a11f899 Add procedure-impersonator*?.
Mostly useful to determine whether using `unsafe-chaperone-procedure` is ok.
2016-04-25 15:41:19 -05:00
Matthew Flatt
1381b3ca36 correct and improve docs on number printing 2016-04-25 10:07:32 -06:00