Re: [racket-dev] Math library pushed

2012-11-16 Thread Ray Racine
>From the cheap seats.  Built clean.  Except for warning below.  Test failed
as libffi as initially was not found by the dynamic load.   After adjusting
version in mpfr.rkt.   Test produced pi ... 4888

Applicable lib version on Ubuntu 12.10.
/usr/lib/x86_64-linux-gnu/libmpfr.so.4
/usr/lib/x86_64-linux-gnu/libmpfr.so.4.1.0


raco setup: WARNING: undefined tag in math/scribblings/math.scrbl:
raco setup:  ((lib "math/main.rkt") dist-pdf)
raco setup:  ((lib "math/main.rkt") untyped-prev-prime)
raco setup:  ((lib "math/main.rkt") factorial)
raco setup:  ((lib "math/main.rkt") mod)
raco setup:  ((lib "math/main.rkt") beta-dist)
raco setup:  ((lib "math/main.rkt") untyped-next-prime)
raco setup:  ((lib "math/main.rkt") gamma-dist)
raco setup:  ((lib "math/main.rkt") flexpt1p)
raco setup:  ((lib "math/main.rkt") normal-dist)






On Fri, Nov 16, 2012 at 1:59 PM, Neil Toronto wrote:

> I've just made the initial commit for the math library. You will all
> notice the build time increase. Some will notice that "(require math)"
> imports a bunch of goodies that Racket didn't have before.
>
> About half is documented so far, and half has coverage in the test cases.
> Some things are known to be broken, but not many. The most egregious, which
> needs to be fixed very soon, is this one:
>
>   *
>
>   Because of recent changes to how Typed Racket deals with Any types at
>   the contract boundary, typed/rackunit cannot now test higher-order
>   values, such as arrays.
>
>   *
>
> A practical consequence is that "math/tests/array-tests.rkt" simply
> doesn't run.
>
> One thing I'm not sure of is whether the FFI to libmpfr works on all our
> supported platforms. Could I have all the devs run the following program
> after your next compile?
>
>   #lang racket
>   (require math/bigfloat)
>
>   (parameterize ([bf-precision 8192])
> pi.bf)
>
> Then reply with the last four digits printed. They should be "4888". If
> the program doesn't run because Racket can't load libmpfr, it's an
> opportunity to test the documentation. Please see if I've made the docs for
> the `math/bigfloat' module clear enough to help you fix the problem.
>
> Thanks!
>
> Neil ⊥
> _
>  Racket Developers list:
>  http://lists.racket-lang.org/**dev 
>
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Math library pushed

2012-11-16 Thread Matthew Flatt
I'll add version numbers along with other changes.

At Fri, 16 Nov 2012 18:26:20 -0500, Ryan Culpepper wrote:
> I get this message (during doc build, actually):
> 
> raco setup: error running: (lib math/scribblings/math.scrbl)
> ffi-lib: couldn't open "libmpfr.so" (libmpfr.so: cannot open shared 
> object file: No such file or directory)
> 
> I have /usr/lib/libmpfr.so.1, which is symlinked to 
> /usr/lib/libmpfr.so.1.2.2. I expect that libmpfr.so (no version number) 
> is provided by the development package.
> 
> I changed math/private/bigfloat/mpfr.rkt to use the following lines instead:
> 
> (define libgmp (lazy (ffi-lib "libgmp" '("" "3") #:get-lib-dirs 
> get-lib-dirs)))
> (define libmpfr (lazy (ffi-lib "libmpfr" '("" "1") #:get-lib-dirs 
> get-lib-dirs)))
> 
> (Running 32-bit Ubuntu 10.04.4)
> 
> When I run the test file with the changes, it works, and the last four 
> digits are "4888" as expected.
> 
> Looks like my work machine (64-bit Ubuntu 12.10) has libmpfr.so.4 and 
> libgmp.so.10. I haven't run the test program there yet.
> 
> Ryan
> 
> 
> On 11/16/2012 01:59 PM, Neil Toronto wrote:
> > [...]
> > One thing I'm not sure of is whether the FFI to libmpfr works on all our
> > supported platforms. Could I have all the devs run the following program
> > after your next compile?
> >
> >#lang racket
> >(require math/bigfloat)
> >
> >(parameterize ([bf-precision 8192])
> >  pi.bf)
> >
> > Then reply with the last four digits printed. They should be "4888". If
> > the program doesn't run because Racket can't load libmpfr, it's an
> > opportunity to test the documentation. Please see if I've made the docs
> > for the `math/bigfloat' module clear enough to help you fix the problem.
> >
> > Thanks!
> >
> > Neil ⊥
> > _
> >   Racket Developers list:
> >   http://lists.racket-lang.org/dev
> 
> _
>   Racket Developers list:
>   http://lists.racket-lang.org/dev

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


