[racket] xmlrpc with racket problem

2010-09-09 Thread Tobias Salzmann
Hello, I have a problem with the xmlrpc from planet system. firstly my source code: Server: --- #lang racket (require (planet schematics/xmlrpc:4:0/xmlrpc-module-servlet)) (provide interface-version manager timeout start) (define add (lambda (x y) (+ x

Re: [racket] Looking for feedback on code style

2010-09-09 Thread Noel Welsh
On Thu, Sep 9, 2010 at 5:03 PM, Prabhakar Ragde wrote: > Our attitude towards randomness in computer science is a bit strange. I'm > convinced most of our students graduate thinking that Quicksort is an O(n > log n) algorithm, but this is only true in a probabilistic model. "What is the average a

Re: [racket] Literate Programming and Scribble

2010-09-09 Thread Neil Van Dyke
Eli Barzilay wrote at 09/09/2010 11:31 PM: On Sep 9, Neil Van Dyke wrote: If the math source format is in TeX syntax (which most people would say it should be), I'd think that you could avoid computing the secure hash, and just use an escaped variation of the TeX syntax string as the filen

Re: [racket] Literate Programming and Scribble

2010-09-09 Thread Eli Barzilay
On Sep 9, Neil Van Dyke wrote: > Eli Barzilay wrote at 09/09/2010 10:21 PM: > > * Compute some "unique" checksum of this content (eg, its sha1) to > > be used as the file name, > > If the math source format is in TeX syntax (which most people would > say it should be), I'd think that you co

Re: [racket] Looking for feedback on code style

2010-09-09 Thread Eli Barzilay
On Sep 9, David Van Horn wrote: > On 9/9/10 11:26 AM, Eli Barzilay wrote: > > On Sep 9, David Van Horn wrote: > >> > >> [...] As for the structure of the code as given, I would use helper > >> functions in place of the `let'. The resulting code will be easier > >> to read and the helper function

Re: [racket] Literate Programming and Scribble

2010-09-09 Thread Karl Winterling
Eli Barzilay wrote: Using images sound like the usual fragile solution, so ideally there will be some better solution for both latex/pdf and html in the future. (But it's been more than a decade that math-in-a-browser is "just around the corner".) There's MathJax (http://www.mathjax.org) whic

Re: [racket] Looking for feedback on code style

2010-09-09 Thread Neil Van Dyke
[...] As for the structure of the code as given, I would use helper functions in place of the `let'. The resulting code will be easier to read and the helper functions can be tested independently, [...] Sounds like an overkill in this case, and for most values of "idiomatic" I'd say that

Re: [racket] Literate Programming and Scribble

2010-09-09 Thread Neil Van Dyke
Eli Barzilay wrote at 09/09/2010 10:21 PM: * Compute some "unique" checksum of this content (eg, its sha1) to be used as the file name, If the math source format is in TeX syntax (which most people would say it should be), I'd think that you could avoid computing the secure hash, and

Re: [racket] Looking for feedback on code style

2010-09-09 Thread David Van Horn
On 9/9/10 11:26 AM, Eli Barzilay wrote: On Sep 9, David Van Horn wrote: [...] As for the structure of the code as given, I would use helper functions in place of the `let'. The resulting code will be easier to read and the helper functions can be tested independently, making it easier to main

Re: [racket] Literate Programming and Scribble

2010-09-09 Thread Eli Barzilay
On Sep 9, Patrick King wrote: > > I have been using OpenOffice Math module, and pasting screen > scrapings into PNG files. Definitely, something more elegant and > less labor intensive is needed. Even easier access to fonts on the > fly would help. Using images sound like the usual fragile sol

Re: [racket] Literate Programming and Scribble

2010-09-09 Thread Patrick King
On Thu, Sep 9, 2010 at 4:23 PM,Deren Dohoda wrote: > I am sorry to ask such introductory questions, but it's killing me to > see "literate programming" in Racket while finding myself unable to > use it. I love noweb and all, but I am writing a literate Racket > program and, well, I'd like to use

Re: [racket] querying for compile-time information

2010-09-09 Thread Ryan Culpepper
One way is a compile-time table. See, for example, the implementation of typed scheme/racket: www.ccs.neu.edu/scheme/pubs/scheme2007-ctf.pdf Except instead of being indexed by identifier, the table should be indexed by module. Probably the simplest way to represent a module is by its resolved

Re: [racket] querying for compile-time information

2010-09-09 Thread Sam Tobin-Hochstadt
On Thu, Sep 9, 2010 at 4:56 PM, Danny Yoo wrote: > I'm trying to figure out how to query a module for compile-time > information. I think you could use the 'module-language property and `module->language-info' to communicate this information, although that isn't its intended purpose. -- sam th s

