[racket-users] Re: Arcs and lines being half-drawn
Here is a clearer photo. In the original (and working) graphical editor you can select the entities to highlight them in red. The entities are weirdly cut off. The top left arc is cut off in the middle! Have since commented out (define draw-line ..), but the problem still persists. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Re: Arcs and lines being half-drawn
Could you point to the complete code base? Thanks -- Matthias On Mar 26, 2015, at 9:38 AM, chia kang ren kangren.c...@gmail.com wrote: Here is a clearer photo. In the original (and working) graphical editor you can select the entities to highlight them in red. The entities are weirdly cut off. The top left arc is cut off in the middle! Have since commented out (define draw-line ..), but the problem still persists. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. Screen Shot 2015-03-26 at 9.25.19 pm.png -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Re: Why are SQLITE queries so slow?
Thanks a lot George, for this insightful reply. Your idea about FFI explaining 95% of the overhead looks good... but i wonder: in this case, shouldn't we also see a high cost in bind-prepared-statement alone? (sorry for my sketchy english) Thanks again, Renaud -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Re: Arcs and lines being half-drawn
http://pasterack.org/pastes/75790 http://pasterack.org/pastes/11360 http://pasterack.org/pastes/10455 -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] pict/code with other languages
I'd like to typeset some Javascript code in a way similar to what pict/code allows, but the naive approach of (code someFunc(someArg, someOtherArg)) doesn't quite work because of the reader adding whitespace in various places. pict/code seems to be purely oriented towards working with racket code, how can I get similar functionality for languages with C-style syntax? -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Custom repl UI widgets
At Wed, 25 Mar 2015 17:08:56 -0700 (PDT), Steve Olsen wrote: I was wondering if anybody could show me an example of a very simple snip% that maybe drew a circle and had some sort of click interaction that I could work off of. I'll add the enclosed example to the documentation. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. main.rkt Description: Binary data
Re: [racket-users] pict/code with other languages
I use the `java-lexer` package to typeset JavaScript code: https://github.com/stamourv/java-lexer To turn those into picts, you can use `codeblock-pict` from `unstable/gui/scribble`. Vincent At Thu, 26 Mar 2015 09:45:50 -0700 (PDT), Jack Firth wrote: I'd like to typeset some Javascript code in a way similar to what pict/code allows, but the naive approach of (code someFunc(someArg, someOtherArg)) doesn't quite work because of the reader adding whitespace in various places. pict/code seems to be purely oriented towards working with racket code, how can I get similar functionality for languages with C-style syntax? -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Re: pict/code with other languages
Fantastic, thank you. Sidenote - I had to (require java-lexer) instead of (require java/code) like the readme says. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Re: Why are SQLITE queries so slow?
You're all forgiven since, 1/ there's nothing to forgive, and 2/ you're of great help with such precise and thorough answers. I still don't know how to speed up my code, but i've learnt a lot. Big thanks to you George, again. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Why are SQLITE queries so slow?
How did you time the queries? /Jens Axel 2015-03-25 15:03 GMT+01:00 Renaud rgomb...@essentiel.net: Hi, I'm new to Racket, and i would like to know why sqlite queries are so slow in my test program. This program imports some data from a text file into a simple sqlite DB. It takes 35s with the INSERT queries and 5-6s without them. I've done the same thing with other languages, all do far better. For example with perl the same code runs in 8s with the queries, and 2-3s with them. I know that startup and regex are (reasonably ?) slower in racket, but queries seems to be very slow. Am i doing somethin wrong? Thanks for your help. test done by swapping the commented line with the next. Code : - #!/usr/bin/env racket #lang racket/base (require racket/list racket/string db/base db/sqlite3) (define DBFILE database.rkt.sql) (define rx #rx[~^]+) (define sdb #f) (define (openDatas) (unless sdb (set! sdb (sqlite3-connect #:database DBFILE (define (importDatas) (when (file-exists? DBFILE) (delete-file DBFILE)) (set! sdb (sqlite3-connect #:database DBFILE #:mode 'create)) (start-transaction sdb) (query-exec sdb CREATE TABLE groups (fam INTEGER, name STRING , PRIMARY KEY (fam))) (query-exec sdb CREATE TABLE foods (alim INTEGER, fam INTEGER, name STRING , PRIMARY KEY (alim))) (query-exec sdb CREATE TABLE nutrients (nutr INTEGER, unit STRING, short STRING, name STRING , PRIMARY KEY (nutr))) (query-exec sdb CREATE TABLE contents (alim INTEGER, nutr INTEGER, val FLOAT , PRIMARY KEY (alim, nutr))) (process-file FD_GROUP.txt groups2) (process-file FOOD_DES.txt foods 3) (process-file NUTR_DEF.txt nutrients 4) (process-file NUT_DATA.txt contents 3) (commit-transaction sdb)) (define (process-file fname table nb) (define Q (prepare sdb (string-append INSERT INTO table VALUES ( (string-join (for/list ([x nb]) ?) ,) (call-with-input-file fname (lambda (file) (for ([line (in-port read-line file)]) ;(bind-prepared-statement Q (take (regexp-split rx line 1) nb)) (query-exec sdb (bind-prepared-statement Q (take (regexp-split rx line 1) nb))) (importDatas) - -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- -- Jens Axel Søgaard -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Why are SQLITE queries so slow?
Le jeudi 26 mars 2015 19:21:11 UTC+1, Jens Axel Søgaard a écrit : How did you time the queries? /Jens Axel 2015-03-25 15:03 GMT+01:00 Renaud renaud: Hi, I'm new to Racket, and i would like to know why sqlite queries are so slow in my test program. This program imports some data from a text file into a simple sqlite DB. It takes 35s with the INSERT queries and 5-6s without them. I've done the same thing with other languages, all do far better. For example with perl the same code runs in 8s with the queries, and 2-3s with them. I know that startup and regex are (reasonably ?) slower in racket, but queries seems to be very slow. Am i doing somethin wrong? Thanks for your help. test done by swapping the commented line with the next. Code : - #!/usr/bin/env racket #lang racket/base (require racket/list racket/string db/base db/sqlite3) (define DBFILE database.rkt.sql) (define rx #rx[~^]+) (define sdb #f) (define (openDatas) (unless sdb (set! sdb (sqlite3-connect #:database DBFILE (define (importDatas) (when (file-exists? DBFILE) (delete-file DBFILE)) (set! sdb (sqlite3-connect #:database DBFILE #:mode 'create)) (start-transaction sdb) (query-exec sdb CREATE TABLE groups (fam INTEGER, name STRING , PRIMARY KEY (fam))) (query-exec sdb CREATE TABLE foods (alim INTEGER, fam INTEGER, name STRING , PRIMARY KEY (alim))) (query-exec sdb CREATE TABLE nutrients (nutr INTEGER, unit STRING, short STRING, name STRING , PRIMARY KEY (nutr))) (query-exec sdb CREATE TABLE contents (alim INTEGER, nutr INTEGER, val FLOAT , PRIMARY KEY (alim, nutr))) (process-file FD_GROUP.txt groups2) (process-file FOOD_DES.txt foods 3) (process-file NUTR_DEF.txt nutrients 4) (process-file NUT_DATA.txt contents 3) (commit-transaction sdb)) (define (process-file fname table nb) (define Q (prepare sdb (string-append INSERT INTO table VALUES ( (string-join (for/list ([x nb]) ?) ,) (call-with-input-file fname (lambda (file) (for ([line (in-port read-line file)]) ;(bind-prepared-statement Q (take (regexp-split rx line 1) nb)) (query-exec sdb (bind-prepared-statement Q (take (regexp-split rx line 1) nb))) (importDatas) - -- Jens Axel Søgaard Hi Jens Axel, I just used time ./my-script.rkt with the given code, then after swapping the comment near the bottom : ;(bind-prepared-statement Q (take (regexp-split rx line 1) nb)) (query-exec sdb (bind-prepared-statement Q (take (regexp-split rx line 1) nb))) vs. (bind-prepared-statement Q (take (regexp-split rx line 1) nb)) ;(query-exec sdb (bind-prepared-statement Q (take (regexp-split rx line 1) nb))) Crude... i know... -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Why are SQLITE queries so slow?
Did you subtract the startup cost of Racket to get the time of the queries? /Jens Axel 2015-03-26 19:29 GMT+01:00 Renaud renaud.gomb...@gmail.com: Le jeudi 26 mars 2015 19:21:11 UTC+1, Jens Axel Søgaard a écrit : How did you time the queries? /Jens Axel 2015-03-25 15:03 GMT+01:00 Renaud renaud: Hi, I'm new to Racket, and i would like to know why sqlite queries are so slow in my test program. This program imports some data from a text file into a simple sqlite DB. It takes 35s with the INSERT queries and 5-6s without them. I've done the same thing with other languages, all do far better. For example with perl the same code runs in 8s with the queries, and 2-3s with them. I know that startup and regex are (reasonably ?) slower in racket, but queries seems to be very slow. Am i doing somethin wrong? Thanks for your help. test done by swapping the commented line with the next. Code : - #!/usr/bin/env racket #lang racket/base (require racket/list racket/string db/base db/sqlite3) (define DBFILE database.rkt.sql) (define rx #rx[~^]+) (define sdb #f) (define (openDatas) (unless sdb (set! sdb (sqlite3-connect #:database DBFILE (define (importDatas) (when (file-exists? DBFILE) (delete-file DBFILE)) (set! sdb (sqlite3-connect #:database DBFILE #:mode 'create)) (start-transaction sdb) (query-exec sdb CREATE TABLE groups (fam INTEGER, name STRING , PRIMARY KEY (fam))) (query-exec sdb CREATE TABLE foods (alim INTEGER, fam INTEGER, name STRING , PRIMARY KEY (alim))) (query-exec sdb CREATE TABLE nutrients (nutr INTEGER, unit STRING, short STRING, name STRING , PRIMARY KEY (nutr))) (query-exec sdb CREATE TABLE contents (alim INTEGER, nutr INTEGER, val FLOAT , PRIMARY KEY (alim, nutr))) (process-file FD_GROUP.txt groups2) (process-file FOOD_DES.txt foods 3) (process-file NUTR_DEF.txt nutrients 4) (process-file NUT_DATA.txt contents 3) (commit-transaction sdb)) (define (process-file fname table nb) (define Q (prepare sdb (string-append INSERT INTO table VALUES ( (string-join (for/list ([x nb]) ?) ,) (call-with-input-file fname (lambda (file) (for ([line (in-port read-line file)]) ;(bind-prepared-statement Q (take (regexp-split rx line 1) nb)) (query-exec sdb (bind-prepared-statement Q (take (regexp-split rx line 1) nb))) (importDatas) - -- Jens Axel Søgaard Hi Jens Axel, I just used time ./my-script.rkt with the given code, then after swapping the comment near the bottom : ;(bind-prepared-statement Q (take (regexp-split rx line 1) nb)) (query-exec sdb (bind-prepared-statement Q (take (regexp-split rx line 1) nb))) vs. (bind-prepared-statement Q (take (regexp-split rx line 1) nb)) ;(query-exec sdb (bind-prepared-statement Q (take (regexp-split rx line 1) nb))) Crude... i know... -- -- Jens Axel Søgaard -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Why are SQLITE queries so slow?
Le jeudi 26 mars 2015 19:37:19 UTC+1, Jens Axel Søgaard a écrit : Did you subtract the startup cost of Racket to get the time of the queries? /Jens Axel I subtracted the two timings, which should get rid of everything but the query time, and gives about 30s for raket vs. about 5s for perl. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Re: pict/code with other languages
Good catch! I just pushed a fix. Thanks! Vincent At Thu, 26 Mar 2015 10:38:53 -0700 (PDT), Jack Firth wrote: Fantastic, thank you. Sidenote - I had to (require java-lexer) instead of (require java/code) like the readme says. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Why are SQLITE queries so slow?
On 3/25/2015 10:03 AM, Renaud wrote: I'm new to Racket, and i would like to know why sqlite queries are so slow in my test program. This program imports some data from a text file into a simple sqlite DB. It takes 35s with the INSERT queries and 5-6s without them. I've done the same thing with other languages, all do far better. For example with perl the same code runs in 8s with the queries, and 2-3s with them. I know that startup and regex are (reasonably ?) slower in racket, but queries seems to be very slow. Am i doing somethin wrong? Thanks for your help. Hi Renaud, I see that you have wrapped the inserts in an outer transaction - that already addresses a well known performance issue with batch inserts/updates. If your version of sqlite has the write ahead log, you might try enabling that (if it isn't already). Much of the problem is that sqlite is a foreign C library. Racket's internal data formats [mostly] are not C compatible and so at every function call, arguments must be translated to C and return data translated to Racket. This is the Foreign Function Interface (FFI). Perl's internal data formats are C already, and the DBD::SQLite lib has the sqlite engine embedded into it. Because it is C top to bottom, Perl has a significant speed advantage when calling sqlite functions. File access in Racket is slightly slower than in Perl - you saw that already - but that again is due to FFI (the C system calls). In my experience Racket's regex is as fast as Perl's. I think FFI overhead will explain 95+% of the time difference - and there's not much you can do about it. You could try #lang typed/racket, but I don't know how easily the db module can be used with it - I have never tried and some things require a lot of effort to make work in the typed language ... it's an ongoing project to make everything work smoothly. You can slightly reduce startup time by compiling the Racket to a bytecode *.zo file (using raco make). *.zo files will live in a subdirectory called compiled/ under the source file directory. Then start your program with racket -r source_file. Note that you can't try to run the *.zo file directly - Racket checks the timestamps on the source and bytecode file and recompiles (in memory, it won't save the result) if necessary. You can reduce more by linking the program's *.zo file(s) into an executable (using raco exe) that can be run directly. This can help significantly with a large program, but it probably won't make any difference with your tiny one. George -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Projects (was: the Racket manifesto)
That's also what I understand, and I find this philosophy pretty appealing too, for what it's worth. However it still worries me as this sounds a like I'm not wearing shoes because the problem is not your feet but the pavement; What we need is a pavement that makes it possible to walk without shoes; I /could/ wear shoes until we get a better pavement, and run long distances like all those people who wear shoes, but if I start wearing shoes I will stop worrying about making a better pavement and will be stuck with a hack rather than a real solution. Furthermore, files and github are not chosen by Racket, so I don't personally mind that much using a few external tools if Racket can't do it itself (I'd still rather have Racket do it itself of course; I want a Racket machine). What's more, whether `raco` is written in Racket or in C does not make a difference, as long as it can create a package of my files. Thus, I consider `raco` an external tool. On Wed, Mar 25, 2015 at 4:13 PM, Matthias Felleisen matth...@ccs.neu.edu wrote: Thank you Greg. I couldn't have said it any better (probably worse). This is exactly the point -- Matthias On Mar 25, 2015, at 12:07 PM, Greg Hendershott greghendersh...@gmail.com wrote: My personal/casual take on this: There are language systems where you to need to run some make-a-new-project tool -- even for a single source file. In Racket you can create multi-file collections without needing such a tool. Only at the point where you want to package it share with others, do you maybe need a tiny info.rkt. And I think the philosophy is that even this is sort of unfortunate, and should be as minimal as possible. For example if it were feasible to omit `deps` and `build-deps`, and have those automatically determined (not automatically genreated in info.rkt), that would be preferable. In many cases that would leave info.rkt containing only metadata like `version`. I could imagine even that instead going in main.rkt as a special identifier and/or submodule or whatever. So I understand the manifesto as saying, even if it turns out to be impractical short- or long-term, the ideal and the starting point should be no external tools and config files. Also Racket has a macro system that means you probably never need to resort to source-file-generating/munging tools, which can be a big chunk of the ecosystem in some languages. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Projects (was: the Racket manifesto)
Laurent writes: Furthermore, files and github are not chosen by Racket, so I don't personally mind that much using a few external tools if Racket can't do it itself (I'd still rather have Racket do it itself of course; I want a Racket machine). What's more, whether `raco` is I'd go one step further and say that for some tasks I prefer to use external tools, and the possibility of doing so if very important for me. The point is that much of what I do on my computer is outside of the scope of Racket, so I need to integrate Racket into my overall workflow. I edit lots of file, including Racket source code, so I much prefer to use Emacs for everything, even though DrRacket is perhaps superior for writing Racket code. I use version control for almost everything I work on, so I prefer standard tools (Mercurial, Git), even if Racket one day comes with built-in version control. The idea of creating an all-encompassing programming environment has been tried a few times in the past. Lisp machines have disappeared. Smalltalk is insignificant. For now, Racket has found a good compromise and I hope it will stay there. Konrad. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] the Racket manifesto
Matthias Felleisen writes: Neil, I wrote this paper _because_ academia perceives Racket as a cult. Wow. I must be missing something interesting. Is there some tutorial on the Rites of Racket? ;-) I am in academia, but quite remote from the Racket hotspots both thematically and geographically. As far as I can remember, I have never spoken to anyone in real life who uses Racket or who just knows a Racket user in person. From this distant point of view, Racket looks like a community of people working on a common goal, and the manifesto describes that goal very well. What strikes me is that the manifesto gives a very different view of Racket than the Racket Web site does. The latter emphasizes Racket as a teaching environment and as a batteries included general-purpose language. The features related to language development are documented in the reference sections, but there isn't much to motivate them. It's only from the manifesto that I started to see the point of having inspectors and custodians, for example. In my opinion, it would be interesting to develop a pedagogical approach to the language development theme in the form of tutorials, books, or presentations. Maybe even a teaching language with a simplified version of syntax/parse. The goal would be both to lower the entry barrier to the most interesting aspects of the Racket universe, and to gain insight by teaching, i.e. find better ways to do things in the future. Konrad. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] the Racket manifesto
On Mar 26, 2015, at 7:42 AM, Konrad Hinsen wrote: In my opinion, it would be interesting to develop a pedagogical approach to the language development theme in the form of tutorials, books, or presentations. Maybe even a teaching language with a simplified version of syntax/parse. The goal would be both to lower the entry barrier to the most interesting aspects of the Racket universe, and to gain insight by teaching, i.e. find better ways to do things in the future. As you probably realize, this is the suggestion -- in more words -- that is mentioned in the conclusion, and academics who know us will interpret this code in exactly this way. The idea has been on my mind for years. Three years ago I opened a notes file to get this going by 2015. Sadly, there are no entries since 2013 and overall there are only two entries overall. But yes, section 3 is the hard part and work on 4 and 5 is substitution as Daniel Kahneman would say. -- Matthias -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Re: Why are SQLITE queries so slow?
On 3/26/2015 10:16 AM, Renaud wrote: Thanks a lot George, for this insightful reply. Your idea about FFI explaining 95% of the overhead looks good... but i wonder: in this case, shouldn't we also see a high cost in bind-prepared-statement alone? Hi Renaud, I'm not sure exactly what you are asking, so forgive me if I'm telling you what you already know. There is some overhead for every function call, and for foreign functions there is some additional FFI translation cost which is relative to the amount and types of data involved. In Racket [and generally in Lisp family languages] most data has embedded type tags that must be removed to pass arguments to a foreign call, and conversely tags must be added to data returned from the foreign call. SQL normally is compiled to bytecode for execution. Sqlite simply interprets the bytecode, but many larger DBMS will further JIT compile to native code when a statement is prepared. If you only use a prepared statement only once, you save nothing and, in fact, there will be a slight loss vs immediate execution due to the addition of the separate argument binding step. It also costs memory to cache the compiled code in the DBMS (which for sqlite is in your own process space). However, the more times you reuse a prepared statement, the less will be the amortized cost of compiling it, and because you send the SQL statement only once, you also progressively move less data. So if, e.g., you convert 10 immediate statements into 1 prepared statement with 10 executions: * you avoid 9 sends and compiles of the SQL statement * you add 10 bind function calls, but the net amount of argument and response data remains the same. The number of bind calls that balances the send and compile overhead is statement dependent. However, every send/compile you avoid buys you that many more bind calls, so once you pass that initial balancing point, you have a net performance gain from using the prepared statement. I know this is little help in analyzing your situation, but I hope it at least answers your question :-) George -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
On Thu, Mar 26, 2015 at 3:56 PM, John Clements cleme...@brinckerhoff.org wrote: On Mar 25, 2015, at 6:55 PM, Jon Zeppieri zeppi...@gmail.com wrote: I recently uploaded Gregor, a date and time library, to the package server. Can I use this instead of SRFI 19? That would be wonderful. John Clements Please do, and let me know what additions or changes you'd like. -Jon -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
This is so awesome. Jay On Wed, Mar 25, 2015 at 9:55 PM, Jon Zeppieri zeppi...@gmail.com wrote: I recently uploaded Gregor, a date and time library, to the package server. Features: - representations for and generic operations on: - dates - times (as in, time-of-day) - datetimes (combined date and time) - moments (combined datetime and IANA/Olson timezone) - date arithmetic - localized formatting and parsing, using CLDR data As you might expect from the name, Gregor uses a (proleptic) Gregorian calendar. Documentation: http://pkg-build.racket-lang.org/doc/gregor/index.html Source and bug tracking: https://github.com/97jaz/gregor -Jon -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Jay McCarthy http://jeapostrophe.github.io Wherefore, be not weary in well-doing, for ye are laying the foundation of a great work. And out of small things proceedeth that which is great. - DC 64:33 -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
At Thu, 26 Mar 2015 14:30:28 -0400, Jon Zeppieri wrote: On Thu, Mar 26, 2015 at 10:51 AM, Vincent St-Amour stamo...@ccs.neu.edu wrote: This is really cool! Do you have plans for operations on durations? Vincent More vague thoughts than plans. So-- there's a useful distinction (that comes out of Joda-Time) between a duration, which is directly convertible to some number of (nano)seconds, and a period, which contains units like years and months that have no fixed duration. The Gregor function `duration-between` actually computes a period, according to this terminology. This raises a few questions (for me, anyhow): - Is a duration data structure, distinct from some number of nanoseconds, useful? In Joda it seems largely a way of (a) adding convenience functions for translating some number of years, months, days, etc. into a number of nanoseconds, and (b) converting some fixed duration to a period. Since both kinds of translation are lossy, I don't know how useful this is -- all the more so because, if we had some period data structure, we could always provide `period-nanoseconds`. I don't have much expertise in that domain, but having two closely related but subtly different concepts sounds like a bad idea. Since, IIUC, periods need to be anchored to a specific point in time, that would make them a bit more heavyweight to create. I could see durations being nice for that reason, and their use may not be too problematic if they're only used up to the week level, up to which there are reasonable, uniform conversion factors. (I.e. for dealing with unanchored durations, ignoring leap seconds is probably fine.) Of course, this could also potentially be adressed by providing a shortcut for creating periods where one doesn't care about anchoring. - Assuming that periods are useful, what operations on them do we want? Arithmetic, probably; maybe the `period-nanoseconds` function I just mentioned; maybe convenience functions based on the current time (e.g., `ago`, `from-now`). Anything else? I think arithmetic is really the big one. - How do we represent a period? The obvious choice: (struct period (sign years months ...)) - Then what happens to the interface of `duration-between`? Maybe it returns a period where non-requested field values are #f. Do I still request fields by providing a list of symbols? I do like the fact that, in the current interface, the symbol you pass in to request that a field appear in the output is the key that you use to access that field in the result (which is currently an alist). It's not that I love alists, but I haven't come up with a struct-based interface that I like better. So maybe a period just is an alist (as described by the range contract of `duration-between`)? I think a struct that implements `gen:dict` would be a nicer interface. I don't really like `duration-between`'s current interface. Again, really cool work! Vincent -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
On Thu, Mar 26, 2015 at 4:57 PM, Vincent St-Amour stamo...@ccs.neu.edu wrote: At Thu, 26 Mar 2015 14:30:28 -0400, Jon Zeppieri wrote: [ snip] Since, IIUC, periods need to be anchored to a specific point in time, that would make them a bit more heavyweight to create. I could see durations being nice for that reason, and their use may not be too problematic if they're only used up to the week level, up to which there are reasonable, uniform conversion factors. (I.e. for dealing with unanchored durations, ignoring leap seconds is probably fine.) The anchor really only needs to be supplied when you do something with a period -- so it doesn't need to be part of the data structure. You can carry around a bucket that says 5 years, 3 weeks, and 40 hours, but the precise number of seconds inside the bucket is indeterminate until you pour it over a date-provider. (No, not a great metaphor.) - Assuming that periods are useful, what operations on them do we want? Arithmetic, probably; maybe the `period-nanoseconds` function I just mentioned; maybe convenience functions based on the current time (e.g., `ago`, `from-now`). Anything else? I think arithmetic is really the big one. Yep. - How do we represent a period? The obvious choice: I think a struct that implements `gen:dict` would be a nicer interface. I don't really like `duration-between`'s current interface. I like that idea. Again, really cool work! Vincent Thanks! -Jon -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
On Thu, Mar 26, 2015 at 4:13 PM, Jon Zeppieri zeppi...@gmail.com wrote: You can carry around a bucket that says 5 years, 3 weeks, and 40 hours, but the precise number of seconds inside the bucket is indeterminate until you pour it over a date-provider. (No, not a great metaphor.) I have a feeling I'm going to regret this :), but why can't you know the precise number of seconds in that case? Is it because of leap years? Would 3 weeks and 40 hours always be a precise number of seconds? Robby -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
On Thu, Mar 26, 2015 at 5:27 PM, Robby Findler ro...@eecs.northwestern.edu wrote: On Thu, Mar 26, 2015 at 4:13 PM, Jon Zeppieri zeppi...@gmail.com wrote: You can carry around a bucket that says 5 years, 3 weeks, and 40 hours, but the precise number of seconds inside the bucket is indeterminate until you pour it over a date-provider. (No, not a great metaphor.) I have a feeling I'm going to regret this :), but why can't you know the precise number of seconds in that case? Is it because of leap years? Would 3 weeks and 40 hours always be a precise number of seconds? Robby Yes, leap years. 3 weeks and 40 hours will always have a fixed number of seconds, but not 5 years. Similarly, N months doesn't have a fixed duration, because months can be 28, 29, 30, or 31 days long. -Jon -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
This is really cool! Do you have plans for operations on durations? Vincent At Wed, 25 Mar 2015 21:55:31 -0400, Jon Zeppieri wrote: I recently uploaded Gregor, a date and time library, to the package server. Features: - representations for and generic operations on: - dates - times (as in, time-of-day) - datetimes (combined date and time) - moments (combined datetime and IANA/Olson timezone) - date arithmetic - localized formatting and parsing, using CLDR data As you might expect from the name, Gregor uses a (proleptic) Gregorian calendar. Documentation: http://pkg-build.racket-lang.org/doc/gregor/index.html Source and bug tracking: https://github.com/97jaz/gregor -Jon -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] the Racket manifesto
Matthias Felleisen writes: Here we go: 0. open drracket 1. type ( 2. hit return 3. stare at the two spaces of indentation in sheer amazement 4. relax, type ) Smile. Now you're a Racketeer. Thanks - now I feel enlightened! A web site is an ad. As is a research paper. It's the audience that differs. It is for the programmer looking for a productive tool. As such, the site needs to clarify that -- Racket is an ordinary programming language (see sentence 1 in section 3) -- it brings something to the table that is an increment over others (full-spectrum) (see section 4 plus section 5) -- you can do truly unusual things with it (grow your language) (see section 3) I'd say it does (1) very well, (2) reasonably well, and (3) not at all. If you know about (3) you can find the details, but even that requires some effort. Konrad. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Projects (was: the Racket manifesto)
Thanks, that clarifies the point. The manifesto maybe puts it too strictly indeed. On Thu, Mar 26, 2015 at 1:58 PM, Matthias Felleisen matth...@ccs.neu.edu wrote: Thanks for sending this, again. I was writing a response very much along these lines when your post came in. 1. No, we cannot and will not replace all tools. Quite the opposite, I foresee a future in which we will produce many more tools. [Your effort will make me think twice before I write a DrRacket or a Racket tool.] 2. Yes, we will reconsider every tool and question whether it is a tool or ought to be a linguistic construct We will question whether it is a mandatory part of the tool chain or whether it is an option. Finding this balance is hard, and the essay couldn't address this point well. [I may try my hand on a clarification if I find time today.] On Mar 26, 2015, at 9:45 AM, Greg Hendershott greghendersh...@gmail.com wrote: I didn't understand the manifesto as saying Racket should try to be a lisp machine or OS (we already have Emacs for that :)) or that all external tools are bad (despite what I wrote quickly; sorry). Instead I understood it to mean, let's minimize gratuitous tools that do stuff that would be more naturally handled in the langauge itself. I've used languages where you have to Create a Project before you can write hello, world. I've used languages that assume you'll use their special IDE, to the point where it's challenging to be effective using Emacs. I've used languages where source files are littered with auto-generated code and change this part but not that part! comments. I understood the manifesto to mean, hey, we can do better than that. Even if we can't do better 100% of the time, let's make that as the starting assumption and the eventual goal. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
Gregor shares the near-universal disdain for UTC exhibited by operating systems and date/time libraries alike. Seriously, though: Gregor doesn't keep UTC time, so there are no leap seconds. I mentioned in the docs that if there's a real demand for UTC, I'll implement it. - Jon On Mar 26, 2015, at 5:41 PM, Jens Axel Søgaard jensa...@soegaard.net wrote: 2015-03-26 22:30 GMT+01:00 Jon Zeppieri zeppi...@gmail.com: On Thu, Mar 26, 2015 at 5:27 PM, Robby Findler Would 3 weeks and 40 hours always be a precise number of seconds? Robby What about leap seconds? /Jens Axel -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
On Thu, Mar 26, 2015 at 10:51 AM, Vincent St-Amour stamo...@ccs.neu.edu wrote: This is really cool! Do you have plans for operations on durations? Vincent More vague thoughts than plans. So-- there's a useful distinction (that comes out of Joda-Time) between a duration, which is directly convertible to some number of (nano)seconds, and a period, which contains units like years and months that have no fixed duration. The Gregor function `duration-between` actually computes a period, according to this terminology. This raises a few questions (for me, anyhow): - Is a duration data structure, distinct from some number of nanoseconds, useful? In Joda it seems largely a way of (a) adding convenience functions for translating some number of years, months, days, etc. into a number of nanoseconds, and (b) converting some fixed duration to a period. Since both kinds of translation are lossy, I don't know how useful this is -- all the more so because, if we had some period data structure, we could always provide `period-nanoseconds`. - Assuming that periods are useful, what operations on them do we want? Arithmetic, probably; maybe the `period-nanoseconds` function I just mentioned; maybe convenience functions based on the current time (e.g., `ago`, `from-now`). Anything else? - How do we represent a period? The obvious choice: (struct period (sign years months ...)) - Then what happens to the interface of `duration-between`? Maybe it returns a period where non-requested field values are #f. Do I still request fields by providing a list of symbols? I do like the fact that, in the current interface, the symbol you pass in to request that a field appear in the output is the key that you use to access that field in the result (which is currently an alist). It's not that I love alists, but I haven't come up with a struct-based interface that I like better. So maybe a period just is an alist (as described by the range contract of `duration-between`)? I am absolutely open to any thoughts you, or anyone else on the list, has. Since this conversation might not be of general interest, we could move it over to gregor's github site and use the issue tracker. Most of all, thank you for your interest. -Jon At Wed, 25 Mar 2015 21:55:31 -0400, Jon Zeppieri wrote: I recently uploaded Gregor, a date and time library, to the package server. Features: - representations for and generic operations on: - dates - times (as in, time-of-day) - datetimes (combined date and time) - moments (combined datetime and IANA/Olson timezone) - date arithmetic - localized formatting and parsing, using CLDR data As you might expect from the name, Gregor uses a (proleptic) Gregorian calendar. Documentation: http://pkg-build.racket-lang.org/doc/gregor/index.html Source and bug tracking: https://github.com/97jaz/gregor -Jon -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
BTW, the ISO 8601 standard (I don't mean the trivial ISO 8601 date/time format everybody knows) has done a lot on concepts you might want to look at. Beware that ISO 8601 is big, and there is some baffling stuff included, but you can't always tell what is important. One thing I can tell you is that the non-Gregorian week-date calendar actually does get used, even in the US (regulatory purposes, no less), and there is actually Racket server code in production right now that has to do week-dates. (If looking at ISO 8601, be sure to check out the fun pathological set of partial date and time formats, in the three calendars that they support. I implemented it years ago, but it got back-burnered before I finished implementing arbitrary arithmetic between different calendars and different time point resolutions.) Neil V. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
I've used a library like this before [https://github.com/jeremyw/stamp], and realized that there were two things I didn't like about it: (1) potential ambiguity in the (user-)chosen exemplar date/time and (2) my tendency to mistake the exemplar date for an actual piece of data in the program. Go's approach probably helps with both problems. On Thu, Mar 26, 2015 at 6:43 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: On Thu, Mar 26, 2015 at 4:26 PM Jon Zeppieri zeppi...@gmail.com wrote: On Thu, Mar 26, 2015 at 3:56 PM, John Clements cleme...@brinckerhoff.org wrote: On Mar 25, 2015, at 6:55 PM, Jon Zeppieri zeppi...@gmail.com wrote: I recently uploaded Gregor, a date and time library, to the package server. Can I use this instead of SRFI 19? That would be wonderful. John Clements Please do, and let me know what additions or changes you'd like. One cool feature I've seen [1] is formatting dates based on existing formatted dates. IOW, something like this: (~t (today) 1/1/2000) [1] Go does a variant of this but it looks like it has to be one specific date in 2006: http://golang.org/pkg/time/#pkg-constants -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] adapting workflow to `raco pkg install --clone ...`
I'm confused about how local package development is supposed to work with `raco pkg install --clone`. This is turning into a deterrent to diagnosing fixing bugs, and an encouragement to post issues so others can fix them. In the dark ages, one would a) fork the main Racket repo on GitHub, b) work on a clone of that fork locally, and occasionally c) make pull requests, or d) update the fork from the upstream master. (A process well documented by Greg Hendershott [1]) I've read the new documentation about clone workflow. [2] And when I do this: raco pkg install --clone typed-racket It works as advertised. But I end up with a clone of the main typed-racket repo. Which is not what I want, because I'm not a core committer. Right? So I fork it on Github to http://github.com/mbutterick/typed-racket. But when I try to use this fork as my git-pkg-source: raco pkg install --clone typed-racket https://github.com/mbutterick/typed-racket ... it doesn't work. I get a ton of build errors. Scrutiny reveals that the default URL for `raco install --clone ...` looks more like this: git://github.com/racket/typed-racket/?path=typed-racket So I change my URL accordingly: raco pkg install --clone typed-racket git://github.com/mbutterick/typed-racket/?path-typed-racket But it still doesn't work. So either I'm overlooking something obvious in the syntax, or something subtle in how the model has changed. [1] http://www.greghendershott.com/2013/04/a-guide-for-infrequent-contributors-to-racket.html [2] http://www.cs.utah.edu/plt/snapshots/current/doc/pkg/git-workflow.html -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
On Thu, Mar 26, 2015 at 5:30 PM, Jon Zeppieri zeppi...@gmail.com wrote: 3 weeks and 40 hours will always have a fixed number of seconds... And this is because Gregor isn't faithful to UTC, of course. Otherwise, this wouldn't be true. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
On Thu, Mar 26, 2015 at 4:31 PM, Jon Zeppieri zeppi...@gmail.com wrote: On Thu, Mar 26, 2015 at 5:30 PM, Jon Zeppieri zeppi...@gmail.com wrote: 3 weeks and 40 hours will always have a fixed number of seconds... And this is because Gregor isn't faithful to UTC, of course. Otherwise, this wouldn't be true. Right; I noticed that in the docs. Sorry, should have mentioned that. Robby -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
On Mar 25, 2015, at 6:55 PM, Jon Zeppieri zeppi...@gmail.com wrote: I recently uploaded Gregor, a date and time library, to the package server. Can I use this instead of SRFI 19? That would be wonderful. John Clements Features: - representations for and generic operations on: - dates - times (as in, time-of-day) - datetimes (combined date and time) - moments (combined datetime and IANA/Olson timezone) - date arithmetic - localized formatting and parsing, using CLDR data As you might expect from the name, Gregor uses a (proleptic) Gregorian calendar. Documentation: http://pkg-build.racket-lang.org/doc/gregor/index.html Source and bug tracking: https://github.com/97jaz/gregor -Jon -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
On Thu, Mar 26, 2015 at 5:27 PM, Robby Findler ro...@eecs.northwestern.edu wrote: On Thu, Mar 26, 2015 at 4:13 PM, Jon Zeppieri zeppi...@gmail.com wrote: You can carry around a bucket that says 5 years, 3 weeks, and 40 hours, but the precise number of seconds inside the bucket is indeterminate until you pour it over a date-provider. (No, not a great metaphor.) I have a feeling I'm going to regret this :), but why can't you know the precise number of seconds in that case? Is it because of leap years? Would 3 weeks and 40 hours always be a precise number of seconds? Robby Yes, leap years. 3 weeks and 40 hours will always have a fixed number of seconds, but not 5 years. Similarly, N months doesn't have a fixed duration, because months can be 28, 29, 30, or 31 days long. -Jon -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
On Thu, Mar 26, 2015 at 4:13 PM, Jon Zeppieri zeppi...@gmail.com wrote: You can carry around a bucket that says 5 years, 3 weeks, and 40 hours, but the precise number of seconds inside the bucket is indeterminate until you pour it over a date-provider. (No, not a great metaphor.) I have a feeling I'm going to regret this :), but why can't you know the precise number of seconds in that case? Is it because of leap years? Would 3 weeks and 40 hours always be a precise number of seconds? Robby -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
2015-03-26 22:30 GMT+01:00 Jon Zeppieri zeppi...@gmail.com: On Thu, Mar 26, 2015 at 5:27 PM, Robby Findler Would 3 weeks and 40 hours always be a precise number of seconds? Robby What about leap seconds? /Jens Axel -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
On Thu, Mar 26, 2015 at 4:31 PM, Jon Zeppieri zeppi...@gmail.com wrote: On Thu, Mar 26, 2015 at 5:30 PM, Jon Zeppieri zeppi...@gmail.com wrote: 3 weeks and 40 hours will always have a fixed number of seconds... And this is because Gregor isn't faithful to UTC, of course. Otherwise, this wouldn't be true. Right; I noticed that in the docs. Sorry, should have mentioned that. Robby -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Why are SQLITE queries so slow?
Did you subtract the startup cost of Racket to get the time of the queries? /Jens Axel 2015-03-26 19:29 GMT+01:00 Renaud renaud.gomb...@gmail.com: Le jeudi 26 mars 2015 19:21:11 UTC+1, Jens Axel Søgaard a écrit : How did you time the queries? /Jens Axel 2015-03-25 15:03 GMT+01:00 Renaud renaud: Hi, I'm new to Racket, and i would like to know why sqlite queries are so slow in my test program. This program imports some data from a text file into a simple sqlite DB. It takes 35s with the INSERT queries and 5-6s without them. I've done the same thing with other languages, all do far better. For example with perl the same code runs in 8s with the queries, and 2-3s with them. I know that startup and regex are (reasonably ?) slower in racket, but queries seems to be very slow. Am i doing somethin wrong? Thanks for your help. test done by swapping the commented line with the next. Code : - #!/usr/bin/env racket #lang racket/base (require racket/list racket/string db/base db/sqlite3) (define DBFILE database.rkt.sql) (define rx #rx[~^]+) (define sdb #f) (define (openDatas) (unless sdb (set! sdb (sqlite3-connect #:database DBFILE (define (importDatas) (when (file-exists? DBFILE) (delete-file DBFILE)) (set! sdb (sqlite3-connect #:database DBFILE #:mode 'create)) (start-transaction sdb) (query-exec sdb CREATE TABLE groups (fam INTEGER, name STRING , PRIMARY KEY (fam))) (query-exec sdb CREATE TABLE foods (alim INTEGER, fam INTEGER, name STRING , PRIMARY KEY (alim))) (query-exec sdb CREATE TABLE nutrients (nutr INTEGER, unit STRING, short STRING, name STRING , PRIMARY KEY (nutr))) (query-exec sdb CREATE TABLE contents (alim INTEGER, nutr INTEGER, val FLOAT , PRIMARY KEY (alim, nutr))) (process-file FD_GROUP.txt groups2) (process-file FOOD_DES.txt foods 3) (process-file NUTR_DEF.txt nutrients 4) (process-file NUT_DATA.txt contents 3) (commit-transaction sdb)) (define (process-file fname table nb) (define Q (prepare sdb (string-append INSERT INTO table VALUES ( (string-join (for/list ([x nb]) ?) ,) (call-with-input-file fname (lambda (file) (for ([line (in-port read-line file)]) ;(bind-prepared-statement Q (take (regexp-split rx line 1) nb)) (query-exec sdb (bind-prepared-statement Q (take (regexp-split rx line 1) nb))) (importDatas) - -- Jens Axel Søgaard Hi Jens Axel, I just used time ./my-script.rkt with the given code, then after swapping the comment near the bottom : ;(bind-prepared-statement Q (take (regexp-split rx line 1) nb)) (query-exec sdb (bind-prepared-statement Q (take (regexp-split rx line 1) nb))) vs. (bind-prepared-statement Q (take (regexp-split rx line 1) nb)) ;(query-exec sdb (bind-prepared-statement Q (take (regexp-split rx line 1) nb))) Crude... i know... -- -- Jens Axel Søgaard -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
BTW, the ISO 8601 standard (I don't mean the trivial ISO 8601 date/time format everybody knows) has done a lot on concepts you might want to look at. Beware that ISO 8601 is big, and there is some baffling stuff included, but you can't always tell what is important. One thing I can tell you is that the non-Gregorian week-date calendar actually does get used, even in the US (regulatory purposes, no less), and there is actually Racket server code in production right now that has to do week-dates. (If looking at ISO 8601, be sure to check out the fun pathological set of partial date and time formats, in the three calendars that they support. I implemented it years ago, but it got back-burnered before I finished implementing arbitrary arithmetic between different calendars and different time point resolutions.) Neil V. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
On Thu, Mar 26, 2015 at 2:57 PM, Vincent St-Amour stamo...@ccs.neu.edu wrote: At Thu, 26 Mar 2015 14:30:28 -0400, Jon Zeppieri wrote: On Thu, Mar 26, 2015 at 10:51 AM, Vincent St-Amour stamo...@ccs.neu.edu wrote: - Is a duration data structure, distinct from some number of nanoseconds, useful? In Joda it seems largely a way of (a) adding convenience functions for translating some number of years, months, days, etc. into a number of nanoseconds, and (b) converting some fixed duration to a period. Since both kinds of translation are lossy, I don't know how useful this is -- all the more so because, if we had some period data structure, we could always provide `period-nanoseconds`. Having written a bunch of Python stuff using timeinterval, I'm maybe 98% of the time just trying to shift a date/time/datetime by X milliseconds, or find out how many milliseconds apart two things are. Representing that as a fancy structure has almost never been useful. The one or two times it has been handy are easily outweighed by all the extra typing it has cost me over the years. - Assuming that periods are useful, what operations on them do we want? Arithmetic, probably; maybe the `period-nanoseconds` function I just mentioned; maybe convenience functions based on the current time (e.g., `ago`, `from-now`). Anything else? I think arithmetic is really the big one. I can't remember ever needing to compute how many seconds there were in some user-friendly period representation. Usually I'm trying to avoid such things ever becoming seconds, because then I'll end up with the wrong answer sooner or later. {,micro,nano}seconds-between has been what I've wanted every time. On Thu, Mar 26, 2015 at 3:55 PM, Greg Hendershott greghendersh...@gmail.com wrote: - Assuming that periods are useful, what operations on them do we want? Arithmetic, probably; maybe the `period-nanoseconds` function I just mentioned; maybe convenience functions based on the current time (e.g., `ago`, `from-now`). Anything else? 1. For scheduling apps people often deal with things like Monday every 2 weeks, the 1st and 3rd Wednesday of every month, or the last Friday of every month. Maybe Gregor could do that? (Maybe parsing and formatting _text_ like that belongs in another package, I don't know.) Some sort of 1st and 3rd wednesday of every month starting from X sequence generator would be incredible. Parsing text like that hasn't ever come up for me, but I could imagine it being useful. 2. Another useful concept is weekdays. Or more generally (sorry) work days. So, a way to specify a set of excluded days (holidays). Of course some holidays have weird specifications (the 3rd Thursday of November) that could benefit from 1. Having a package provided implementation of this, and some holiday checking stuff (maybe with a database of common holidays) would simplify even further some of the programs I've got on my rewrite-in-racket list. Thanks so much for making this! -- Jay Kominek -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] ANN: Gregor, a date and time library
On Thu, Mar 26, 2015 at 10:51 AM, Vincent St-Amour stamo...@ccs.neu.edu wrote: This is really cool! Do you have plans for operations on durations? Vincent More vague thoughts than plans. So-- there's a useful distinction (that comes out of Joda-Time) between a duration, which is directly convertible to some number of (nano)seconds, and a period, which contains units like years and months that have no fixed duration. The Gregor function `duration-between` actually computes a period, according to this terminology. This raises a few questions (for me, anyhow): - Is a duration data structure, distinct from some number of nanoseconds, useful? In Joda it seems largely a way of (a) adding convenience functions for translating some number of years, months, days, etc. into a number of nanoseconds, and (b) converting some fixed duration to a period. Since both kinds of translation are lossy, I don't know how useful this is -- all the more so because, if we had some period data structure, we could always provide `period-nanoseconds`. - Assuming that periods are useful, what operations on them do we want? Arithmetic, probably; maybe the `period-nanoseconds` function I just mentioned; maybe convenience functions based on the current time (e.g., `ago`, `from-now`). Anything else? - How do we represent a period? The obvious choice: (struct period (sign years months ...)) - Then what happens to the interface of `duration-between`? Maybe it returns a period where non-requested field values are #f. Do I still request fields by providing a list of symbols? I do like the fact that, in the current interface, the symbol you pass in to request that a field appear in the output is the key that you use to access that field in the result (which is currently an alist). It's not that I love alists, but I haven't come up with a struct-based interface that I like better. So maybe a period just is an alist (as described by the range contract of `duration-between`)? I am absolutely open to any thoughts you, or anyone else on the list, has. Since this conversation might not be of general interest, we could move it over to gregor's github site and use the issue tracker. Most of all, thank you for your interest. -Jon At Wed, 25 Mar 2015 21:55:31 -0400, Jon Zeppieri wrote: I recently uploaded Gregor, a date and time library, to the package server. Features: - representations for and generic operations on: - dates - times (as in, time-of-day) - datetimes (combined date and time) - moments (combined datetime and IANA/Olson timezone) - date arithmetic - localized formatting and parsing, using CLDR data As you might expect from the name, Gregor uses a (proleptic) Gregorian calendar. Documentation: http://pkg-build.racket-lang.org/doc/gregor/index.html Source and bug tracking: https://github.com/97jaz/gregor -Jon -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Projects (was: the Racket manifesto)
One area where a notion of Project comes in handy is with cross-file refactoring. E.g. Right now I am in the midst of renaming a #:keyword and resorting to grep to find dependencies in other files. Is there a smarter existing way of doing this kind of thing in DrRacket? Or is this a use-case for further consideration (with or without the notion of projects)? Dan -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.