Re: [racket-dev] Math library pushed

2012-11-16 Thread Ryan Culpepper

I get this message (during doc build, actually):

raco setup: error running: (lib math/scribblings/math.scrbl)
ffi-lib: couldn't open "libmpfr.so" (libmpfr.so: cannot open shared 
object file: No such file or directory)


I have /usr/lib/libmpfr.so.1, which is symlinked to 
/usr/lib/libmpfr.so.1.2.2. I expect that libmpfr.so (no version number) 
is provided by the development package.


I changed math/private/bigfloat/mpfr.rkt to use the following lines instead:

(define libgmp (lazy (ffi-lib "libgmp" '("" "3") #:get-lib-dirs 
get-lib-dirs)))
(define libmpfr (lazy (ffi-lib "libmpfr" '("" "1") #:get-lib-dirs 
get-lib-dirs)))


(Running 32-bit Ubuntu 10.04.4)

When I run the test file with the changes, it works, and the last four 
digits are "4888" as expected.


Looks like my work machine (64-bit Ubuntu 12.10) has libmpfr.so.4 and 
libgmp.so.10. I haven't run the test program there yet.


Ryan


On 11/16/2012 01:59 PM, Neil Toronto wrote:

[...]
One thing I'm not sure of is whether the FFI to libmpfr works on all our
supported platforms. Could I have all the devs run the following program
after your next compile?

   #lang racket
   (require math/bigfloat)

   (parameterize ([bf-precision 8192])
 pi.bf)

Then reply with the last four digits printed. They should be "4888". If
the program doesn't run because Racket can't load libmpfr, it's an
opportunity to test the documentation. Please see if I've made the docs
for the `math/bigfloat' module clear enough to help you fix the problem.

Thanks!

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


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


Re: [racket-dev] [plt] Push #25698: master branch updated

2012-11-16 Thread Neil Toronto

On 11/16/2012 03:31 PM, Ryan Culpepper wrote:

On 11/16/2012 04:43 PM, Neil Toronto wrote:

(FWIW, you're right about libmpfr not being needed at compile time.
Well, it shouldn't be. I used Eli's nifty interaction-fakery code forms
in the `math/bigfloat' docs, for example.)


If you made bigfloats serializable, you could also use
'make-log-based-eval' from unstable/sandbox as an alternative to
'eval:alts'.


I didn't know about this. Thanks!

Also, you're a friggin' genius. I know because I thought up exactly the 
same idea, but you actually went and made it.


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


Re: [racket-dev] [plt] Push #25698: master branch updated

2012-11-16 Thread Ryan Culpepper

On 11/16/2012 04:43 PM, Neil Toronto wrote:

On 11/16/2012 02:10 PM, mfl...@racket-lang.org wrote:

9a48e5d Matthew Flatt  2012-11-16 14:03
:
| math: avoid import at unnecessary phase
|
| This repair avoids using at compile time external libraries that
| are needed at run time.
:
   M collects/math/private/matrix/matrix-sequences.rkt | 4 +---

 >
 > [...]
 >

collects/math/private/matrix/matrix-sequences.rkt
~
--- OLD/collects/math/private/matrix/matrix-sequences.rkt
+++ NEW/collects/math/private/matrix/matrix-sequences.rkt
@@ -5,9 +5,7 @@
   in-column)

  (require math/array
- (except-in math/matrix in-row in-column)
- (for-syntax (except-in math/matrix in-row in-column))
- (for-template (except-in math/matrix in-row in-column)))
+ (except-in math/matrix in-row in-column))