[racket] querying for compile-time information

2010-09-09 Thread Danny Yoo
I'm trying to figure out how to query a module for compile-time information. I've got some toy code here: http://github.com/dyoo/permissions Basically, I want to annotate a module with permissions that the module requires. I'm defining a permission to be a literal string for the moment. I

Re: [racket] [offtopic] fonts with math symbols

2010-09-09 Thread Noel Welsh
Try the fonts that come with MathJax: http://www.mathjax.org/ BTW, MathJax is what all the cool kids use to display Latex equations in their web pages. Someone might want to use it for a Scribble backend that supports equations in Latex and HTML. N. On Thu, Sep 9, 2010 at 7:38 PM, Jon Rafkind

Re: [racket] Looking for feedback on code style

2010-09-09 Thread Prabhakar Ragde
On 9/9/10 1:27 PM, Will M. Farr wrote: Nevertheless, it sure feels like it's O(N) (I've experimented quite a bit with timing tests, and the simple argument about averages I gave before "feels right"). Your intuition is correct; it's a bit tricky, but not too tricky, to show that the algorithm

[racket] [offtopic] fonts with math symbols

2010-09-09 Thread Jon Rafkind
I am looking for a font I can use in Linux that has the majority of unicode mathematical symbols. I have been using DejavuSansMono but its missing a few glyphs. I thought maybe this crowd would have some tips (googling is hit and miss). One example of missing glyphs is the latest dejavu doesn

[racket] Literate Programming and Scribble

2010-09-09 Thread Deren Dohoda
I am sorry to ask such introductory questions, but it's killing me to see "literate programming" in Racket while finding myself unable to use it. I love noweb and all, but I am writing a literate Racket program and, well, I'd like to use Racket. 1) Is this intended correct flow: literate program i

Re: [racket] [redex] define list for metafunctions

2010-09-09 Thread Casey Klein
On Wed, Sep 8, 2010 at 10:36 AM, Eric Tanter wrote: > Hi, > > Is there a way to have the (define ...) dropdown button be customized for > define-metafunction, so that it displays the name of the metafunction instead > of just showing the language name? > The dropdown menu assumes that the first

Re: [racket] Looking for feedback on code style

2010-09-09 Thread Will M. Farr
On Sep 9, 2010, at 11:37 AM, Prabhakar Ragde wrote: > And then what? Are we justified in saying T(N) = T(3N/4) + O(N)? Really, we > have T(N) = T(X) + O(N), where X is a random variable uniformly distributed > over [0..N-1]. With a suitable induction hypothesis, we can dig ourselves out > of th

Re: [racket] Looking for feedback on code style

2010-09-09 Thread Prabhakar Ragde
On 9/9/10 12:09 PM, Phil Bewig wrote: I did treaps, too: http://programmingpraxis.com/2009/06/26/treaps/. And I use them all the time, including where most people probably use hash tables, because so often you need the keys in order somewhere in your program. I'm sorry, I shouldn't have said "

Re: [racket] Looking for feedback on code style

2010-09-09 Thread Prabhakar Ragde
Will M. Farr wrote: Looks like Phil beat me to it, but here's some code that finds the n-th element of a list in O(N) time. The algorithm is similar to quicksort, but you don't sort both the sub-lists: partition the list into elements less than and greater or equal to a pivot. By counting the

Re: [racket] Looking for feedback on code style

2010-09-09 Thread Will M. Farr
I should note that the code I posted also used randomness to select the pivot element, so the statements below apply to it, too. It's on average O(N) (where average can mean either "run many times on the same input" or "run on many inputs of length N"). Will On Sep 9, 2010, at 11:03 AM, Prabh

Re: [racket] Looking for feedback on code style

2010-09-09 Thread Phil Bewig
I did treaps, too: http://programmingpraxis.com/2009/06/26/treaps/. And I use them all the time, including where most people probably use hash tables, because so often you need the keys in order somewhere in your program. On Thu, Sep 9, 2010 at 11:03 AM, Prabhakar Ragde wrote: > On 9/9/10 11:33

Re: [racket] Looking for feedback on code style

2010-09-09 Thread Prabhakar Ragde
On 9/9/10 11:33 AM, Phil Bewig wrote: http://programmingpraxis.com/2009/12/11/selection/ This method takes O(n) time with high probability if the partitioning element is chosen deterministically and the data is randomly permuted (with all permutations equally likely) or if the partitioning el

Re: [racket] Looking for feedback on code style

