Re: [racket] Bug in bitwise-bit-field

2014-06-16 Thread Matthew Flatt
I've pushed a repair to `bitwise-bit-field`. Thanks for the report! At Tue, 17 Jun 2014 07:32:22 +0400, Roman Klochkov wrote: > > ;; from Racket reference 4.2.2.6 > (define (bitwise-bit-field* n start end) >    (bitwise-and (sub1 (arithmetic-shift 1 (- end start))) >                            (

Re: [racket] Bug in bitwise-bit-field

2014-06-16 Thread Richard Cleis
What do you get when you evaluate #b11100010 ? rac On Jun 16, 2014, at 9:32 PM, Roman Klochkov wrote: > ;; from Racket reference 4.2.2.6 > (define (bitwise-bit-field* n start end) >(bitwise-and (sub1 (arithmetic-shift 1 (- end start))) >(ar

Re: [racket] Racket for Lego Mindstorms EV3

2014-06-16 Thread Elena Machkasova
On 6/13/2014 3:52 PM, Alexsandro Soares wrote: Hi all, I intend to teach programming and robotics for my ten years old daughter. I want to use the Lego Mindstorms EV3 that contains an ARM9 processor. Is there any version of Racket generating code to EV3? Or maybe another Lisp or Scheme di

[racket] Bug in bitwise-bit-field

