Re: [racket] Racket 5.2.1 segfault

2012-02-29 Thread Kevin Tew
This is the magic incantation I use to use with valgrind. valgrind --tool=memcheck --db-attach=yes --vex-iropt-precise-memory-exns=yes --leak-check=full --num-callers=40 the --vex-iropt-precise-memory-exns=yes is important for running racket. Kevin On 02/29/2012 10:29 PM, Simon Haines wrote:

[racket] Racket 5.2.1 segfault

2012-02-29 Thread Simon Haines
I'm coming across a segfault when using racket 5.2.1 in some particular circumstances. Here is a sample to reproduce the problem: #!/home/simon/racket/bin/racket #lang racket/base (display "This is a test, designed to provoke an emotional response") When I chmod +x and run it, it runs just fine:

Re: [racket] What is the equivalent of ToExpression in Mathematica?

2012-02-29 Thread galapagos
  #lang racket(require mzlib/string) (define a "(* x x)")(define (makfunction s)  (eval-string (string-append    "(lambda (x) "    s    ")")))(define d (makfunction a));; The above line will not work when you press run.;; However, if you key it in the evaluation

Re: [racket] plot request/patch: independent control of y axis in density plots

2012-02-29 Thread Neil Toronto
On 02/29/2012 05:15 PM, John Clements wrote: Plot's new "density" function is awesome. I'd like to add something to it, though; independent control of the y axis. Here's the motivating scenario; I'm looking at server logs, to try to see which users are hammering the handin server hardest. Supp

Re: [racket] Splitting Racket source code by scope?

2012-02-29 Thread Matthias Felleisen
On Feb 29, 2012, at 6:38 PM, Rüdiger Asche wrote: > whether everything related to units is "merely" syntactic extensions (meaning > that at the end of the day, no additional runtime support is required) or not Units are a large 'macro'. I use quotes because Racket's macro system suffers from

Re: [racket] What is the equivalent of ToExpression in Mathematica?

2012-02-29 Thread Neil Van Dyke
Jens Axel Søgaard wrote at 02/29/2012 06:40 PM: (it takes a while for the library to install - it seems it old Schematics test suite takes forever to install these days - I need to switch to a builtin one). Overeasy is a quick PLaneT install, and has convenient syntax for most unit testing p

[racket] plot request/patch: independent control of y axis in density plots

2012-02-29 Thread John Clements
Plot's new "density" function is awesome. I'd like to add something to it, though; independent control of the y axis. Here's the motivating scenario; I'm looking at server logs, to try to see which users are hammering the handin server hardest. Suppose I take a list of numbers representing the

Re: [racket] Splitting Racket source code by scope?

2012-02-29 Thread Danny Yoo
On Wed, Feb 29, 2012 at 6:38 PM, Rüdiger Asche wrote: > ok, so the difference is between doing things in the upper respective lower > window - thanks for the instructions; if I follow them with my code > fragments, it works as well. Trying to do everything interactively (lower > pane) yields the e

Re: [racket] What is the equivalent of ToExpression in Mathematica?

2012-02-29 Thread Jens Axel Søgaard
2012/2/29 ashok bakthavathsalam > I am looking for something similar to > ToExpression > that > is available in Mathematica. I just want to convert a string to an > expression, and evaluate the expression. As a first pass, my strin

Re: [racket] Splitting Racket source code by scope?