2010-09-09 Thread David Van Horn
On 9/9/10 11:52 AM, Prabhakar Ragde wrote: Selection can be done in O(n) time regardless of the value of k. Ah, that's where I went wrong. I think I was confused by the Wikipedia text on introselect, where k is a constant (unrelated the kth smallest element). The idea is to split the n el

Re: [racket] Looking for feedback on code style

2010-09-09 Thread Prabhakar Ragde
On 9/9/10 11:26 AM, David Van Horn wrote: The original post got me interested in median algorithms and I started to read up on the selection problem. Wikipedia (I know, I know) says the same thing as you: medians can be computed in O(n) time and points to selection as the way to do it. But I don

Re: [racket] Looking for feedback on code style

2010-09-09 Thread Will M. Farr
David, Looks like Phil beat me to it, but here's some code that finds the n-th element of a list in O(N) time. The algorithm is similar to quicksort, but you don't sort both the sub-lists: partition the list into elements less than and greater or equal to a pivot. By counting the number of el

Re: [racket] Looking for feedback on code style

2010-09-09 Thread Phil Bewig
http://programmingpraxis.com/2009/12/11/selection/ On Thu, Sep 9, 2010 at 10:26 AM, David Van Horn wrote: > On 9/9/10 10:04 AM, Prabhakar Ragde wrote: > >> I don't think vectors help very much in this case (median-finding). For >> the given code, the O(n) access to the middle of the list is domin

Re: [racket] Looking for feedback on code style

2010-09-09 Thread David Van Horn
On 9/9/10 10:04 AM, Prabhakar Ragde wrote: I don't think vectors help very much in this case (median-finding). For the given code, the O(n) access to the middle of the list is dominated by the cost of the sorting, which is at least O(n log n) [*]. It is theoretically possible to compute the medi

Re: [racket] Looking for feedback on code style

2010-09-09 Thread Eli Barzilay
On Sep 9, David Van Horn wrote: > > [...] As for the structure of the code as given, I would use helper > functions in place of the `let'. The resulting code will be easier > to read and the helper functions can be tested independently, making > it easier to maintain and improve the likelihood t

Re: [racket] Looking for feedback on code style

2010-09-09 Thread David Van Horn
On 9/9/10 9:24 AM, Noel Welsh wrote: On Thu, Sep 9, 2010 at 1:09 PM, David Van Horn wrote: What!? What can I say -- I have low standards. Without a purpose statement, contract, or examples, it's difficult to know what this code is supposed to do, much less say if it is doing whatever it is

Re: [racket] Looking for feedback on code style

2010-09-09 Thread Prabhakar Ragde
Noel Welsh wrote: I think this is great code -- very clear. For production use you have the wrong data structure (Lists are O(n) random access and length; you want O(1) vectors), but that doesn't matter for your use. I don't think vectors help very much in this case (median-finding). For the

Re: [racket] Looking for feedback on code style

2010-09-09 Thread Noel Welsh
On Thu, Sep 9, 2010 at 1:09 PM, David Van Horn wrote: > What!? What can I say -- I have low standards. > Without a purpose statement, contract, or examples, it's difficult to know > what this code is supposed to do, much less say if it is doing whatever it > is supposed to do correctly. 'round

Re: [racket] Looking for feedback on code style

2010-09-09 Thread David Van Horn
On 9/9/10 3:51 AM, Noel Welsh wrote: On Thu, Sep 9, 2010 at 4:35 AM, Scott Hickey wrote: I was helping my son with his math homework tonight, working with medians and wrote the following below. As I was looking at it, I was wondering: ... I think this is great code -- very clear. What!? Wi

Re: [racket] does Racket need a global VM ?

2010-09-09 Thread Noel Welsh
On Thu, Sep 9, 2010 at 9:14 AM, Gaspard Bucher wrote: > I am working on an open source software called Rubyk (real-time signal > processing for art, http://rubyk.org) which currently supports Lua and other > specialized DSL scripting. Looks interesting. > 1. (ideal solution) Is it possible to ha

[racket] does Racket need a global VM ?

2010-09-09 Thread Gaspard Bucher
Hi there ! I am working on an open source software called Rubyk (real-time signal processing for art, http://rubyk.org) which currently supports Lua and other specialized DSL scripting. The scripts send and receive messages and should be totally encapsulated (concurrency, network transparency, et

Re: [racket] Looking for feedback on code style

2010-09-09 Thread Noel Welsh
On Thu, Sep 9, 2010 at 4:35 AM, Scott Hickey wrote: > I was helping my son with his math homework tonight, working with > medians and wrote the following below. As I was looking at it, I was > wondering: ... I think this is great code -- very clear. For production use you have the wrong data stru