2014-06-16 Thread Roman Klochkov
;; from Racket reference 4.2.2.6 (define (bitwise-bit-field* n start end)    (bitwise-and (sub1 (arithmetic-shift 1 (- end start)))                            (arithmetic-shift n (- start > (bitwise-bit-field #b11100010 0 31) -30 > (bitwise-bit-field* #b111

Re: [racket] Optimization

2014-06-16 Thread Roman Klochkov
Thank you! Mon, 16 Jun 2014 21:29:04 -0500 от Robby Findler : >Some elaboration on this point, just in case you've not seen it >before: http://docs.racket-lang.org/guide/performance.html > >On Mon, Jun 16, 2014 at 9:50 AM, Matthias Felleisen >< matth...@ccs.neu.edu > wrote: >> >> On Jun 16, 201

Re: [racket] Static Analysis and Graphics

2014-06-16 Thread Matthias Felleisen
Take a look at http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.24.3070 It basically gives you a PLAI/EOPL style function for creating the graph as a rational value (shared graph). You will need to figure out a few extra features. On Jun 16, 2014, at 8:27 PM, Neil Van Dyke wrote:

Re: [racket] Optimization

2014-06-16 Thread Robby Findler
Some elaboration on this point, just in case you've not seen it before: http://docs.racket-lang.org/guide/performance.html On Mon, Jun 16, 2014 at 9:50 AM, Matthias Felleisen wrote: > > On Jun 16, 2014, at 6:14 AM, Roman Klochkov wrote: > >> Tested in DrRacket 6.0.1 winXP x86 > > Please don't ti

Re: [racket] Static Analysis and Graphics

2014-06-16 Thread Neil Van Dyke
These graphs (not graphics) are mathematical abstractions. You will hear about some of these graphs when you study compilers. (Separately, there can also be diagrams (or graphics) to visualize these graphs. But that's probably not what you're looking for.) I think your code security analysi

[racket] Static Analysis and Graphics

2014-06-16 Thread Mansour Alqattan
Dear What do we use the following graphics for ?? such as Program Dependence Graph (PDG) and (CFG) Control Flow Graph and System Dependence Graph (SDG) and Data Flow Graphic (DFG) and Abstract Syntax Trees (ASTs) and Path Analysis. - How do I use these graphics for semantic or syntax?. is there p

Re: [racket] formlet checkbox behaves differently from others

2014-06-16 Thread Jay McCarthy
Most core formlets return binding structures. Your formlet uses input-int and input-string, which are short-hands. For instance, input-string is (to-string (required (text-input))) [1]. In contrast, checkbox is core, so if you look at its documentation [2] you can see the return type is, (formlet/c

Re: [racket] Determining type from a syntax object

2014-06-16 Thread Alexander D. Knauth
On Jun 16, 2014, at 3:41 PM, Sam Tobin-Hochstadt wrote: > On Mon, Jun 16, 2014 at 3:29 PM, Alexander D. Knauth > wrote: >> >> On Jun 16, 2014, at 3:13 PM, Sam Tobin-Hochstadt >> wrote: >> >>> On Mon, Jun 16, 2014 at 3:06 PM, Alexander D. Knauth >>> wrote: > Typed Racket functions

Re: [racket] Determining type from a syntax object

2014-06-16 Thread Sam Tobin-Hochstadt
On Mon, Jun 16, 2014 at 3:29 PM, Alexander D. Knauth wrote: > > On Jun 16, 2014, at 3:13 PM, Sam Tobin-Hochstadt wrote: > >> On Mon, Jun 16, 2014 at 3:06 PM, Alexander D. Knauth >> wrote: >>> Typed Racket functions are just plain Racket functions. We could add some extra metadata to ev

Re: [racket] Determining type from a syntax object

2014-06-16 Thread Alexander D. Knauth
On Jun 16, 2014, at 3:13 PM, Sam Tobin-Hochstadt wrote: > On Mon, Jun 16, 2014 at 3:06 PM, Alexander D. Knauth > wrote: >> >>> Typed Racket functions are >>> just plain Racket functions. We could add some extra metadata to every >>> value that held its type, >> >> It wouldn’t have to be every

Re: [racket] Determining type from a syntax object

2014-06-16 Thread Sam Tobin-Hochstadt
On Mon, Jun 16, 2014 at 3:06 PM, Alexander D. Knauth wrote: > >> Typed Racket functions are >> just plain Racket functions. We could add some extra metadata to every >> value that held its type, > > It wouldn’t have to be every value, it could just put that information in for > :has-type expressi

Re: [racket] Determining type from a syntax object

2014-06-16 Thread Alexander D. Knauth
On Jun 16, 2014, at 2:53 PM, Sam Tobin-Hochstadt wrote: > This is exactly what predicates are for, in general. However, you > can't have predicates that check things about functions -- there's no > information there at runtime to look at. I was kind of wondering if there was anything that coul

Re: [racket] Determining type from a syntax object

2014-06-16 Thread Sam Tobin-Hochstadt
This is exactly what predicates are for, in general. However, you can't have predicates that check things about functions -- there's no information there at runtime to look at. Typed Racket functions are just plain Racket functions. We could add some extra metadata to every value that held its typ

Re: [racket] Determining type from a syntax object

2014-06-16 Thread Alexander D. Knauth
Would there be a way to test the type for making decisions at run-time (not just with predicates)? For example: (cond [(:has-type? f (Number -> Any)) (f 1)] [(:has-type? f (String -> Any)) (f "1")]) On Jun 16, 2014, at 6:54 AM, Matthias Felleisen wrote: > > That's what I t

Re: [racket] Optimization

2014-06-16 Thread Matthias Felleisen
On Jun 16, 2014, at 6:14 AM, Roman Klochkov wrote: > Tested in DrRacket 6.0.1 winXP x86 Please don't time things inside of DrRacket. Racket Users list: http://lists.racket-lang.org/users

[racket] Fwd: [professors] Major WVH downtimes on Sunday 6/15

2014-06-16 Thread Matthias Felleisen
NEU CCIS suffered from a major power outage for all day yesterday (until early this morning). Our systems stuff described it with "the UPS that feeds the room had failed, could not be restarted, and could not be bypassed." Sorry for any inconveniences -- Matthias _

Re: [racket] Possible bug with DB virtual-connections and connection-pools

2014-06-16 Thread Curtis Dutton
Thank you for taking a look. For my scenario, your fix is great for me. It is a rare occurrence when this problem occurs, and the end result is that a user of my websites has to hit the refresh button once. On Thu, Jun 12, 2014 at 7:02 PM, Ryan Culpepper wrote: > On 06/11/2014 11:40 AM, Curtis

Re: [racket] Racket webserver for single-page application

2014-06-16 Thread Jay McCarthy
I think of such applications as being two pieces: the first is a boring transmission of the Javascript program, using a file; the second is a HTTP/JSON-based RPC server. I use web-server/dispatch to lay out the RPC calls and json to encode them. Here's an example that runs the package server: htt

Re: [racket] Determining type from a syntax object

2014-06-16 Thread Matthias Felleisen
That's what I thought you wanted it for so my answer stands -- Matthias On Jun 15, 2014, at 12:55 AM, Spencer Florence wrote: > This is about making decisions at compile time. Specifically I have a > sequence of expressions I want to partition into expressions of some type T > and expression

Re: [racket] Optimization

2014-06-16 Thread Matthew Flatt
At Mon, 16 Jun 2014 14:14:55 +0400, Roman Klochkov wrote: > I remade program to avoid optimizing out calulations and reduce GCing > [...] > and even > cpu time: 0 real time: 0 gc time: 0 > cpu time: 63 real time: 63 gc time: 47 > cpu time: 15 real time: 15 gc time: 0 > cpu time: 16 real time: 16

Re: [racket] Optimization

2014-06-16 Thread Roman Klochkov
I remade program to avoid optimizing out calulations and reduce GCing #lang racket (define (test1 x y z) (if x (+ y z) (- y z))) (define (test2 x) (if x (λ (y z) (+ y z)) (λ (y z) (- y z (define (run1 data) (foldl (λ (x y) (test1 #t x y)) 0 data)) (define (run2 data) (foldl (λ (x y) ((test2 #

Re: [racket] Optimization

2014-06-16 Thread Roman Klochkov
I have "debugging & profiling" on. Disable debugging. Now have all zeroes :-)  cpu time: 0 real time: 0 gc time: 0 I will check with optimization. If find something strange, I'll write. Mon, 16 Jun 2014 08:58:16 +0100 от Matthew Flatt : >Hm... I'm not able to get anything like the results you'

Re: [racket] Optimization

2014-06-16 Thread Robby Findler
I see these taking 3 or 4 msec each, which is hard to draw conclusions from. Robby On Mon, Jun 16, 2014 at 2:44 AM, Roman Klochkov wrote: > (define data (for/list ([x 10]) x)) > > (time (begin0 (void) (run2 data))) > (time (begin0 (void) (run1 data))) > > 3 times run1, then 3 times run2, the

Re: [racket] Optimization

2014-06-16 Thread Matthew Flatt
Hm... I'm not able to get anything like the results you're reporting. When I run the enclosed program via `racket` on the command line, I get cpu time: 3 real time: 3 gc time: 0 cpu time: 3 real time: 3 gc time: 0 cpu time: 2 real time: 2 gc time: 0 cpu time: 3 real time: 3 gc time: 0 cpu tim

Re: [racket] Optimization

2014-06-16 Thread Roman Klochkov
(define data (for/list ([x 10]) x)) (time (begin0 (void) (run2 data))) (time (begin0 (void) (run1 data))) 3 times run1, then 3 times run2, then again 3 times run1. Results are stable. Mon, 16 Jun 2014 08:28:10 +0100 от Matthew Flatt : >I'd expect them to run nearly the same due to inlining

Re: [racket] Optimization

2014-06-16 Thread Matthew Flatt
I'd expect them to run nearly the same due to inlining and constant propagation. If I save your program to "ex.rkt" and use raco make ex.rkt raco decompile ex.rkt the the output looks almost the same for both functions. There's a lot of allocation in these programs, of course, and that's going

Re: [racket] Optimization

2014-06-16 Thread Roman Klochkov
Yet more strange (define (run3 data)   (map (test2 #t) data)) runs twice faster. (time ...) gives only 100. I thought, that (lambda (x) (k x)) and k -- are synonims and optimizer elide extra lambda. Mon, 16 Jun 2014 11:16:25 +0400 от Roman Klochkov : >Strange. > >#lang racket >(define (test

[racket] Optimization

2014-06-16 Thread Roman Klochkov
Strange. #lang racket (define (test1 x y)   (if x     (+ y 1)     (- y 1))) (define (test2 x)   (if x     (λ (y) (+ y 1))     (λ (y) (- y 1 (define (run1 data)   (map (λ (x) (test1 #t x)) data)) (define (run2 data)   (map (λ (x) ((test2 #t) x)) data)) I expect, that run2 should be faster, be