Re: [racket] Tutorial: writing a language (brainf*ck) in Racket

2011-06-20 Thread Danny Yoo
> It would be even better if you wrote it up as an optimization section. Ok. Added a preliminary draft of section 9.1, which talks about switching out the parameters used in the original implementation with syntax parameters. Also includes a brief tutorial on syntax parameters, because they're

Re: [racket] how do you raise a runtime error with source location information?

2011-06-20 Thread Sam Phillips
On Mon, Jun 20, 2011 at 20:38, Grant Rettke wrote: > On Mon, Jun 20, 2011 at 10:00 PM, Robby Findler > wrote: >> I don't know if there is one already that is a good match for what you >> want, but you can always use prop:exn:srclocs to make a new one. > > Feels like "Adding New Exception Types" o

Re: [racket] how do you raise a runtime error with source location information?

2011-06-20 Thread Grant Rettke
On Mon, Jun 20, 2011 at 10:00 PM, Robby Findler wrote: > I don't know if there is one already that is a good match for what you > want, but you can always use prop:exn:srclocs to make a new one. Feels like "Adding New Exception Types" oughta have its own section immediately following "9.2.4Bu

[racket] comment colors in DrRacket

2011-06-20 Thread Neil Van Dyke
Anyone have opinions on DrRacket's yellow default color for comments? Is it OK, great, lousy? If you want to email me directly, I will summarize responses. You could also mention if you use a background color other than white. (Reason for asking... I'm writing a new Emacs mode for Racket. I

Re: [racket] how do you raise a runtime error with source location information?

2011-06-20 Thread Robby Findler
I don't know if there is one already that is a good match for what you want, but you can always use prop:exn:srclocs to make a new one. Robby On Tue, Jun 21, 2011 at 10:40 AM, Danny Yoo wrote: > In my personal brainf*ck compiler, I've been using the function > "raise-syntax-error" to raise a run

[racket] how do you raise a runtime error with source location information?

2011-06-20 Thread Danny Yoo
In my personal brainf*ck compiler, I've been using the function "raise-syntax-error" to raise a runtime error, because I want to point at a given point in the text to blame. For example, when an operation causes the tape head to fall off into negative territory, I can point at the offending line a

[racket] Unit testing of contracts

2011-06-20 Thread Eduardo Bellani
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello list. I have a small set of contracts that I am thinking of turning into a planet package so I can use them across projects. My problem is, how do I use the rackunit framework to test them? Here is the first few contracts that I want to test: #

Re: [racket] Tutorial: writing a language (brainf*ck) in Racket

2011-06-20 Thread Danny Yoo
>> You'd want to do the following: >>  - add some bounds checking in `increment-ptr' and `decrement-ptr'. >>  - change the `vector' operations to their `unsafe-vector' counterparts. >>  - change `sub1' and `add1' to use `unsafe-fx+' and `unsafe-fx-' >>  - change `=' to `unsafe-fx=' >>  - change the

Re: [racket] Conversion of sexprs to strings?

2011-06-20 Thread Jens Axel Søgaard
2011/6/20 Kazimir Majorinc > Is there some built in like write-to-string in some dialects, or some trick > to avoid writing my own "code walker"? > > R5RS or R6RS if possible. Use http://docs.racket-lang.org/r6rs-lib-std/r6rs-lib-Z-H-9.html?q=open%20output%20string#node_idx_726 -- Jens Axel Sø

Re: [racket] Tutorial: writing a language (brainf*ck) in Racket

2011-06-20 Thread Danny Yoo
> > You'd want to do the following: >  - add some bounds checking in `increment-ptr' and `decrement-ptr'. >  - change the `vector' operations to their `unsafe-vector' counterparts. >  - change `sub1' and `add1' to use `unsafe-fx+' and `unsafe-fx-' >  - change `=' to `unsafe-fx=' >  - change the use

Re: [racket] Conversion of sexprs to strings?

2011-06-20 Thread Neil Van Dyke
Kazimir Majorinc wrote at 06/20/2011 01:51 PM: Is there some built in like write-to-string in some dialects, or some trick to avoid writing my own "code walker"? R5RS or R6RS if possible. For R5RS, you will want to add SRFI-6 to do this (you should always add SRFI-23 and SRFI-6 to R5RS), and

Re: [racket] Conversion of sexprs to strings?

