Re: [racket-dev] request to move cfg-parser from algol60 into parser-tools

2013-01-03 Thread Robby Findler
Sounds great to me!

Robby


On Thu, Jan 3, 2013 at 10:20 PM, Danny Yoo  wrote:

> On Thu, Jan 3, 2013 at 8:01 PM, Robby Findler
>  wrote:
> > Is the documentation and testing sufficient?
>
> There's no documentation yet, and no, there needs to be a bit more
> testing.  cfg-parser's interface is the same as that in
> parser-tools/yacc, so I can borrow from the prose there.  But as for
> errors: I've found a few inputs into cfg-parser that provide less than
> great error messages, so I can work on improving that and adding
> appropriate test cases.
>
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] request to move cfg-parser from algol60 into parser-tools

2013-01-03 Thread Danny Yoo
On Thu, Jan 3, 2013 at 8:01 PM, Robby Findler
 wrote:
> Is the documentation and testing sufficient?

There's no documentation yet, and no, there needs to be a bit more
testing.  cfg-parser's interface is the same as that in
parser-tools/yacc, so I can borrow from the prose there.  But as for
errors: I've found a few inputs into cfg-parser that provide less than
great error messages, so I can work on improving that and adding
appropriate test cases.
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] Inferring numeric function types from representative argument values

2013-01-03 Thread Neil Toronto
I thought it would be helpful to find the most precise types possible 
for numeric functions. I wrote a program that infers them using a few 
thousand representative argument values, which have been chosen to 
exhibit underflow, overflow, exactness preservation (e.g. perfect 
squares for `sqrt' and 1 for `log'), and every special value. It's here:



https://raw.github.com/ntoronto/plt-stuff/master/typed-racket/infer-numeric-types.rkt

I've already used it to find two errors:

 1. Implementation of `sqrt': most Single-Float-Complex inputs yield
Float-Complex outputs. The type is sane, but the behavior isn't:

> (sqrt 1.0f0+5.2f0i)
- : Single-Flonum-Complex
1.7741590586312472+1.465482980223009i

 2. Type of `expt'. The behavior looks crazy but is arguably correct
(it's a generalization of the IEEE/ISO standard to exact arguments):

> (expt 1 +nan.0)
- : Flonum [generalized from Positive-Flonum]
1

Inference generalizes return types a little (PosRatNotInt to PosRat, for 
example), joins function types with the same return type, compresses 
unions of products, and names common union types. It doesn't construct a 
monotone `case->' type by computing a cumulative union, nor does it 
differentiate between One, Byte, Index, Fixnum, and Integer. Sam or 
Vincent could do those two things better than I can. (In particular, 
platform-independent Index and Fixnum types scare me.)


If you run the program as-is, it'll infer types for `sqrt', print them 
simplified/compressed, and then dump all the input/output pairs that 
caused it to infer Single-Float-Complex -> Float-Complex (error #1 
above). If you want it to infer types for `expt', uncomment a 
conspicuous line near the end, and be prepared to wait while it runs.


It would be a good idea to use something like this for automated 
testing, at least for unary functions. Binary functions take a few 
minutes each, to test about 40 million argument pairs.


It would be a bad idea to use the inferred types directly, without human 
intervention and tweaking. They're not quite precise enough (no (One -> 
One) type for `sqrt', for example), and I'm not fully convinced the 
argument values are representative.


They should be pretty close to representative, though, enough to find 
more errors in Racket's basic math functions and their types (if any), 
to tighten up some of the types, and maybe take some of the load off 
Vincent when he goes debugging.


Neil ⊥
_
 Racket Developers list:
 http://lists.racket-lang.org/dev


Re: [racket-dev] request to move cfg-parser from algol60 into parser-tools

2013-01-03 Thread Robby Findler
Is the documentation and testing sufficient?

Robby


On Thu, Jan 3, 2013 at 9:56 PM, Danny Yoo  wrote:

> I would like to move cfg-parser, which currently exists in the algol60
> collection, into parser-tools proper.  That way, my 'ragg' package can
> refer to it from there.  Is this ok?
> _
>   Racket Developers list:
>   http://lists.racket-lang.org/dev
>
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] request to move cfg-parser from algol60 into parser-tools

2013-01-03 Thread Danny Yoo
I would like to move cfg-parser, which currently exists in the algol60
collection, into parser-tools proper.  That way, my 'ragg' package can
refer to it from there.  Is this ok?
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] case-> and for/sum:

