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

2017-07-26 Thread Philip McGrath
Re multiple return values, you can write (call-with-values (λ () (values 1 2 3)) list) Because this problem bugs me, I've also written a package adjutor that includes values->list, list->values, and for/fold/define: http://docs.racket-lang.org/adjutor/index.html -Philip On Wed, Jul 26, 2017 at

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

2017-07-26 Thread Daniel Prager
Hi Gustavo Nice catch on the in-list front. I keep forgetting to do this, although I usually remember to use in-range when iterating from 0 to n-1. I tend to omit in-list for convenience rather than because I'm writing generic algorithms. I wonder what the general usage patterns are like. I

[racket-users] Re: query-exec SQLite3 multiple statements

2017-07-26 Thread Alexander McLin
I tried query-exec on those SQL strings you posted on gist on my local copy of Racket 6.8 with an in-memory SQLite3 db and it worked fine. I'm not sure what's causing your issue. What version of Racket and SQLite3 are you running on your machine? Is it Windows, Linux, or Mac OSX? >

Re: [racket-users] Correctly executing a source file from embedded Racket

2017-07-26 Thread Thomas Dickerson
On Wednesday, July 26, 2017 at 11:09:48 AM UTC-4, Matthew Flatt wrote: > At Wed, 26 Jul 2017 07:54:32 -0700 (PDT), Thomas Dickerson wrote: > > One more thing: in terms of repeatedly executing scripts, does it make > > sense > > to set up and tear down the interpreter every time? Or just swap in

[racket-users] Re: query-exec SQLite3 multiple statements

2017-07-26 Thread George Neuner
On Wed, 26 Jul 2017 11:45:25 -0700 (PDT), cmonbr...@gmail.com wrote: >First the create table is called and afterwards I execute each insert >statement. This is what displayln shows as output for sql-create: >

[racket-users] Re: query-exec SQLite3 multiple statements

2017-07-26 Thread cmonbryan
On Wednesday, July 26, 2017 at 7:02:42 PM UTC+2, Alexander McLin wrote: > One more thing for you to check, make sure there's no trailing whitespace > after the end of your statement's terminating semi-colon, that will also > trigger the `multiple statements given` error. That bug has been also

[racket-users] Re: query-exec SQLite3 multiple statements

2017-07-26 Thread Alexander McLin
One more thing for you to check, make sure there's no trailing whitespace after the end of your statement's terminating semi-colon, that will also trigger the `multiple statements given` error. That bug has been also fixed in the current repository. -- You received this message because you

[racket-users] Re: query-exec SQLite3 multiple statements

2017-07-26 Thread Alexander McLin
It appears you're giving to `query-exec` a string consisting of two statements; the create table and insert into statements. `query-exec` only supports executing one statement at a time. If you break your two statements up into two strings and call `query-exec` on each one, it should work. --

Re: [racket-users] Correctly executing a source file from embedded Racket

2017-07-26 Thread Shu-Hung You
Hi Thomas, I tried following Matthew's suggestions to attach my-lang and use dynamic-require. Turns out that works pretty well! And then there's even no need to setup collection path since everything loads from compiled byte-code. https://gist.github.com/shhyou/aa2adaf7e1b7d548783cee352c3230a9

Re: [racket-users] Correctly executing a source file from embedded Racket

2017-07-26 Thread Matthew Flatt
At Wed, 26 Jul 2017 07:54:32 -0700 (PDT), Thomas Dickerson wrote: > One more thing: in terms of repeatedly executing scripts, does it make sense > to set up and tear down the interpreter every time? Or just swap in a fresh > namespace? Between those two options, a fresh namespace is almost

Re: [racket-users] Correctly executing a source file from embedded Racket

2017-07-26 Thread Thomas Dickerson
Thanks for the help, a couple more quick questions: On Wednesday, July 26, 2017 at 9:15:12 AM UTC-4, Matthew Flatt wrote: > You don't have to populate the top-level environment with > `racket/base`. You could instead use > > scheme_namespace_require(scheme_intern_symbol("my-lang")) > > where

[racket-users] Re: query-exec SQLite3 multiple statements

2017-07-26 Thread cmonbryan
I came across this post earlier. Does it possibly truncate the amount of characters that was passed to it? My statements don't have syntax errors, I can copy and paste them into the SQL console without a problem. Seeing as I'm looking at somewhere close to around 80.000 records I'd rather

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

2017-07-26 Thread Gustavo Massaccesi
I read the solution of Daniel Prager and I have a few minor changes. * First I added a test that repeats `build-tree` 20 times, so the run time is approximately 1-2 seconds. This is not necessary, but times smaller than 1 second are sometimes not reliable. I'm using: ;--- (random-seed 12345)

Re: [racket-users] Correctly executing a source file from embedded Racket

2017-07-26 Thread Matthew Flatt
At Tue, 25 Jul 2017 19:08:02 -0700 (PDT), Thomas Dickerson wrote: > On Tuesday, July 25, 2017 at 5:52:45 PM UTC-4, Shu-Hung You wrote:> > > As we can see, > `scheme_namespace_require(scheme_intern_symbol("racket/base"));` > > is actually missing from your setup program. This line requires racket

[racket-users] Re: query-exec SQLite3 multiple statements

2017-07-26 Thread Alex Harsanyi
There's a problem with the sqlite interface where "multiple statements given" error is reported for any syntax error. This was fixed only recently. See previous discussion:

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

2017-07-26 Thread Alejandro Sanchez
On Tuesday, July 25, 2017 at 11:37:48 PM UTC+2, Lehi Toskin wrote: > One thing I'm curious about is what things can you and can you not pack? In > the README it shows bytes being packed, which seems a little obvious, but > what about (transparent) structs? Hashes? Lists? I'm very interested in

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

2017-07-26 Thread Alejandro Sanchez
Here is what I get from profiling the different dispatch methods in 'unpack'. First I pack a positive fixnum which is among the first few conditions. Cond: cpu time: 810 real time: 3367 gc time: 0 cpu time: 815 real time: 3428 gc time: 0 cpu time: 815 real time: 3197 gc time: 0

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

2017-07-26 Thread HiPhish
On Tuesday, July 25, 2017 at 11:37:48 PM UTC+2, Lehi Toskin wrote: > One thing I'm curious about is what things can you and can you not pack? In > the README it shows bytes being packed, which seems a little obvious, but > what about (transparent) structs? Hashes? Lists? I'm very interested in

[racket-users] query-exec SQLite3 multiple statements

2017-07-26 Thread cmonbryan
I'm working on converting a number of CSV files into SQLite3 tables. As of now I export the SQL statements to a text file and import them afterwards. ``` (define (csv->sqlfiles) (for-each (λ (e) (let* ([csv_filepath (string-append csv_dir (path->string e))] [table_name

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

2017-07-26 Thread Daniel Prager
Actually, I only use multiple values because that's what for/fold returns. Is there a way to convert from values to a list without going through define-values or similar? Dan On 26 Jul. 2017 09:40, "Zelphir Kaltstahl" wrote: I've come to the conclusion, that not