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

2017-07-23 Thread Philip McGrath
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 `define/contract` was the closest I've come: it at least reported violations in terms of `make-adder`

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

2017-07-23 Thread Jon Zeppieri
On Sun, Jul 23, 2017 at 10:09 PM, Jon Zeppieri wrote: > > Even after implementing my own suggestions, it's still much slower > than the python example it was based. Maybe there's an algorithmic > problem somewhere (aside from the vector iteration I mentioned > before). At any

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

2017-07-23 Thread Matthew Flatt
The original example had an explicit deserializer: At Sun, 23 Jul 2017 19:54:43 -0500, Philip McGrath wrote: > (define deserialize-info:adder-v0 > (make-deserialize-info make-adder >(λ () (error 'adder > "can't have

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

2017-07-23 Thread Matthias Felleisen
I see. Not surprisingly serialization strips the contract of (structural) functions as you can see with this slightly different example: #lang racket (module server racket (require racket/serialize) (provide (contract-out [adder (-> natural-number/c (-> natural-number/c

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

2017-07-23 Thread Jon Zeppieri
On Sun, Jul 23, 2017 at 7:30 PM, Zelphir Kaltstahl wrote: > Hi Racket Users, > > The last few days I've been working on implementing decision trees in Racket > and I've been following the following guide: >

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

2017-07-23 Thread Philip McGrath
Here is the problem with serialization, without my attempts to mitigate it: #lang racket (module server racket (require racket/serialize) (provide (contract-out [adder (-> natural-number/c (-> natural-number/c natural-number/c))]))

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

2017-07-23 Thread Matthias Felleisen
[replying to myself] > On Jul 23, 2017, at 9:58 PM, Matthias Felleisen wrote: > > > At some point I wrote all this up for the contract doc (as the opening > paragraphs). I can’t see it right now. Still there:

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

2017-07-23 Thread Matthias Felleisen
> On Jul 23, 2017, at 9:43 PM, Philip McGrath wrote: > > Aha — so it isn't really an issue with serialization at all. If I (now) > understand this correctly, when a function produces a contracted higher-order > result, it is the responsibility of the caller of the

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

2017-07-23 Thread Philip McGrath
Aha — so it isn't really an issue with serialization at all. If I (now) understand this correctly, when a function produces a contracted higher-order result, it is the responsibility of the caller of the original function to ensure that the result function is always applied to appropriate

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

2017-07-23 Thread Jon Zeppieri
On Sun, Jul 23, 2017 at 9:07 PM, Jon Zeppieri wrote: > Struct update does, however, involve a full copy[...] Err, immutable struct update, that is (in case it wasn't obvious). -- You received this message because you are subscribed to the Google Groups "Racket Users"

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

2017-07-23 Thread Jon Zeppieri
On Sun, Jul 23, 2017 at 7:30 PM, Zelphir Kaltstahl wrote: > > How can I make my code more efficient, without changing the basic logic of it? > In addition to what I wrote before, there are a couple of places where you're constructing new lists when you don't need to.

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

2017-07-23 Thread Matthias Felleisen
> On Jul 23, 2017, at 8:54 PM, Philip McGrath wrote: > > I'm confused about why the following program is blaming the server for the > client's misuse of an applicable struct instance. More generally, I've tried > doing this in several different ways, and I can't

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

2017-07-23 Thread Jon Zeppieri
On Sun, Jul 23, 2017 at 8:43 PM, David Storrs wrote: > > > On Sun, Jul 23, 2017 at 8:05 PM, Jon Zeppieri wrote: >> - Use a struct instead of a hash to represent a split. > > > Oh, are structs faster than hashes? Can't make a blanket statement, and the

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

2017-07-23 Thread Philip McGrath
I'm confused about why the following program is blaming the server for the client's misuse of an applicable struct instance. More generally, I've tried doing this in several different ways, and I can't figure out how to make applicable structs that are still protected by contracts after

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

2017-07-23 Thread David Storrs
On Sun, Jul 23, 2017 at 8:05 PM, Jon Zeppieri wrote: > On Sun, Jul 23, 2017 at 7:30 PM, Zelphir Kaltstahl > wrote: > > Hi Racket Users, > > > > The last few days I've been working on implementing decision trees in > Racket and I've been following

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

2017-07-23 Thread Matthias Felleisen
More generally, this seems to be a raw translation of an algorithm stated in a language that has a rather lowlevel view of data. Perhaps this is needed for this world, but I doubt it. I teach trees and decision trees to freshman students who have never programmed before, and Racket’s forms

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

2017-07-23 Thread Jon Zeppieri
On Sun, Jul 23, 2017 at 7:30 PM, Zelphir Kaltstahl wrote: > Hi Racket Users, > > The last few days I've been working on implementing decision trees in Racket > and I've been following the following guide: >

[racket-users] Decision Tree in Racket - Performance

2017-07-23 Thread Zelphir Kaltstahl
Hi Racket Users, The last few days I've been working on implementing decision trees in Racket and I've been following the following guide: http://machinelearningmastery.com/implement-decision-tree-algorithm-scratch-python/ Now I have the following code:

Re: [racket-users] Struct declaration conflict if a file is required implicitly

2017-07-23 Thread Alejandro Sanchez
Thank you so much! I feel so stupid now, that file path is a leftover from when the directory structure was different. Now it works perfectly. > On 23 Jul 2017, at 17:43, Ryan Culpepper wrote: > > On 07/23/2017 07:26 AM, Alejandro Sanchez wrote: >> Hello everyone, >> I am

Re: [racket-users] Struct declaration conflict if a file is required implicitly

2017-07-23 Thread hiphish
On Sunday, July 23, 2017 at 5:43:51 PM UTC+2, Ryan Culpepper wrote: > On 07/23/2017 07:26 AM, Alejandro Sanchez wrote: > > Hello everyone, > > > > I am working on this project: https://gitlab.com/HiPhish/MsgPack.rkt/ > > > > I am writing test cases and I ran into a problem with my ‘ext’

Re: [racket-users] Struct declaration conflict if a file is required implicitly

2017-07-23 Thread Ryan Culpepper
On 07/23/2017 07:26 AM, Alejandro Sanchez wrote: Hello everyone, I am working on this project: https://gitlab.com/HiPhish/MsgPack.rkt/ I am writing test cases and I ran into a problem with my ‘ext’ structure. It is declared in the file ‘msgpack/main.rkt’, which is required in the file

[racket-users] Struct declaration conflict if a file is required implicitly

2017-07-23 Thread Alejandro Sanchez
Hello everyone, I am working on this project: https://gitlab.com/HiPhish/MsgPack.rkt/ I am writing test cases and I ran into a problem with my ‘ext’ structure. It is declared in the file ‘msgpack/main.rkt’, which is required in the file ‘msgpack/pack.rkt’ (also in ‘msgpack/unpack.rkt’). For my