Was this the only necessary change? If so, it's a little weird, because
libmpfr isn't supposed to be loaded until its first export is used. The
constants are all delayed (their names are bound to macros that expand
to uses of `force'), and every function and delay thunk is wrapped with
code that loads the external library. IOW, this:

   (require math/bigfloat)

doesn't load libmpfr, but this does:

   pi.bf

Also, I have no idea what it all has to do with a typed submodule in
"math/special-functions.rkt", which is apparently what the error was
complaining about. I can't work out the dependency chain. Help?

(FWIW, you're right about libmpfr not being needed at compile time.
Well, it shouldn't be. I used Eli's nifty interaction-fakery code forms
in the `math/bigfloat' docs, for example.)


If you made bigfloats serializable, you could also use 
'make-log-based-eval' from unstable/sandbox as an alternative to 
'eval:alts'.


Ryan

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


Re: [racket-dev] [plt] Push #25698: master branch updated

2012-11-16 Thread Neil Toronto

On 11/16/2012 03:02 PM, Matthew Flatt wrote:

At Fri, 16 Nov 2012 14:43:56 -0700, Neil Toronto wrote:

If so, it's a little weird, because
libmpfr isn't supposed to be loaded until its first export is used. The
constants are all delayed (their names are bound to macros that expand
to uses of `force'), and every function and delay thunk is wrapped with
code that loads the external library.


`math/private/flonum/expansion/expansion-log' has

  (define-values (log2-hi log2-lo) (bigfloat->fl2 log2.bf))


Oh, good catch. I can definitely identify that as a product of too many 
late nights. I'll push a fix. Thanks for yours!


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


Re: [racket-dev] [plt] Push #25698: master branch updated

2012-11-16 Thread Matthew Flatt
At Fri, 16 Nov 2012 14:43:56 -0700, Neil Toronto wrote:
> On 11/16/2012 02:10 PM, mfl...@racket-lang.org wrote:
> > 9a48e5d Matthew Flatt  2012-11-16 14:03
> > :
> > | math: avoid import at unnecessary phase
> > |
> > | This repair avoids using at compile time external libraries that
> > | are needed at run time.
> > :
> >M collects/math/private/matrix/matrix-sequences.rkt | 4 +---
>  >
>  > [...]
>  >
> > collects/math/private/matrix/matrix-sequences.rkt
> > ~
> > --- OLD/collects/math/private/matrix/matrix-sequences.rkt
> > +++ NEW/collects/math/private/matrix/matrix-sequences.rkt
> > @@ -5,9 +5,7 @@
> >in-column)
> >
> >   (require math/array
> > - (except-in math/matrix in-row in-column)
> > - (for-syntax (except-in math/matrix in-row in-column))
> > - (for-template (except-in math/matrix in-row in-column)))
> > + (except-in math/matrix in-row in-column))
> 
> Was this the only necessary change? 

Yes.

> If so, it's a little weird, because 
> libmpfr isn't supposed to be loaded until its first export is used. The 
> constants are all delayed (their names are bound to macros that expand 
> to uses of `force'), and every function and delay thunk is wrapped with 
> code that loads the external library.

`math/private/flonum/expansion/expansion-log' has

 (define-values (log2-hi log2-lo) (bigfloat->fl2 log2.bf))


> Also, I have no idea what it all has to do with a typed submodule in 
> "math/special-functions.rkt", which is apparently what the error was 
> complaining about. I can't work out the dependency chain. Help?

That was a Racket bug, now fixed.
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] [plt] Push #25698: master branch updated

2012-11-16 Thread Neil Toronto

On 11/16/2012 02:10 PM, mfl...@racket-lang.org wrote:

9a48e5d Matthew Flatt  2012-11-16 14:03
:
| math: avoid import at unnecessary phase
|
| This repair avoids using at compile time external libraries that
| are needed at run time.
:
   M collects/math/private/matrix/matrix-sequences.rkt | 4 +---

>
> [...]
>

collects/math/private/matrix/matrix-sequences.rkt
~
--- OLD/collects/math/private/matrix/matrix-sequences.rkt
+++ NEW/collects/math/private/matrix/matrix-sequences.rkt
@@ -5,9 +5,7 @@
   in-column)

  (require math/array
- (except-in math/matrix in-row in-column)
- (for-syntax (except-in math/matrix in-row in-column))
- (for-template (except-in math/matrix in-row in-column)))
+ (except-in math/matrix in-row in-column))