2013-01-03 Thread Neil Toronto
I solved it by not using `for/sum' and writing this ridiculous function 
for the recursive base case and the initial values in `x':


  (: zero-of (case-> (Real -> Real)
 (Number -> Number)))
  (define (zero-of x) 0)

Fortunately, it should get inlined. I also renamed `U' to `V', because 
it was overshadowing the type name.


(define matrix-solve-upper
  ; solve the equation Ux=b
  ; using back substitution
  (case-lambda
[(V b)
 (define (default-fail)
   (raise-argument-error
'matrix-solve-upper
"The upper triangular matrix is not invertible." 0 V))
 (matrix-solve-upper V b default-fail)]
[(V b fail)
 (define zero (zero-of (matrix-ref V 0 0)))
 (define m (matrix-num-rows V))
 (define x (make-vector m zero))
 (for ([i (in-range (- m 1) -1 -1)])
   (define bi (matrix-ref b i 0))
   (define Vii (matrix-ref V i i))
   (when (zero? Vii) (fail))
   (let loop ([j  (+ i 1)] [s  zero])
 (cond [(j . < . m)
(loop (+ j 1) (+ s (* (matrix-ref V i j)
  (vector-ref x j]
   [else
(vector-set! x i (/ (- bi s) Vii))])))
 (vector->matrix m 1 x)]))

Neil ⊥

On 01/03/2013 10:47 AM, Jens Axel Søgaard wrote:

Ignore the previous example. Here is the example again, now
with correct usage of case-lambda. The for/sum problem remains.

/Jens Axel


#lang typed/racket
(require math)

(: matrix-solve-upper
(All (A) (case->
  ((Matrix Real)   (Matrix Real)  -> (Matrix Real))
  ((Matrix Real)   (Matrix Real)   (-> A) -> (U A (Matrix Real)))
  ((Matrix Number) (Matrix Number)-> (Matrix Number))
  ((Matrix Number) (Matrix Number) (-> A) -> (U A (Matrix
Number))
(define matrix-solve-upper
   ; solve the equation Ux=b
   ; using back substitution
   (case-lambda
 [(U b)
  (define (default-fail)
(raise-argument-error
 'matrix-solve-upper
 "The upper triangular matrix is not invertible." 0 U))
  (matrix-solve-upper U b default-fail)]
 [(U b fail)
   (define m (matrix-num-rows U))
   (define x (make-vector m 0))
   (for ([i (in-range (- m 1) -1 -1)])
 (define bi (matrix-ref b i 0))
 (define Uii (matrix-ref U i i))
 (when (zero? Uii) (fail))
 (define x.Ui (for/sum ([j (in-range (+ i 1) m)])
(* (matrix-ref U i j) (vector-ref x j
 (vector-set! x i (/ (- bi x.Ui) Uii)))
   (vector->matrix m 1 x)]))

  (define U (matrix [[4 -1 2  3]
 [0 -2 7 -4]
 [0  0 6  5]
 [0  0 0  3]]))
  (define b (col-matrix [20 -7 4 6]))
  b ; expected
  (define x (solve-upper-triangular U b))
  (matrix* U x)
_
   Racket Developers list:
   http://lists.racket-lang.org/dev



_
 Racket Developers list:
 http://lists.racket-lang.org/dev


Re: [racket-dev] Five feature/limitation interactions conspire to drive mad

2013-01-03 Thread Vincent St-Amour
At Wed, 02 Jan 2013 16:57:39 -0700,
Neil Toronto wrote:
> 
> On 01/02/2013 02:51 PM, Vincent St-Amour wrote:
> > In your experience, have these types caused you trouble other than when
> > you went looking for them specifically?
> 
> Not that I recall. If I stick to union types like Integer, 
> Exact-Rational, Flonum, Real, and Number, they don't often show up. I 
> expect generalization and covariance have a lot to do with it.

Great!

> Of course, these types caused me trouble immediately because I went 
> looking for them immediately, to get optimizations. It's a happy 
> accident that always using Index for bounds and bounds-checked values 
> works out so well. (Unless you planned it?)

That's the reason I added `Index'. Without it, fixnum optimizations
would have been pretty much impossible.

> >> This brings me to what I think is the major issue for us n00bs: the
> >> types force you to understand the numeric tower really well if you want
> >> to use types more precise than `Number'. Before you reach that level of
> >> understanding, though, and Typed Racket spits errors at you, it's hard
> >> to tell whether it has a legitimate complaint - especially when you
> >> don't know whether you should expect, say, (i . fx> . 0) to prove i :
> >> Positive-Index.
> >
> > Were there specific corners of the tower that you found frustrating
> > (other than fixnum types)?
> 
> Mostly `sqrt' and `log', when it's hard to prove their arguments are 
> nonnegative. I've gotten around it using `flsqrt' and `fllog'. I was 
> usually working with flonums anyway.

Yep, that's a good workaround (which OC recommends). It would be nice to
also have specialized versions of `sqrt', `log' and co that accept
reals, but raise exceptions instead of returning complex results.

They would still have to internally check for sign before calling `sqrt'
(or `real?' after, if we optimistically call `sqrt'), so they may not be
any faster than doing it inline in user code, but they may still be
convenient.

Would it make sense to provide something like that as part of the math
library?

> One that has bugged me recently is that TR can't prove (* x (conjugate 
> x)) : Nonnegative-Real. I have no idea how you'd do it without turning 
> Number into a product type, though.

With richer types for complexes, this could be expressible. But it would
require duplicating the numeric tower for each component, which would
get very complicated (and slow down typechecking) very fast. We thought
about doing it, but quickly decided against it. The costs clearly
outweight the benefits.

> I almost forgot this one:
> 
>> (/ (ann 5 Nonnegative-Real) (ann 3 Nonnegative-Real))
>- : Real
>1 2/3

That one is by design.

-> (/ (ann +inf.0 Nonnegative-Real) (ann -0.0 Nonnegative-Real))
- : Real
-inf.0

Considering all the floating-point zeroes to be non-negative (and
non-positive) helps with closure properties, but does cause some
unexpected corner cases. We've thought about that one for a while, and I
think it's the right compromise.

> If you want more, you can grep for `assert' in the math library.

I will, thanks!

> >> But it's often really hard to prove that something is nonnegative
> >> without an explicit cast, assertion, or test, and thus stay within the
> >> reals in expressions with roots.
> >
> > I actually see that as a positive: if a property is too hard to prove
> > using the type system alone, you have the option to use casts,
> > assertions, or tests to help TR prove what you want [1]. Casts,
> > assertions and tests give you extra power to prove things that you
> > couldn't prove otherwise, or to make proofs easier.
> 
> We should differentiate between what *I* can prove and what *Typed 
> Racket* can prove. I can usually prove more.

Right. Replace "prove" with "make TR prove" in what I said.

Thanks again for the feedback!

Vincent
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Attempted clarification for planet2 docs

2013-01-03 Thread John Clements

On Jan 3, 2013, at 6:36 AM, Matthew Flatt wrote:

> I went to fix a typo (`tech' to `racket') and ended up moving and
> tweaking the text. I hope the changes are ok.
> 
> I like the way the example distinguishes the package name, collection
> name, and library name, and so I added a sentence to explicitly note
> that `require' lines don't refer to packages. Then again, it also
> seemed worth nothing that a package will often supply a collection
> whose name matches the package.

Many thanks. My intent was to provide a starting point, and to encourage others 
to fill in details.

John

> 
> At Wed, 2 Jan 2013 14:03:45 -0700, Jay McCarthy wrote:
>> Sounds fine. John's original language seems like that and is good to me.
>> 
>> 
>> On Wed, Jan 2, 2013 at 1:59 PM, Carl Eastlund  wrote:
>> 
>>> It doesn't need to be phrased as a comparison to Planet1, but it can be
>>> given as a reassurance that this "package system" thingy does not add any
>>> baggage to require lines.
>>> 
>>> Carl Eastlund
>>> 
>>> 
>>> On Wed, Jan 2, 2013 at 3:49 PM, Jay McCarthy wrote:
>>> 
 I agree in that context that it is useful as a part of the "What's
 different about Planet 2?" And it's there (question 6).
 
 But, in the context of a new Racket user learning about packages, I don't
 see a reason to add the baggage of how it's different than some system
 they've never used.
 
 Jay
 
 
 On Wed, Jan 2, 2013 at 1:40 PM, Carl Eastlund  wrote:
 
> There _is_ reason to think these modules are different, because they
> were different in Planet1.  I've had to remind myself several times that
> Planet2 packages don't have special require forms, and that's just during
> discussions -- I haven't even been writing code with them yet.  Clarifying
> that Planet2 simplifies the require lines, and makes user packages on a
> peer level with built-in collections, is a useful thing to put early on in
> the Planet2 docs.
> 
> Carl Eastlund
> 
> 
> On Wed, Jan 2, 2013 at 3:27 PM, Jay McCarthy 
> wrote:
> 
>> The documentation already says "A package is a set of modules for some
>> number of collections." And there's no reason to think that these modules
>> are different from other modules, so I don't see why we need to point out
>> that they are required like all other modules are.
>> 
>> If you think it's very confusing, then feel free to push the commit
>> with two small changes:
>> 
>> 1. The docs don't use the term "planet2", so just say "the Racket
>> package manager"
>> 
>> 2. Consider using the same examples from the rest of the docs (such as
>> data/matrix from tic-tac-toe)
>> 
>> Jay
>> 
>> 
>> 
>> On Wed, Jan 2, 2013 at 12:30 PM, John Clements <
>> cleme...@brinckerhoff.org> wrote:
>> 
>>> As I was trying to assembly my first planet2 package, I found myself
>>> wondering how exactly to 'require' modules associated with planet2
>>> packages. My initial assumption (require them like any other collection
>>> containing modules) turned out to be correct, but there was a period 
>>> when 
>> I
>>> doubted this, and I think it should be documented.
>>> 
>>> Below is a proposed doc change; I'll commit it if you like it, or
>>> abandon it if not. I'm including the (git format-patch) text and also
>>> attaching it as a file.
>>> 
>>> John
>>> 
>>> 
>>> 
 From d3f72c47820effb240532c518378dc9709d69600 Mon Sep 17 00:00:00 2001
>>> From: John Clements 
>>> Date: Tue, 1 Jan 2013 10:40:40 -0800
>>> Subject: [PATCH] added docs on requiring planet2 modules
>>> 
>>> ---
>>> collects/planet2/scribblings/planet2.scrbl |   14 ++
>>> 1 files changed, 14 insertions(+), 0 deletions(-)
>>> 
>>> diff --git a/collects/planet2/scribblings/planet2.scrbl
>>> b/collects/planet2/scribblings/planet2.scrbl
>>> index e9e565a..81d6e58 100644
>>> --- a/collects/planet2/scribblings/planet2.scrbl
>>> +++ b/collects/planet2/scribblings/planet2.scrbl
>>> @@ -200,6 +200,20 @@ imply a change in the @tech{checksum}.
>>> 
>>> @section{Using Packages}
>>> 
>>> +Modules installed using planet2 may be @tech{require}d like any other
>>> +modules. For instance, if the package @pkgname{recipes} contains
>>> +the module file  @filepath{vegan/fruitsalad.rkt}, then package users
>>> +who have this package installed may evaluate
>>> +
>>> +@racketblock[(require vegan/fruitsalad)]
>>> +
>>> +...to require this module.
>>> +
>>> +@; 
>>> +
>>> +@section{Managing Packages}
>>> +
>>> +
>>> The Racket package manager has two user interfaces: a command line
>>> @exec{raco}
>>> sub-command and a library. They have the exact same capabilities, as
>>> the command li

Re: [racket-dev] case-> and for/sum:

2013-01-03 Thread Jens Axel Søgaard
Ignore the previous example. Here is the example again, now
with correct usage of case-lambda. The for/sum problem remains.

/Jens Axel


#lang typed/racket
(require math)

(: matrix-solve-upper
   (All (A) (case->
 ((Matrix Real)   (Matrix Real)  -> (Matrix Real))
 ((Matrix Real)   (Matrix Real)   (-> A) -> (U A (Matrix Real)))
 ((Matrix Number) (Matrix Number)-> (Matrix Number))
 ((Matrix Number) (Matrix Number) (-> A) -> (U A (Matrix
Number))
(define matrix-solve-upper
  ; solve the equation Ux=b
  ; using back substitution
  (case-lambda
[(U b)
 (define (default-fail)
   (raise-argument-error
'matrix-solve-upper
"The upper triangular matrix is not invertible." 0 U))
 (matrix-solve-upper U b default-fail)]
[(U b fail)
  (define m (matrix-num-rows U))
  (define x (make-vector m 0))
  (for ([i (in-range (- m 1) -1 -1)])
(define bi (matrix-ref b i 0))
(define Uii (matrix-ref U i i))
(when (zero? Uii) (fail))
(define x.Ui (for/sum ([j (in-range (+ i 1) m)])
   (* (matrix-ref U i j) (vector-ref x j
(vector-set! x i (/ (- bi x.Ui) Uii)))
  (vector->matrix m 1 x)]))

 (define U (matrix [[4 -1 2  3]
[0 -2 7 -4]
[0  0 6  5]
[0  0 0  3]]))
 (define b (col-matrix [20 -7 4 6]))
 b ; expected
 (define x (solve-upper-triangular U b))
 (matrix* U x)
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] TR: case-> and for/sum:

2013-01-03 Thread Jens Axel Søgaard
Apropos the discussion on porting from Racket to Typed Racket.
The following snippet was written in Racket, and now I want
to add types.

The problem is that I have used for/sum and due to the case->
I can't see how to change the for/sum to a for/sum: .

/Jens Axel

#lang typed/racket
(require math)

(: matrix-solve-upper
   (All (A) (case->
 ((Matrix Real)   (Matrix Real)  -> (Matrix Real))
 ((Matrix Real)   (Matrix Real)   (-> A) -> (U A (Matrix Real)))
 ((Matrix Number) (Matrix Number)-> (Matrix Number))
 ((Matrix Number) (Matrix Number) (-> A) -> (U A (Matrix
Number))
(define (matrix-solve-upper U b)
  (define (default-fail)
(raise-argument-error 'matrix-solve-upper
  "The upper triangular matrix is not invertible." 0 U))
  ; solve the equation Ux=b
  ; using back substitution
  (case-lambda
[(U b) (matrix-solve-upper U b default-fail)]
[(U b fail)
 (define m (matrix-num-rows U))
 (define x (make-vector m 0))
 (for ([i (in-range (- m 1) -1 -1)])
   (define bi (matrix-ref b i 0))
   (define Uii (matrix-ref U i i))
   (when (zero? Uii) (fail))
   (define x.Ui (for/sum ([j (in-range (+ i 1) m)])
  (* (matrix-ref U i j) (vector-ref x j
   (vector-set! x i (/ (- bi x.Ui) Uii)))
 (vector->matrix m 1 x)]))

(define U (matrix [[4 -1 2  3]
   [0 -2 7 -4]
   [0  0 6  5]
   [0  0 0  3]]))
(define b (col-matrix [20 -7 4 6]))
b ; expected
(define x (solve-upper-triangular U b))
(matrix* U x)
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Attempted clarification for planet2 docs

2013-01-03 Thread Jay McCarthy
Looks great to me.


On Thu, Jan 3, 2013 at 7:36 AM, Matthew Flatt  wrote:

> I went to fix a typo (`tech' to `racket') and ended up moving and
> tweaking the text. I hope the changes are ok.
>
> I like the way the example distinguishes the package name, collection
> name, and library name, and so I added a sentence to explicitly note
> that `require' lines don't refer to packages. Then again, it also
> seemed worth nothing that a package will often supply a collection
> whose name matches the package.
>
> At Wed, 2 Jan 2013 14:03:45 -0700, Jay McCarthy wrote:
> > Sounds fine. John's original language seems like that and is good to me.
> >
> >
> > On Wed, Jan 2, 2013 at 1:59 PM, Carl Eastlund  wrote:
> >
> > > It doesn't need to be phrased as a comparison to Planet1, but it can be
> > > given as a reassurance that this "package system" thingy does not add
> any
> > > baggage to require lines.
> > >
> > > Carl Eastlund
> > >
> > >
> > > On Wed, Jan 2, 2013 at 3:49 PM, Jay McCarthy  >wrote:
> > >
> > >> I agree in that context that it is useful as a part of the "What's
> > >> different about Planet 2?" And it's there (question 6).
> > >>
> > >> But, in the context of a new Racket user learning about packages, I
> don't
> > >> see a reason to add the baggage of how it's different than some system
> > >> they've never used.
> > >>
> > >> Jay
> > >>
> > >>
> > >> On Wed, Jan 2, 2013 at 1:40 PM, Carl Eastlund 
> wrote:
> > >>
> > >>> There _is_ reason to think these modules are different, because they
> > >>> were different in Planet1.  I've had to remind myself several times
> that
> > >>> Planet2 packages don't have special require forms, and that's just
> during
> > >>> discussions -- I haven't even been writing code with them yet.
>  Clarifying
> > >>> that Planet2 simplifies the require lines, and makes user packages
> on a
> > >>> peer level with built-in collections, is a useful thing to put early
> on in
> > >>> the Planet2 docs.
> > >>>
> > >>> Carl Eastlund
> > >>>
> > >>>
> > >>> On Wed, Jan 2, 2013 at 3:27 PM, Jay McCarthy  >wrote:
> > >>>
> >  The documentation already says "A package is a set of modules for
> some
> >  number of collections." And there's no reason to think that these
> modules
> >  are different from other modules, so I don't see why we need to
> point out
> >  that they are required like all other modules are.
> > 
> >  If you think it's very confusing, then feel free to push the commit
> >  with two small changes:
> > 
> >  1. The docs don't use the term "planet2", so just say "the Racket
> >  package manager"
> > 
> >  2. Consider using the same examples from the rest of the docs (such
> as
> >  data/matrix from tic-tac-toe)
> > 
> >  Jay
> > 
> > 
> > 
> >  On Wed, Jan 2, 2013 at 12:30 PM, John Clements <
> >  cleme...@brinckerhoff.org> wrote:
> > 
> > > As I was trying to assembly my first planet2 package, I found
> myself
> > > wondering how exactly to 'require' modules associated with planet2
> > > packages. My initial assumption (require them like any other
> collection
> > > containing modules) turned out to be correct, but there was a
> period when
> > I
> > > doubted this, and I think it should be documented.
> > >
> > > Below is a proposed doc change; I'll commit it if you like it, or
> > > abandon it if not. I'm including the (git format-patch) text and
> also
> > > attaching it as a file.
> > >
> > > John
> > >
> > >
> > >
> > > >From d3f72c47820effb240532c518378dc9709d69600 Mon Sep 17 00:00:00
> 2001
> > > From: John Clements 
> > > Date: Tue, 1 Jan 2013 10:40:40 -0800
> > > Subject: [PATCH] added docs on requiring planet2 modules
> > >
> > > ---
> > >  collects/planet2/scribblings/planet2.scrbl |   14 ++
> > >  1 files changed, 14 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/collects/planet2/scribblings/planet2.scrbl
> > > b/collects/planet2/scribblings/planet2.scrbl
> > > index e9e565a..81d6e58 100644
> > > --- a/collects/planet2/scribblings/planet2.scrbl
> > > +++ b/collects/planet2/scribblings/planet2.scrbl
> > > @@ -200,6 +200,20 @@ imply a change in the @tech{checksum}.
> > >
> > >  @section{Using Packages}
> > >
> > > +Modules installed using planet2 may be @tech{require}d like any
> other
> > > +modules. For instance, if the package @pkgname{recipes} contains
> > > +the module file  @filepath{vegan/fruitsalad.rkt}, then package
> users
> > > +who have this package installed may evaluate
> > > +
> > > +@racketblock[(require vegan/fruitsalad)]
> > > +
> > > +...to require this module.
> > > +
> > > +@; 
> > > +
> > > +@section{Managing Packages}
> > > +
> > > +
> > >  The Racket package manager has two user interfaces: a command line

Re: [racket-dev] Attempted clarification for planet2 docs

2013-01-03 Thread Matthew Flatt
I went to fix a typo (`tech' to `racket') and ended up moving and
tweaking the text. I hope the changes are ok.

I like the way the example distinguishes the package name, collection
name, and library name, and so I added a sentence to explicitly note
that `require' lines don't refer to packages. Then again, it also
seemed worth nothing that a package will often supply a collection
whose name matches the package.

At Wed, 2 Jan 2013 14:03:45 -0700, Jay McCarthy wrote:
> Sounds fine. John's original language seems like that and is good to me.
> 
> 
> On Wed, Jan 2, 2013 at 1:59 PM, Carl Eastlund  wrote:
> 
> > It doesn't need to be phrased as a comparison to Planet1, but it can be
> > given as a reassurance that this "package system" thingy does not add any
> > baggage to require lines.
> >
> > Carl Eastlund
> >
> >
> > On Wed, Jan 2, 2013 at 3:49 PM, Jay McCarthy wrote:
> >
> >> I agree in that context that it is useful as a part of the "What's
> >> different about Planet 2?" And it's there (question 6).
> >>
> >> But, in the context of a new Racket user learning about packages, I don't
> >> see a reason to add the baggage of how it's different than some system
> >> they've never used.
> >>
> >> Jay
> >>
> >>
> >> On Wed, Jan 2, 2013 at 1:40 PM, Carl Eastlund  wrote:
> >>
> >>> There _is_ reason to think these modules are different, because they
> >>> were different in Planet1.  I've had to remind myself several times that
> >>> Planet2 packages don't have special require forms, and that's just during
> >>> discussions -- I haven't even been writing code with them yet.  Clarifying
> >>> that Planet2 simplifies the require lines, and makes user packages on a
> >>> peer level with built-in collections, is a useful thing to put early on in
> >>> the Planet2 docs.
> >>>
> >>> Carl Eastlund
> >>>
> >>>
> >>> On Wed, Jan 2, 2013 at 3:27 PM, Jay McCarthy 
> >>> wrote:
> >>>
>  The documentation already says "A package is a set of modules for some
>  number of collections." And there's no reason to think that these modules
>  are different from other modules, so I don't see why we need to point out
>  that they are required like all other modules are.
> 
>  If you think it's very confusing, then feel free to push the commit
>  with two small changes:
> 
>  1. The docs don't use the term "planet2", so just say "the Racket
>  package manager"
> 
>  2. Consider using the same examples from the rest of the docs (such as
>  data/matrix from tic-tac-toe)
> 
>  Jay
> 
> 
> 
>  On Wed, Jan 2, 2013 at 12:30 PM, John Clements <
>  cleme...@brinckerhoff.org> wrote:
> 
> > As I was trying to assembly my first planet2 package, I found myself
> > wondering how exactly to 'require' modules associated with planet2
> > packages. My initial assumption (require them like any other collection
> > containing modules) turned out to be correct, but there was a period 
> > when 
> I
> > doubted this, and I think it should be documented.
> >
> > Below is a proposed doc change; I'll commit it if you like it, or
> > abandon it if not. I'm including the (git format-patch) text and also
> > attaching it as a file.
> >
> > John
> >
> >
> >
> > >From d3f72c47820effb240532c518378dc9709d69600 Mon Sep 17 00:00:00 2001
> > From: John Clements 
> > Date: Tue, 1 Jan 2013 10:40:40 -0800
> > Subject: [PATCH] added docs on requiring planet2 modules
> >
> > ---
> >  collects/planet2/scribblings/planet2.scrbl |   14 ++
> >  1 files changed, 14 insertions(+), 0 deletions(-)
> >
> > diff --git a/collects/planet2/scribblings/planet2.scrbl
> > b/collects/planet2/scribblings/planet2.scrbl
> > index e9e565a..81d6e58 100644
> > --- a/collects/planet2/scribblings/planet2.scrbl
> > +++ b/collects/planet2/scribblings/planet2.scrbl
> > @@ -200,6 +200,20 @@ imply a change in the @tech{checksum}.
> >
> >  @section{Using Packages}
> >
> > +Modules installed using planet2 may be @tech{require}d like any other
> > +modules. For instance, if the package @pkgname{recipes} contains
> > +the module file  @filepath{vegan/fruitsalad.rkt}, then package users
> > +who have this package installed may evaluate
> > +
> > +@racketblock[(require vegan/fruitsalad)]
> > +
> > +...to require this module.
> > +
> > +@; 
> > +
> > +@section{Managing Packages}
> > +
> > +
> >  The Racket package manager has two user interfaces: a command line
> > @exec{raco}
> >  sub-command and a library. They have the exact same capabilities, as
> >  the command line interface invokes the library functions and
> > --
> > 1.7.7.5 (Apple Git-26)
> >
> >
> >
> 
> 
>  --
>  Jay McCarthy 
>  Assistant Professor / Brigham Young Universit