Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-24 Thread Matthias Felleisen
> On Jul 24, 2017, at 12:37 PM, Zelphir Kaltstahl > wrote: > > In general I think available libraries are important for creating attraction > to a programming language. For example I like Python's machine learning and > data munging libraries and this is one

[racket-users] Positional arguments in syntax classes

2017-07-24 Thread Sam Waxman
Probably a silly question but I can't figure out how to get this working. I want to have a syntax class that I can pass arguments into. So, (define-syntax-class (my-syn-class argument) ... ) (syntax-parse #'some-syntax [(_ x:**)]) In place of ** what do I write to pass the

Re: [racket-users] [ANN] MessagePack implementation for Racke

2017-07-24 Thread Jay McCarthy
This is awesome, thank you! Some advice: - I think you should have one module, `msgpack` that exports everything - You should rewrite your modules to use the `#lang racket/base` language so they don't force users to import so much stuff - On integer->integer-bytes, I think that we should support

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-24 Thread Jon Zeppieri
Just want to emphasize that the main source of inefficiency in your code is what I mentioned in my last message (iterating over the class labels of each row instead of the unique class labels of the entire data set). The second biggest factor is your structural recursion over a non-recursive

Re: [racket-users] How do db handles interact with threads and parameters

2017-07-24 Thread Ryan Culpepper
On 7/24/17 9:11 AM, George Neuner wrote: Hi David, On 7/24/2017 8:18 AM, David Storrs wrote: What happens in the following code? (define dbh (postgresql-connect ...)) ;; Use the DBH in a new thread (thread (thunk (while ...some long-running condition... (sleep 1) ; don't flood the DB

Re: [racket-users] [ANN] MessagePack implementation for Racke

2017-07-24 Thread Alejandro Sanchez
> - I think you should have one module, `msgpack` that exports everything OK. I my defense, I was originally planning to have a number of ‘pack-*’ methods like ‘pack-uin8’, ‘pack-uint16’ and so on, but there was nothing to be gained but a bloated interface. > - You should rewrite your modules

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-24 Thread Daniel Prager
Jon wrote: > Aside: if I read Daniel's solution correct, he avoids the first issue by assuming that it's a binary classification task (that is, that there are only two classes). Yep: I'm assuming binary classification. David wrote: > Out of curiosity, how much of that 0.5 seconds is overhead?

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-24 Thread David Storrs
Out of curiosity, how much of that 0.5 seconds is overhead? Could you run a simple 'add 1 and 1' procedure and see how long it takes? On Mon, Jul 24, 2017 at 9:18 AM, Daniel Prager wrote: > Hi Zelphir > > Thank-you for a fun exercise! > > My implementation using

Re: [racket-users] [ANN] MessagePack implementation for Racke

2017-07-24 Thread Vincent St-Amour
Hi Alejandro, This looks cool! I don't see it listed at pkgs.racket-lang.org. It would be easier for users to discover it if you posted it there. Vincent On Mon, 24 Jul 2017 08:17:30 -0500, Alejandro Sanchez wrote: > > Hello dear Racketeers, > > I have been writing an implementation of the

Re: [racket-users] [ANN] MessagePack implementation for Racke

2017-07-24 Thread Alejandro Sanchez
I will look into that later, one thing at a time :) > On 24 Jul 2017, at 21:45, Vincent St-Amour > wrote: > > Hi Alejandro, > > This looks cool! > > I don't see it listed at pkgs.racket-lang.org. It would be easier for > users to discover it if you posted it

Re: [racket-users] [ANN] MessagePack implementation for Racke

2017-07-24 Thread Alejandro Sanchez
> On 24 Jul 2017, at 22:40, Jay McCarthy wrote: > > On Mon, Jul 24, 2017 at 3:18 PM, Alejandro Sanchez > wrote: >>> - I'm curious of the performance. In particular, I would expect that a >>> computed jump in unpack could do you good. Did you try

Re: [racket-users] [ANN] MessagePack implementation for Racke

2017-07-24 Thread Jay McCarthy
On Mon, Jul 24, 2017 at 3:18 PM, Alejandro Sanchez wrote: >> - I'm curious of the performance. In particular, I would expect that a >> computed jump in unpack could do you good. Did you try that? > I haven’t investigated performance yet. As I said, I am new to Racket,

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-24 Thread Daniel Prager
Hi Zelphir Thanks for the attribution. I'm running on a MacBook Air, 2012 vintage. Why not run both my and your code on your machine and compare? I made no optimisations other than assuming binary classification. Dan On Tue, Jul 25, 2017 at 6:46 AM, Zelphir Kaltstahl <

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-24 Thread Zelphir Kaltstahl
On Monday, July 24, 2017 at 10:04:36 PM UTC+2, Daniel Prager wrote: > Jon wrote: > > Aside: if I read Daniel's solution correct, he avoids the first issue by > >assuming that it's a binary classification task (that is, that there are > >only two classes). > > > Yep: I'm assuming binary

[racket-users] Mono, racketscript, ffi, databases and pointer swizzling

2017-07-24 Thread amz3
Héllo, # Summary I am slowly moving to Racket as my language of choice. My goal is to port the work I've done in GNU Guile and BiwaScheme to Racket and RacketScript [0]. I'd like to create a software stack I call "mono" that is a monolithic solution for doing applications with a web GUI. By

Re: [racket-users] [ANN] MessagePack implementation for Racke

2017-07-24 Thread Jack Firth
> Just to make sure I understood correctly: ‘msgpack’ is the umbrella module > that users import, ‘msgpack/test/pack’ (and ‘unpack’) are the test modules > that will be run for testing only. How about the directory structure? I like > to keep all source files in a source directory (my original

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-24 Thread Zelphir Kaltstahl
On Monday, July 24, 2017 at 6:44:23 PM UTC+2, Matthias Felleisen wrote: > > On Jul 24, 2017, at 12:37 PM, Zelphir Kaltstahl > > wrote: > > > > In general I think available libraries are important for creating > > attraction to a programming language. For example I

Re: [racket-users] Blame for contracts on applicable serializable structs

2017-07-24 Thread Philip McGrath
That is precisely the contract violation I'd like to see reported, but, without the shadowing of serialize and deserialize, the error is reported in terms of `+`. (And, if it wasn't clear, I do intend to actually read and write the serialized instance.) I (think) I understand why deserialization

Re: [racket-users] Positional arguments in syntax classes

2017-07-24 Thread Sam Waxman
Sorry, I think I need to elaborate a bit more! I've written code as follows (define-syntax-class my-id (pattern id #:do (if (identifier? #'id) (values) (raise-user-error (~a "Expected id: " (syntax->datum #'id)) (define-syntax (my-let stx) (syntax-parse stx [(_

Re: [racket-users] Blame for contracts on applicable serializable structs

2017-07-24 Thread Matthias Felleisen
Ouch, my fault. I deleted the wrong bindings. > On Jul 24, 2017, at 1:58 PM, Philip McGrath wrote: > > Sorry for the crossed emails. If I understand what's happening correctly, the > code you sent only blames the "deserializing" module because it shaddows >

Re: [racket-users] Blame for contracts on applicable serializable structs

2017-07-24 Thread Matthew Flatt
At Mon, 24 Jul 2017 12:35:51 -0500, Philip McGrath wrote: > I've also tried putting the > definition of `deserialize-info:adder-v0` in a different module, so that > its version of `adder` has a contract, but then the binding isn't seen by > `make-serialize-info`. In case you still want to pursue

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-24 Thread Zelphir Kaltstahl
Already fixed that `class-labels` issue, thanks, it was a quick fix today morning. I already tested it with that change and it was way faster. I thought about going for binary classification only while programming, but I think I managed to keep it generic for multiple classes at least in most

Re: [racket-users] Blame for contracts on applicable serializable structs

2017-07-24 Thread Robby Findler
One approach would be to not expect the clients to use deserialize directly but provide a thin wrapper module which would be the place to hang the blame information (and it would use `contract-out`). Robby On Mon, Jul 24, 2017 at 1:32 PM, Matthew Flatt wrote: > At Mon, 24

Re: [racket-users] [ANN] MessagePack implementation for Racke

2017-07-24 Thread Jon Zeppieri
On Mon, Jul 24, 2017 at 4:40 PM, Jay McCarthy wrote: > On Mon, Jul 24, 2017 at 3:18 PM, Alejandro Sanchez > wrote: >>> - I'm curious of the performance. In particular, I would expect that a >>> computed jump in unpack could do you good. Did you

Re: [racket-users] [ANN] MessagePack implementation for Racke

2017-07-24 Thread Philip McGrath
You probably want `integer-in` for the contract on `ext`. Have you read about the special treatment of test submodules? https://docs.racket-lang.org/guide/Module_Syntax.html#%28part._main-and-test%29 That is the idiomatic Racket way to write tests that run automatically when you want them and

Re: [racket-users] Re: Decision Tree in Racket - Performance

2017-07-24 Thread Zelphir Kaltstahl
On Monday, July 24, 2017 at 11:36:00 PM UTC+2, Daniel Prager wrote: > Hi Zelphir > > Thanks for the attribution. > > I'm running on a MacBook Air, 2012 vintage. > > Why not run both my and your code on your machine and compare? > > I made no optimisations other than assuming binary

[racket-users] Printing Quickly

2017-07-24 Thread Lehi Toskin
I have noticed that printing in DrRacket is rather slow and I'm wondering if that's something I could speed up. If I have a loop that runs and prints a whole lot of information each loop, were I to become overwhelmed and click the Stop button, it would take a minute or so before my wishes made

[racket-users] Re: Decision Tree in Racket - Performance

2017-07-24 Thread Zelphir Kaltstahl
Wow, thanks for all the feedback, I'll try to get most of the mentioned stuff done and then post an update : ) > I teach trees and decision trees to freshman students who have never > programmed before, and Racket’s forms of data and functions are extremely > suitable to this domain. I think

[racket-users] Re: Decision Tree in Racket - Performance

2017-07-24 Thread Zelphir Kaltstahl
> - Are you running this code inside DrRacket? If so, have you timed the > difference between running it with debugging enabled and with no > debugging or profiling? (Language -> Choose Language... -> Details) I am running from terminal with: ```racket -l errortrace -t FILE``` and ```raco test

[racket-users] How do db handles interact with threads and parameters

2017-07-24 Thread David Storrs
What happens in the following code? (define dbh (postgresql-connect ...)) ;; Use the DBH in a new thread (thread (thunk (while ...some long-running condition... (sleep 1) ; don't flood the DB (query-exec dbh "insert into users ..." ;; And in the main thread (query-exec dbh ...) I

Re: [racket-users] Blame for contracts on applicable serializable structs

2017-07-24 Thread Matthias Felleisen
> On Jul 23, 2017, at 10:50 PM, Philip McGrath wrote: > > If I'm following correctly, I think that's what I was trying to do, but I'm > unclear how to give `make-deserialize-info` a variant of `make-adder` that > has a contract. The initial example with

Re: [racket-users] How do db handles interact with threads and parameters

2017-07-24 Thread George Neuner
Hi David, On 7/24/2017 8:18 AM, David Storrs wrote: What happens in the following code? (define dbh (postgresql-connect ...)) ;; Use the DBH in a new thread (thread (thunk (while ...some long-running condition... (sleep 1) ; don't flood the DB (query-exec dbh "insert into users

[racket-users] [ANN] MessagePack implementation for Racke

2017-07-24 Thread Alejandro Sanchez
Hello dear Racketeers, I have been writing an implementation of the MessagePack protocol for Racket and I think the library is ready to be showcased now: https://gitlab.com/HiPhish/MsgPack.rkt ### What is MessagePack? ### MessagePack is a binary data

Re: [racket-users] How do db handles interact with threads and parameters

2017-07-24 Thread David Storrs
On Mon, Jul 24, 2017 at 9:11 AM, George Neuner wrote: > Hi David, > > On 7/24/2017 8:18 AM, David Storrs wrote: > > What happens in the following code? > > (define dbh (postgresql-connect ...)) > > ;; Use the DBH in a new thread > (thread (thunk > (while ...some