Was this the only necessary change? If so, it's a little weird, because 
libmpfr isn't supposed to be loaded until its first export is used. The 
constants are all delayed (their names are bound to macros that expand 
to uses of `force'), and every function and delay thunk is wrapped with 
code that loads the external library. IOW, this:


  (require math/bigfloat)

doesn't load libmpfr, but this does:

  pi.bf

Also, I have no idea what it all has to do with a typed submodule in 
"math/special-functions.rkt", which is apparently what the error was 
complaining about. I can't work out the dependency chain. Help?


(FWIW, you're right about libmpfr not being needed at compile time. 
Well, it shouldn't be. I used Eli's nifty interaction-fakery code forms 
in the `math/bigfloat' docs, for example.)


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


Re: [racket-dev] Math library pushed

2012-11-16 Thread Jens Axel Søgaard
A fix is even better!

Thanks,
Jens Axel


2012/11/16 Matthew Flatt :
> At Fri, 16 Nov 2012 21:21:29 +0100, Jens Axel Søgaard wrote:
>> 2012/11/16 Matthew Flatt :
>>
>> >  * require: unknown module
>> > module name: #> > "/Users/mflatt/proj/plt/collects/math/special-functions.rkt"
>> typed-module5)>
>> >
>> >So far, this one looks like a problem with finding a submodule in a
>> >".zo" file --- that is, a bug that I will have to track down and
>> >fix.
>>
>> This is the error, I ran into, when I tried to merge in documentation for the
>> number theory functions.
>>
>> Is there a workaround?
>
> Unfortunately, I don't see a workaround for older versions. I've fixed
> it in the current git master, though.
>



-- 
--
Jens Axel Søgaard

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


Re: [racket-dev] Math library pushed

2012-11-16 Thread Matthew Flatt
At Fri, 16 Nov 2012 21:21:29 +0100, Jens Axel Søgaard wrote:
> 2012/11/16 Matthew Flatt :
> 
> >  * require: unknown module
> > module name: # > "/Users/mflatt/proj/plt/collects/math/special-functions.rkt" 
> typed-module5)>
> >
> >So far, this one looks like a problem with finding a submodule in a
> >".zo" file --- that is, a bug that I will have to track down and
> >fix.
> 
> This is the error, I ran into, when I tried to merge in documentation for the
> number theory functions.
> 
> Is there a workaround?

Unfortunately, I don't see a workaround for older versions. I've fixed
it in the current git master, though.


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


Re: [racket-dev] Math library pushed

2012-11-16 Thread Jens Axel Søgaard
2012/11/16 Matthew Flatt :

>  * require: unknown module
> module name: # "/Users/mflatt/proj/plt/collects/math/special-functions.rkt" 
> typed-module5)>
>
>So far, this one looks like a problem with finding a submodule in a
>".zo" file --- that is, a bug that I will have to track down and
>fix.

This is the error, I ran into, when I tried to merge in documentation for the
number theory functions.

Is there a workaround?

-- 
Jens Axel Søgaard

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


Re: [racket-dev] Math library pushed

2012-11-16 Thread Matthew Flatt
I'm seeing two build problems on Mac OS X:

 * No "libmpfr.dylib"

   This looks like a problem with `math/private/matrix/matrix-sequences'
   importing `math/matrix' at too many phases. Removing the `for-syntax'
   and `for-template' imports let me get past this one.

   (I won't be able to run `math' libraries without "libmpfr.dylib",
   but I should be able to compile them.)

 * require: unknown module
module name: #

   So far, this one looks like a problem with finding a submodule in a
   ".zo" file --- that is, a bug that I will have to track down and
   fix.


