Re: [racket] Search & wrap

2015-02-24 Thread Jukka Tuominen
For example, if I had definitions spread across two files like follows... File1: (require file2) (define (times2 x) (* 2 x)) (define (my-times2power3+5 x) (+ 5 (times2 (power3 x File2: (define (power3 x) (* x x x)) --- Now calling the function (search&wrap 'my-times2power3+

Re: [racket] compiling Racket to android and ios apps

2015-02-24 Thread Neil Van Dyke
Jens Axel Søgaard wrote on 02/24/2015 05:01 PM: I see that the standard way of embedding Racket is via a dynamic library. Unfortunately, I wouldn't risk an important app to this Racket embedding approach without a *lot* of prior validation by someone else. (Seems like it might be begging for

Re: [racket] Bug with equal? and bit-vectors

2015-02-24 Thread Jens Axel Søgaard
Hi Eric, I vaguely remember this bug being fixed some time ago, and since I get #f on here on version 6.1.1.8 I suspect you can fix the problem by upgrading. Which version of Racket do you use? /Jens Axel 2015-02-24 23:01 GMT+01:00 Eric Dong : > It seems that bit-vectors have a really weird bu

[racket] racket-mode

2015-02-24 Thread Greg Hendershott
Just a heads-up on some progress with racket-mode over the last couple months: - Support for errortrace in error message stack traces. - A profile command that shows profile results in a major mode buffer and lets you view the source locations in the other window. You can also evaluate more e

Re: [racket] compiling Racket to android and ios apps

2015-02-24 Thread Jens Axel Søgaard
While reading "Embedding into a Program" http://docs.racket-lang.org/inside/embedding.html I see that the standard way of embedding Racket is via a dynamic library. Reading up on iOS and dynamic libraries I notice that dynamic libraries were not supported before iOS8 (on actual devices - I b

Re: [racket] Inconsistency of `in-range` and numerical issues

2015-02-24 Thread Steve Graham
While I don't doubt the facts presented below, it just seems wrong, notwithstanding what the standard states. MUMPS (http://en.wikipedia.org/wiki/MUMPS), my workday language for 30-some years, would never think of acting in such a manner: s sum=0 f i=1:1:8 s sum=sum+.1

[racket] Bug with equal? and bit-vectors

2015-02-24 Thread Eric Dong
It seems that bit-vectors have a really weird bug, where short bit-vectors that aren't equal will often return true when tested with equal?. Here's a trivial example: http://pasterack.org/pastes/35137 Is this a known bug? It shouldn't be hard to fix; the equality tester just needs to, umm, do it

Re: [racket] Search & wrap

2015-02-24 Thread Andrew Mauer-Oats
You say "wrap" but in your example you replace the call of function b with another function. Without a specific use-case I'm not sure about the use of speculating on your meaning. Would you be satisfied with (search&wrap function-b (define (function-a ...) ...)) or (define (function-a ...)

Re: [racket] compiling Racket to android and ios apps

2015-02-24 Thread Matthew Flatt
At Tue, 24 Feb 2015 13:54:46 -0500, Eric Dong wrote: > I would actually think that a good first step would be to port the Racket > VM The Racket VM runs on Android. See "racket/src/README" for hints on building (but it's just cross-compilation as usual), and let us know if you run into trouble.

Re: [racket] compiling Racket to android and ios apps

2015-02-24 Thread Eric Dong
I would actually think that a good first step would be to port the Racket VM, so that business logic can be run in Racket. GUI would be hard of course, but I think that for the moment being able to run a background process written in Racket would be "enough" for me, communicating with an Android GU

Re: [racket] Inconsistency of `in-range` and numerical issues

2015-02-24 Thread Matthias Felleisen
I am not offended. I am saddened. On Feb 24, 2015, at 1:25 PM, Andrew Kent wrote: > I just grabbed two separate witnesses showing the result of the relevant > floating point math - I apologize for any offense. > > On Tue Feb 24 2015 at 1:15:01 PM Matthias Felleisen > wrote: > > That's th

Re: [racket] Inconsistency of `in-range` and numerical issues

2015-02-24 Thread Laurent
Thanks for you detailed explanation Konrad. I'm surprised I didn't encounter this problem before–or most probably the last time was just so long ago that I don't remember it. A wakeup call for floating-point issues I suppose. Fortunately Racket offers rational numbers! On Tue, Feb 24, 2015 at 6:1

Re: [racket] Inconsistency of `in-range` and numerical issues

2015-02-24 Thread Andrew Kent
I just grabbed two separate witnesses showing the result of the relevant floating point math - I apologize for any offense. On Tue Feb 24 2015 at 1:15:01 PM Matthias Felleisen wrote: > > That's the saddest argument in support of anything Racket I have ever seen > (even with the smiley). > > > On

Re: [racket] Inconsistency of `in-range` and numerical issues

2015-02-24 Thread Matthias Felleisen
That's the saddest argument in support of anything Racket I have ever seen (even with the smiley). On Feb 24, 2015, at 1:05 PM, Andrew Kent wrote: > Racket: > (+ .1 .1 .1 .1 .1 .1 .1 .1) > 0.7999 > > Python: > >>> .1 + .1 + .1 + .1 + .1 + .1 + .1 + .1 > > 0.7999 >

Re: [racket] Inconsistency of `in-range` and numerical issues

2015-02-24 Thread Konrad Hinsen
On 24/02/2015 17:04, Laurent wrote: Btw, the reason it outputs 8 in the bad case is because on my machine: (for/sum ([i 8]) .1) ; 0.7999 which is then below the .8 threshold. It's not just your machine. 0.1 = 1/10 does not have an exact representation as a binary floating-point n

Re: [racket] Inconsistency of `in-range` and numerical issues

2015-02-24 Thread Konrad Hinsen
On 24/02/2015 16:41, Laurent wrote: I've discovered a rather troubling behaviour when using `in-range` with floating point numbers, which I think is worth knowing in case you hadn't consider the issue before: On my machine, I get the following: (length (for/list ([i (in-range .1 .7 .1)]) i)) ;

Re: [racket] Inconsistency of `in-range` and numerical issues

2015-02-24 Thread Andrew Kent
Racket: (+ .1 .1 .1 .1 .1 .1 .1 .1) 0.7999 Python: >>> .1 + .1 + .1 + .1 + .1 + .1 + .1 + .1 0.7999 Looks consistent to me =) On Tue Feb 24 2015 at 10:43:19 AM Laurent wrote: > I've discovered a rather troubling behaviour when using `in-range` with > floating point nu

Re: [racket] Inconsistency of `in-range` and numerical issues

2015-02-24 Thread Laurent
One such safe guard could be: (length (for/list ([i (in-range (inexact->exact .1) (inexact->exact .8) (inexact->exact .1))]) i)) ; 7 But of course that slows things down. Btw, the reason it outputs 8 in the bad case is because on my machine: (for/sum ([i 8]) .1) ; 0.7999 which is the

[racket] Inconsistency of `in-range` and numerical issues

2015-02-24 Thread Laurent
I've discovered a rather troubling behaviour when using `in-range` with floating point numbers, which I think is worth knowing in case you hadn't consider the issue before: On my machine, I get the following: (length (for/list ([i (in-range .1 .7 .1)]) i)) ; 6 (length (for/list ([i (in-range .1 .

[racket] Search & wrap

2015-02-24 Thread Jukka Tuominen
This is something I've been wondering for years and always ended up doing it manually. So, why not ask it out loud... I wonder whether it would be possible to search and wrap all definitions that reside outside a specified function, other than those contained in #lang racket? Say, (search&wrap '