2012-02-29 Thread Rüdiger Asche
ok, so the difference is between doing things in the upper respective lower window - thanks for the instructions; if I follow them with my code fragments, it works as well. Trying to do everything interactively (lower pane) yields the errors I described (btw it's the same behavior as when I run

Re: [racket] Splitting Racket source code by scope?

2012-02-29 Thread Danny Yoo
Oh, one more thing: make sure your language is set to "Determine Language from source". Almost all of the professional-level documentation in Racket assumes that DrRacket has been set up use the #lang line. Make sure DrRacket is in "Determine Language from source" mode. If you neglect to set up

Re: [racket] Splitting Racket source code by scope?

2012-02-29 Thread Danny Yoo
Hi Rüdiger, The top of all four files should have #lang racket at the very top. This declares the file to be a module in the full Racket language. Other documentation out there that are a few years old might refer to the older style of defining modules, where there's an outer "(module foo m

[racket] Fw: Splitting Racket source code by scope?

2012-02-29 Thread Rüdiger Asche
You wrote: --- As Matthias mentions, you can formally link together "units" together. Units are Racket's dependency-injection component framework. You can read documentation about them here: http://docs.racket-lang

Re: [racket] What is the equivalent of ToExpression in Mathematica?

2012-02-29 Thread David Van Horn
On 2/29/12 4:33 PM, Ashok Bakthavathsalam wrote: Will eval-string work even if the string is the normal mathematical notation? For example, "1+1" or "8*74-2" ? No, Racket is doing what Mathematica does. Mathematica interprets the string as an expression written in Mathematica, just as Racket

Re: [racket] What is the equivalent of ToExpression in Mathematica?

2012-02-29 Thread Danny Yoo
On Wed, Feb 29, 2012 at 4:33 PM, Ashok Bakthavathsalam wrote: > Will eval-string work even if the string is the normal mathematical > notation? > For example, "1+1" or "8*74-2" ? No, but there is an example in Racket's parser-tools library (parser-tools/examples/calc) that will parse very simple

Re: [racket] What is the equivalent of ToExpression in Mathematica?

2012-02-29 Thread Ashok Bakthavathsalam
Will eval-string work even if the string is the normal mathematical notation? For example, "1+1" or "8*74-2" ? On Thu, Mar 1, 2012 at 2:54 AM, David Van Horn wrote: > On 2/29/12 4:18 PM, ashok bakthavathsalam wrote: > >> I am looking for something similar to ToExpression >>

Re: [racket] What is the equivalent of ToExpression in Mathematica?

2012-02-29 Thread Neil Van Dyke
ashok bakthavathsalam wrote at 02/29/2012 04:18 PM: I am looking for something similar to ToExpression that is available in Mathematica. I just want to convert a string to an expression, and evaluate the expression. There is "ev

Re: [racket] What is the equivalent of ToExpression in Mathematica?

2012-02-29 Thread David Van Horn
On 2/29/12 4:18 PM, ashok bakthavathsalam wrote: I am looking for something similar to ToExpression that is available in Mathematica. I just want to convert a string to an expression, and evaluate the expression. As a first pass, my

[racket] What is the equivalent of ToExpression in Mathematica?

2012-02-29 Thread ashok bakthavathsalam
I am looking for something similar to ToExpression that is available in Mathematica. I just want to convert a string to an expression, and evaluate the expression. As a first pass, my strings will include only numbers and arithmetic op

Re: [racket] Is this a good design

2012-02-29 Thread David Van Horn
On 2/29/12 3:22 PM, Raoul Duke wrote: but *write it down*. How are we to know, as reader's of your contract and purpose statements, that we have to provide non-empty strings? er, can you make a new EmptyString type and use that in the contract part of the comment? What's a type? You can def

Re: [racket] Is this a good design

2012-02-29 Thread David Van Horn
On 2/29/12 3:17 PM, Roelof Wobben wrote: Oke, Wierd idea that input control is not neccesarly. I have tried C and C++ and they empasise to do input control. [But you were taking an inconsistent approach: you checked in the input was a string, but then assumed it was non-empty. If you're going

Re: [racket] Is this a good design

2012-02-29 Thread Raoul Duke
> but *write it down*.  How are we to know, as reader's of your contract and > purpose statements, that we have to provide non-empty strings? er, can you make a new EmptyString type and use that in the contract part of the comment? Racket Users list: http://lists.racket-l

Re: [racket] Is this a good design

2012-02-29 Thread Roelof Wobben
You ignored part of what Asumu said, which (to paraphrase) is that your program should live and die by its contract. When you write down: String -> String you're saying this program consumes a String and produces a String. If somebody applies your program to something that is *not* a stri

Re: [racket] Is this a good design

2012-02-29 Thread David Van Horn
On 2/29/12 2:42 PM, Roelof Wobben wrote: >> A couple of comments: >> >> * `string-first` (- instead of the _) is a more idiomatic naming Oke, changed that. >> * (eq? (string? s) true) is >> verbose. (string? s) already returns a boolean. I changed that , thanks for the tip. * Generally, w

Re: [racket] racket/db - query-rows: connection is permanently locked due to a terminated thread

2012-02-29 Thread Curtis Dutton
I've been running with the kill-safe-connection's for a few weeks now. This seems to have fixed the problem, or at least hidden it to a point that I no longer am affected by it. Thanks for your help. On Thu, Feb 2, 2012 at 2:53 AM, Ryan Culpepper wrote: > On 02/01/2012 10:09 PM, Curtis Dutton

Re: [racket] Racket consultants

2012-02-29 Thread Curtis Dutton
Sorry, I've been too busy to get to the email list. Just found this. I use racket extensively in my client work. The only trouble is, most of my work is website oriented, so my clients aren't much aware of it. Most of my clients are small business owners and I build/manage their web properties fo

Re: [racket] Is this a good design

2012-02-29 Thread Roelof Wobben
>> A couple of comments: >> >> * `string-first` (- instead of the _) is a more idiomatic naming Oke, changed that. >> * (eq? (string? s) true) is >> verbose. (string? s) already returns a boolean. I changed that , thanks for the tip. * Generally, when writing programs using the design recip

Re: [racket] Antw:Re: Is this a good design

2012-02-29 Thread Nick Shelley
One thing to consider: "if" takes a boolean value as the first part. The function "string?" evaluates to a boolean value, so you can just use this result directly instead of seeing if it is equal to "true." In other words, you could simplify the first part to (if (string? s) ...) In general, you

Re: [racket] Is this a good design

2012-02-29 Thread Asumu Takikawa
On 2012-02-29 19:14:48 +0100, ROELOF WOBBEN wrote: >;String -> String >;This function takes out the first character of a given string with the >name s >; given "roelof" expect "r" >; given "example" expect "e" >(define (string_first s) > (if (eq? (string? s) true) >

[racket] Antw:Re: Is this a good design

2012-02-29 Thread ROELOF WOBBEN
Oke, So no more points which can be better.RoelofOp 29/02/12, Joshua Ewulo schreef: Hello Roelof,It does what it says.JoshuaOn 29 February 2012 18:14, ROELOF WOBBEN > wrote: (define (string_first s)   ( if (eq? (string? s) true) (string-ith  s 0 )"You have not entered a string")) __

[racket] Is this a good design

2012-02-29 Thread ROELOF WOBBEN
Hello, I am now in the book How to design a programm second edition at the point I have to design functions.Now I wonder if I understand this part right so I have made this function. ;String -> String ;This function takes out the first character of a given string with the name s; given "roelof" exp

[racket] Antw:Re: if problem

2012-02-29 Thread ROELOF WOBBEN
What should happen when the length of the string is not greater than 0?The error message is reminding you to answer this question.CheersP. Oke, So then else part must be filled in.Thanks for the info.Roelof Racket Users list: http://lists.racket-lang.org/users

Re: [racket] if problem

2012-02-29 Thread Pierpaolo Bernardi
On Wed, Feb 29, 2012 at 12:14, ROELOF WOBBEN wrote: > Hello, > > I have made this : > > (define (string-insert s1 i) >   (if(> (string-length s1) 0)  (string-append (substring s1 0 i) "-" > (substring s1 i (string-length s1) > > But on the if I get a this message : > > if: expected a question

[racket] if problem

2012-02-29 Thread ROELOF WOBBEN
Hello, I have made this :(define (string-insert s1 i)  (if(> (string-length s1) 0)  (string-append (substring s1 0 i) "-" (substring s1 i (string-length s1)But on the if I get a this message : if: expected a question and two answers, but found only 2 partsSo I think that the if get sonehow mess