At Fri, 16 Nov 2012 11:59:59 -0700, Neil Toronto wrote:
> I've just made the initial commit for the math library. You will all 
> notice the build time increase. Some will notice that "(require math)" 
> imports a bunch of goodies that Racket didn't have before.
> 
> About half is documented so far, and half has coverage in the test 
> cases. Some things are known to be broken, but not many. The most 
> egregious, which needs to be fixed very soon, is this one:
> 
>*
> 
>Because of recent changes to how Typed Racket deals with Any types at
>the contract boundary, typed/rackunit cannot now test higher-order
>values, such as arrays.
> 
>*
> 
> A practical consequence is that "math/tests/array-tests.rkt" simply 
> doesn't run.
> 
> One thing I'm not sure of is whether the FFI to libmpfr works on all our 
> supported platforms. Could I have all the devs run the following program 
> after your next compile?
> 
>#lang racket
>(require math/bigfloat)
> 
>(parameterize ([bf-precision 8192])
>  pi.bf)
> 
> Then reply with the last four digits printed. They should be "4888". If 
> the program doesn't run because Racket can't load libmpfr, it's an 
> opportunity to test the documentation. Please see if I've made the docs 
> for the `math/bigfloat' module clear enough to help you fix the problem.
> 
> Thanks!
> 
> Neil ⊥
> _
>   Racket Developers list:
>   http://lists.racket-lang.org/dev

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


Re: [racket-dev] Replacing the splay tree token-tree% with an rb-tree?

2012-11-16 Thread Robby Findler
On Fri, Nov 16, 2012 at 1:02 PM, Danny Yoo  wrote:
>
>> I wanted to surprise you by getting this all working by mid-week, but it's
>> taking longer than I thought... :)  So I might as well run it by you to make
>> sure the idea is sound before I go further on this track.
>
>
> The core rb implementation is almost done.  The search-by-position,
> insert-before, insert-after, and delete operations appear to be solid now.
> Hopefully I can get concat and split done by today (or tomorrow).
>
> There are some operations in the original token-tree% that aren't directly
> applicable to rb-trees.  In particular, I assume that the add-to-root-length
> and remove-root functions can be replaced with some alternative behavior
> that preserves the final effect on the editor state.  I should be able to
> simulate the splay tree's use of the root and replace that with a focused
> node in the rb tree.
>
> Is there a particular splay-tree property that we're really depending on?

I don't think so, but Im not the original author of this code.

> On the other hand, the rb implementation should support tree concatenation
> and in-place insertion, not limited just to inserting at the beginning and
> end of the tree.  (And concatenation of two trees is O(log(n)).  I'm not
> familiar enough with the lexer state management to know if these additional
> operations would be useful.

I don't really know either. I'm pretty sure concatenation is not useful, tho.

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


Re: [racket-dev] Replacing the splay tree token-tree% with an rb-tree?

2012-11-16 Thread Danny Yoo
> I wanted to surprise you by getting this all working by mid-week, but it's
> taking longer than I thought... :)  So I might as well run it by you to
> make sure the idea is sound before I go further on this track.
>

The core rb implementation is almost done.  The search-by-position,
insert-before, insert-after, and delete operations appear to be solid now.
 Hopefully I can get concat and split done by today (or tomorrow).

There are some operations in the original token-tree% that aren't directly
applicable to rb-trees.  In particular, I assume that the
add-to-root-length and remove-root functions can be replaced with some
alternative behavior that preserves the final effect on the editor state.
 I should be able to simulate the splay tree's use of the root and replace
that with a focused node in the rb tree.

Is there a particular splay-tree property that we're really depending on?

On the other hand, the rb implementation should support tree concatenation
and in-place insertion, not limited just to inserting at the beginning and
end of the tree.  (And concatenation of two trees is O(log(n)).  I'm not
familiar enough with the lexer state management to know if these additional
operations would be useful.
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] Math library pushed

2012-11-16 Thread Neil Toronto
I've just made the initial commit for the math library. You will all 
notice the build time increase. Some will notice that "(require math)" 
imports a bunch of goodies that Racket didn't have before.


About half is documented so far, and half has coverage in the test 
cases. Some things are known to be broken, but not many. The most 
egregious, which needs to be fixed very soon, is this one:


  *

  Because of recent changes to how Typed Racket deals with Any types at
  the contract boundary, typed/rackunit cannot now test higher-order
  values, such as arrays.

  *

A practical consequence is that "math/tests/array-tests.rkt" simply 
doesn't run.


One thing I'm not sure of is whether the FFI to libmpfr works on all our 
supported platforms. Could I have all the devs run the following program 
after your next compile?


  #lang racket
  (require math/bigfloat)

  (parameterize ([bf-precision 8192])
pi.bf)

Then reply with the last four digits printed. They should be "4888". If 
the program doesn't run because Racket can't load libmpfr, it's an 
opportunity to test the documentation. Please see if I've made the docs 
for the `math/bigfloat' module clear enough to help you fix the problem.


Thanks!

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