2011-06-20 Thread Sam Tobin-Hochstadt
In general, `with-output-to-string' and other applications of string output ports work well here. On Mon, Jun 20, 2011 at 1:57 PM, Jay McCarthy wrote: > (format "~v" sexp) > > or > > (require racket/pretty) > (pretty-format sexp) > > 2011/6/20 Kazimir Majorinc : >> Is there some built in like wri

Re: [racket] Tutorial: writing a language (brainf*ck) in Racket

2011-06-20 Thread Sam Tobin-Hochstadt
On Mon, Jun 20, 2011 at 1:46 PM, Danny Yoo wrote: > > In more detail: the key performance issue was the inefficient use of > parameters.  I had wanted to make sure I was using a fresh state per > module, so I had set up a parameter called 'current-state' that was > parameterized over the body of t

Re: [racket] Conversion of sexprs to strings?

2011-06-20 Thread Jay McCarthy
(format "~v" sexp) or (require racket/pretty) (pretty-format sexp) 2011/6/20 Kazimir Majorinc : > Is there some built in like write-to-string in some dialects, or some trick > to avoid writing my own "code walker"? > > R5RS or R6RS if possible. > > > > > > ___

[racket] Conversion of sexprs to strings?

2011-06-20 Thread Kazimir Majorinc
Is there some built in like write-to-string in some dialects, or some trick to avoid writing my own "code walker"? R5RS or R6RS if possible. _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

Re: [racket] Tutorial: writing a language (brainf*ck) in Racket

2011-06-20 Thread Danny Yoo
> On Mon, Jun 20, 2011 at 7:28 AM, Stephen De Gabrielle > wrote: >> there's also a discussion going on here: >> >> http://reddit.com/comments/i1slm > > ...of internet quality (that's an oxymoron). Still, I'd be delighted if people upvoted the link. :) I did notice that the Reddit discussion w

Re: [racket] rackunit (success)

2011-06-20 Thread Anthony Carrico
On 06/20/2011 12:50 PM, Anthony Carrico wrote: > Sorry the thanks didn't go to the list, but actually there is more. I > think I'm reaching for a way to make sure it took that (success) code > path. That would be necessary to truly test such code. > In this case, you could return a particular valu

Re: [racket] rackunit (success)

2011-06-20 Thread Anthony Carrico
On 06/20/2011 12:40 PM, Anthony Carrico wrote: > On 06/20/2011 12:04 PM, Noel Welsh wrote: >> I.e. you don't need to signal success for a test to pass. > ... > I see, that makes sense. Thanks. Sorry the thanks didn't go to the list, but actually there is more. I think I'm reaching for a way to make

Re: [racket] rackunit (success)

2011-06-20 Thread Noel Welsh
You're correct, there is no success function in Rackunit. This will do: (lambda () 'ok) I.e. you don't need to signal success for a test to pass. People have experimented with test frameworks where you have to signal success, but it the general conclusion is that it's too much effort for the smal

[racket] rackunit (success)

2011-06-20 Thread Anthony Carrico
In rackunit, a cps interface like: (search where what found-proc not-found-proc) Could be tested like: (test-begin (search where what (lambda (value) (fail "found something")) (lambda () (check-true #t "not found" But, the second check would be nicer as (success "not fo

Re: [racket] TR Regression: Types for regexp operations

2011-06-20 Thread Richard Lawrence
Eli Barzilay writes: > There is a "submit bug report" in DrRacket's help menu. You can also > use bugs.racket-lang.org, though the former is better. Got it, thanks. _ For list-related administrative tasks: http://lists.racket-lang.org/listinf

Re: [racket] Tutorial: writing a language (brainf*ck) in Racket

2011-06-20 Thread Shriram Krishnamurthi
On Mon, Jun 20, 2011 at 7:28 AM, Stephen De Gabrielle wrote: > there's also a discussion going on here: > > http://reddit.com/comments/i1slm ...of internet quality (that's an oxymoron). Shriram _ For list-related administrative tasks: http://li

Re: [racket] Tutorial: writing a language (brainf*ck) in Racket

2011-06-20 Thread Stephen De Gabrielle
there's also a discussion going on here: http://reddit.com/comments/i1slm On Tue, Jun 14, 2011 at 4:33 PM, Danny Yoo wrote: >>> One thing that I want to do is upload it somewhere more permanently, >>> and to have all the documentation links work.  None of the >>> Racket-bound documentation lin

[racket] Fwd: K 2011: Call for Papers

2011-06-20 Thread Robby Findler
=                       K 2011    2nd International Workshop on the K Framework and its Applications              August 8-12, 2011, Cheile Gradistei, Romania

Re: [racket] Help understanding error: compile: access from an uncertified context to unexported variable from module

2011-06-20 Thread Marijn
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/17/11 14:34, Matthias Felleisen wrote: > > With this: > > #lang racket/load > (module macro racket > (provide dlist) > (define-syntax (dlist stx) >#`(shared ([x (make-link x)]) >x)) > (define-struct link (l))) > > (module use r

Re: [racket] sexp highlighting

2011-06-20 Thread Marijn
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/19/11 21:46, Eli Barzilay wrote: > Three hours ago, Nikita Zuev wrote: >> >> Oh, I've overlooked it. But it's 32bit, I've 64bit >> distribution. I'll try in virtualbox then. > > You can try the fedora x86_64 installer -- as the comment says for