[racket] N queens, revisited

2010-06-11 Thread Matthias Felleisen


Horace and others who have tackled the N queens
problem in HtDP. Below find a first draft of an
exercise that will go into HtDP/2e. It demonstrates
the importance of formulating good data representations
especially with the use of (what we called) data
accumulators in HtDP/1e. Enjoy -- Matthias



You have solved the N queens problem using the
a seeminly natural representation of the board
as an N by N grid. Now you notice that your
solution takes quite some time. After thinking
about it for a while, you realize that two of
the operations on board representations are
critical

 -- finding those positions that are still safe
 -- placing a queen on a board

The key is to make these operations fast.

Once you have studied accumulators and especially
the notion of data accumulators (see Missionary
and Cannibals), you can tackle this problem easily.

Represent boards with data that keeps track of
all placed queens and all safe positions. For
the initial board, there are no queens and all
positions are safe. When you place a queen on
a board, you add the queen('s position) to the
collection of queens, but you also remove all
those positions from the collection of safe
positions that are now threatened. A board
thus constructed accumulates knowledge about
its construction.

Design the functions

 add-queen
 find-open-spots

for this data representation and re-use the
original solution with this representation.
(Hint: this solution should run at least 20x
faster than the previous one.)
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Feature Request: new-style requires in Student Languages

2010-06-11 Thread Matthias Felleisen


It will. This is an open feature request.

On Jun 11, 2010, at 3:58 PM, Todd O'Bryan wrote:


I'd like to move my students to using #lang declarations and require
statements, rather than loading teachpacks via the menu (mostly
because as they move between computers, different configurations cause
errors that are hard for them to understand).

Currently BSL (at least) only accepts old-style (require ...)
statements, at least for planet packages. Could it also allow
new-style?

Todd
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] buggy error information for keyword args in 5.0?

2010-06-12 Thread Matthias Felleisen

Don't hesitate. File reports. We'll close them if they are double entries. 

The key to a bug report: 

 -- describe the problem concisely 
 -- send a long a piece of code or a series of instructions for repeating the 
problem. 

Thanks -- Matthias





On Jun 12, 2010, at 9:15 PM, Todd O'Bryan wrote:

> Thanks for the quick service!
> 
> Should I just be filing bug reports for things like this, or is it
> good to mention them on the list? I hesitate to file most things,
> because I'm not always sure they're bugs, but this one was pretty
> obvious. (And if I'd searched I probably would have discovered it had
> already been filed, but Matthew might not have been reminded and fixed
> it so quickly.)
> 
> I guess my question is, for someone at my level of use (not a PLT
> developer by a long shot, but a pretty regular user) what should I do
> if I see something that looks like a bug?
> 
> Todd
> 
> On Sat, Jun 12, 2010 at 5:57 PM, Matthew Flatt  wrote:
>> Sorry that I lost track of that one --- fix pushed.
>> 
>> At Sat, 12 Jun 2010 17:37:32 -0400, Sam Tobin-Hochstadt wrote:
>>> This is PR 10954.
>>> 
>>> On Sat, Jun 12, 2010 at 5:32 PM, Todd O'Bryan  wrote:
 Here's a minimal example of what I think is a bug:
 
 #lang racket
 
 (define (blah #:foo foo #:bar bar)
  (+ foo 2))
 
 (blah #:bar 3)
 
 Running it causes:
 
 blah: requires an argument with keyword #:foo, not supplied; x:
 expects type  as 1st argument, given: 'x; other arguments were:
 '#:bar 3
 
 where the error information involving x is just bizarre. I'm guessing
 that's not intended behavior...
 
 Todd
 _
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users
 
>>> 
>>> 
>>> 
>>> --
>>> sam th
>>> sa...@ccs.neu.edu
>>> _
>>>   For list-related administrative tasks:
>>>   http://lists.racket-lang.org/listinfo/users
>> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] buggy error information for keyword args in 5.0?

2010-06-12 Thread Matthias Felleisen

Oh yes, "along" not "a long" :-) 


On Jun 12, 2010, at 10:07 PM, Eli Barzilay wrote:

> On Jun 12, Matthias Felleisen wrote:
>> Don't hesitate. File reports. We'll close them if they are double entries. 
>> 
>> The key to a bug report: 
>> 
>> -- describe the problem concisely 
>> -- send a long a piece of code or a series of instructions for
>>repeating the problem.
> 
> (That's probably a typo -- short pieces of code are much easier...)
> 
> -- 
>  ((lambda (x) (x x)) (lambda (x) (x x)))  Eli Barzilay:
>http://barzilay.org/   Maze is Life!

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Eval and "compile: unbound identifier (and no #%app syntax transformer is bound) in:"

2010-06-17 Thread Matthias Felleisen


I think Valeriya is using the Guide, to wit

 http://docs.racket-lang.org/guide/eval.html


> (eval '(+ 1 2))
  3


is the first example.




On Jun 17, 2010, at 1:05 PM, Robby Findler wrote:


Please see the Guide on eval.

Robby

On Thu, Jun 17, 2010 at 12:01 PM, Valeriya Pudova
 wrote:

Hi

With the Racket 5, this simple code

#lang scheme
(eval '(+ 1 2))

printout error

compile: unbound identifier (and no #%app syntax transformer is  
bound) in: +


What is wrong?

-- Valeriya

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Web Application Deployment

2010-06-22 Thread Matthias Felleisen


Go for the CGI library then, it works well and patches are welcome


On Jun 22, 2010, at 3:40 PM, Karl Winterling wrote:


I'm a college student in California, so I can't afford a World of
Warcraft account. However, I might try to design and "sell" a Racket
application to my Co-op. so I'll need to avoid sounding mentally
disturbed to the central IT staff.

On Tue, Jun 22, 2010 at 12:21 PM, Neil Van Dyke  
 wrote:
Racket comes with a CGI library.  I recently ported a large legacy  
Racket

(PLT Scheme) CGI-based application to SCGI using
"http://www.neilvandyke.org/scgi-scheme/";.

For new development, consider using the PLT Web Server instead of  
SCGI or
old CGI.  Nowadays, virtual servers like Amazon EC2 are affordable,  
and you
can make them do things that the cheapo CGI/PHP/Zope shared hosting  
of a few

years ago didn't support.

When undertaking a Web development project in Racket... in addition  
to the
extensive Racket documentation and the help available on this email  
list,
there are professional Racket consultants available for  
outsourcing.  And,
to borrow a line from an Asimov bio, they grow more handsome with  
each year.


Karl Winterling wrote at 06/22/2010 02:45 PM:


It appears that you need a PLT Web server running on your site's  
host to
deploy Web applications. Is it possible to deploy applications on  
shared

hosting with Apache and something like CGI or FastCGI?


--
http://www.neilvandyke.org/


_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] DrRacket, Emacs, REPL [was: Sending s-expr to repl]

2010-06-24 Thread Matthias Felleisen

Take a look at Dracula, the ACL2 support from DrScheme. It implements exactly 
that behavior. (You may even wish to take a look at our How to prove curriculum 
addition to HtDP. We teach freshmen how to prove theorems about graphical 
games.) 

Two points about it: 

 1. in the presence of true effects (not counting infinite loops), this model 
doesn't really work 
 2. and it is not a mid-point between the two extremes but a new, third point. 

What my blog post omits is a research attempt to explore a true midpoint 
between the two. Before we started the drscheme project in 1995, I worked with 
Rene Rodriguez and Bruce Duba on a transparent REPL for Emacs. We implemented 
it and used it with our freshman course for at least two semesters. Here is how 
it worked: 

 use an ordinary emacs interaction mode 
 control emacs interactions via a dependency analysis 
 if sending an s-expression were to violate a dependency, re-load the entire 
buffer (or a lot of it)
 for I/O, we had a separate buffer that could differentiate between committed 
and preliminary output

In the presence of HO and effectful computations, a dependency analysis is of 
course a conservative approximation. So this is highly approximate but for 
introductory classes it worked reasonably well. 

We gave up on this effort because we didn't get this repl to work for 
experienced users, it didn't really cope well with effects, and the effort had 
to replicate a lot of the work of the underlying compiler (Chez Scheme) so we 
had no research benefit. The drscheme project gave us a chance to try an even 
more radical approach, and I think it has worked well for beginners. 

To be honest, on and off I do think about a way to accommodate a Lisp-style 
repl or some flavor of it, but it sure isn't a high priority. 

-- Matthias










On Jun 24, 2010, at 9:11 AM, Nadeem Abdul Hamid wrote:

>> See
>> http://blog.racket-lang.org/2009/03/drscheme-repl-isnt-lisp.html
>> for a detailed answer.
>> 
> 
> I see what the blog post above is saying, but (I know, "no when no if no 
> but"), has anyone ever used editors for some of the proof assistants, like 
> CoqIDE or ProofGeneral mode in Emacs for Coq? These support a seemingly nice 
> compromise between the two styles. A minor annoyance I have with the DrRacket 
> model of reloading the entire buffer is that if I have several working 
> functions defined at the top of the file, and then a new function I'm working 
> on below that has syntax errors or is in incomplete template form or 
> whatever, running the file generates an error and no definitions at all are 
> loaded into the REPL. So instead, in these proof editors, they have this 
> feature where you can load the buffer up to a certain line/expression 
> (assuming no syntax errors), and everything above there is then in a "locked" 
> (uneditable) mode -- if you edit something, it rolls back the evaluated 
> portion of the file. This way, you can have a bunch of messy/incomplete 
> thoughts typed up at the !
 bo!
> ttom of your file, and have all good definitions up to a certain point in 
> your file evaluated so that you can play with the evaluated definitions in 
> the REPL, to help you fill in your unfinished thoughts. I know, this will get 
> messy in the presence of effects (proof languages are purely functional), and 
> probably a lot of work to implement, but something to think about...
> 
> 
> --- nadeem
> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


[racket] tennis and programming, not completely off-topic

2010-06-24 Thread Matthias Felleisen

Quote FAZ: 

> Vier Matchbälle hatte Isner in der Partie vergeben, einen bei 10:9, zwei bei 
> 33:32 und einen bei 59:58, Mahut wehrte alle ab. Bei 47:47 fiel die 
> elektronische Anzeigetafel aus, weil so ein Spielstand nicht vorgesehen ist, 
> im Internet war der Score auch nicht mehr zu verfolgen.

I don't really care about tennis but this headline caught my attention because 
it is connected to CS, just like my rare post-Christmas shopping experiences in 
2000. 

Two guys played some long tennis match. 3 days to be precise. The score in the 
fifth set got to 47:47. At that point the electronic board quit because ... you 
guessed it ... it wasn't prepared to display such scores. A bit later the sites 
internet ticker also quit. Same reason. I have no clue what the number 48 does 
to computer scientists. I would have understood 64 perhaps, but the game went 
even beyond that. 

In 2000 I went shopping with my wife (extremely rare at that point in my life) 
in the Houston Galleria. At the check out I watched a MX family buy two carts 
full of tree ornaments. After getting about halfway thru the first one, the 
checkout girl asked the family to pay the intermediate bill -- because the 
register wasn't program to keep track of more than 50 items per bill. 

Only partly amusing -- Matthias

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] confusing graphics primitives in 2htdp/image

2010-06-25 Thread Matthias Felleisen

The names were chosen for backwards compatibility. -- Matthias



On Jun 25, 2010, at 11:12 AM, Stephen Bloch wrote:

> There are a whole lot of graphics operations in 2htdp/image, and many of them 
> come in pairs: overlay/xy and place-image, add-line and scene+line, add-curve 
> and scene+curve, etc. that differ mainly in whether or not they crop the 
> result to the bounding box of one of the images.  (They sometimes differ in 
> how they interpret coordinates -- whether measured from the center or the 
> top-left of one of the images.)  Since the disappearance of pinholes, the 
> "scene" datatype doesn't serve much purpose any more.  Would it make sense to 
> use a consistent and compositional naming scheme, e.g. add-line/crop, 
> add-curve/crop, etc?
> 
> Stephen Bloch
> sbl...@adelphi.edu
> 
> 
> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] Y-combinator perfomance

2010-06-25 Thread Matthias Felleisen

I think you're comparing apples and oranges here. 
The use of _apply_ should make things a lost slower
for comb-sum than for sum. Also, you should collect
garbage before you run timed microbenchmarks. Otherwise
you might have bad interactions. With that done, I
get the following results: 

> [:~/Desktop] matthias% racket y.rkt
> cpu time: 5127 real time: 5427 gc time: 1834
> 1000
> cpu time: 4289 real time: 4557 gc time: 1369
> 1000
> [:~/Desktop] matthias% !!
> racket y.rkt
> cpu time: 5129 real time: 5523 gc time: 1840
> 1000
> cpu time: 4313 real time: 4658 gc time: 1373
> 1000
> [:~/Desktop] matthias% !!
> racket y.rkt
> cpu time: 5113 real time: 5404 gc time: 1835
> 1000
> cpu time: 4308 real time: 4622 gc time: 1376
> 1000

As you can see, three runs produce a rough average
of a 20% overhead. I think that's a fair price for
an applicative vs an imperative recursion. 

-- Matthias

CODE: 

#lang racket

(define-syntax U
  (syntax-rules ()
[(_ f) (f f)]))

(define-syntax define/comb
  (syntax-rules ()
[(_ comb name (arg1 arg2) body)
 (define name 
   (comb (λ (name) (λ (arg1 arg2) body]))

(define (Z f)
  (U (λ (g) (λ (x y) ((f (U g)) x y)

(define/comb Z comb-sum (l t) 
  (if (empty? l) t (comb-sum (rest l) (+ t (first l)

(define (sum l t)
  (if (empty? l) t (sum (rest l) (+ t (first l)

(collect-garbage)(collect-garbage)
(time (comb-sum (make-list 1000 1) 0))

(collect-garbage)(collect-garbage)
(time (sum (make-list 1000 1) 0))




On Jun 25, 2010, at 2:07 PM, Groshev Dmitry wrote:

> I've mistyped. In fact things are even worse.
> #lang racket
> (define-syntax U
>  (syntax-rules ()
>[(_ f) (f f)]))
> (define-syntax define/comb
>  (syntax-rules ()
>[(_ comb name (arg . args) f)
> (define name 
>   (comb (λ (name) (λ (arg . args) f]))
> 
> (define (Z f)
>  (U (λ (g) (λ x
>  (apply (f (U g)) x)
> 
> (define/comb Z comb-sum (l t) 
>  (if (empty? l) t (comb-sum (rest l) (+ t (first l)
> 
> (define (sum l t)
>  (if (empty? l) t (sum (rest l) (+ t (first l)
> 
> (time (comb-sum (make-list 1000 1) 0))
> (time (sum (make-list 1000 1) 0))
> Result:
> cpu time: 9922 real time: 10007 gc time: 3323
> 1000
> cpu time: 2762 real time: 2783 gc time: 469
> 1000
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] Loop in Racket

2010-06-27 Thread Matthias Felleisen

Plus loops per se are evil -- opium for the masses if you so wish. -- Matthias




On Jun 27, 2010, at 9:34 PM, Robby Findler wrote:

> Please see 'for' in the docs. Here's the relevant section of the Guide:
> 
> http://docs.racket-lang.org/guide/for.html
> 
> Robby
> 
> On Sun, Jun 27, 2010 at 8:32 PM, Brad Long  wrote:
>> Dear racketeers,
>> 
>> What is the reason for not offering a looping construct in racket? For
>> example, something like:
>> 
>> (loop (i 1 10) (print i))
>> 
>> Just for the masses, it seems simpler to use.
>> 
>> Any comments?
>> 
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Y-combinator perfomance

2010-06-28 Thread Matthias Felleisen


I pointed out Jinx's paper to Matthew last week.

Not surprisingly, reality and theory never match with the MIT Scheme  
compiler.



On Jun 28, 2010, at 3:04 PM, Joe Marshall wrote:

On Fri, Jun 25, 2010 at 11:50 AM, Matthew Flatt   
wrote:


Compilers can't easily see through a Y combinator, and a factor of  
8 or

so difference is probably typical for Lisp compilers. (I tried Ikarus
and Gambit to double check, and performance was about the same as  
with

Racket.)


See
@INPROCEEDINGS{Juan92tamingthe,
   author = {Guillermo Juan and Guillermo Juan Rozas},
   title = {Taming the Y operator},
   booktitle = {In ACM Conference on LISP and Functional Programming},
   year = {1992},
   pages = {226--234},
   publisher = {ACM Press}
}
 ``In this paper I present a set of conceptually simple but involved
techniques used by Liar 1 , the MIT Scheme compiler, to generate good
code when recursive procedures are specified in terms of suitable
versions of the Y operator. The techniques presented are
general-purpose analysis and optimization tools, similar to well-known
techniques used in the analysis and optimization of applicative
languages, that combine synergistically to enable Liar to generate
identical machine code for ordinary recursive definitions written
using letrec and those written using suitable forms of Y.''

;; Allow compiler to inline standard procedures.
(declare (usual-integrations))

(define-syntax U
(syntax-rules ()
  ((_ f) (f f

(define-syntax define/comb
(syntax-rules ()
  ((_ comb name (arg1 arg2) body)
   (define name
 (comb (lambda (name) (lambda (arg1 arg2) body)))

;; Allow compiler to inline Z
(define-integrable (Z f)
(U (lambda (g) (lambda (x y) ((f (U g)) x y)

(define/comb Z comb-sum (l t)
(if (null? l) t (comb-sum (cdr l) (+ t (car l)

(define (sum l t)
(if (null? l) t (sum (cdr l) (+ t (car l)

(define (test1)
 (let ((start-time (runtime))
(l (make-list 1000 1)))
   (let ((answer (comb-sum l 0)))
 (- (runtime) start-time

(define (test2)
 (let ((start-time (runtime))
(l (make-list 1000 1)))
   (let ((answer (sum l 0)))
 (- (runtime) start-time

(test1) => .11 seconds
(test2) => .11 seconds


--
~jrm
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Google doesn't know from DrRacket

2010-06-29 Thread Matthias Felleisen

Could we at least get drracket.org to do things for us? 


On Jun 29, 2010, at 9:38 PM, Robby Findler wrote:

> Oh, and "racket language" is one I'm pretty sure we'll be able to take
> over eventually.
> 
> Robby
> 
> On Tue, Jun 29, 2010 at 8:38 PM, Robby Findler
>  wrote:
>> Yeah, it will take time for us to catch up; the word "racket" has a
>> lot going on. But for now, at least, "racket plt" finds us. Hopefully
>> we'll get better over time
>> 
>> Robby
>> 
>> On Tue, Jun 29, 2010 at 8:19 PM, Mitchell Wand  wrote:
>>> I realized I had a machine that I needed to download Racket on, so I went to
>>> Google to find it.  Compare:
>>> 
>>> http://www.google.com/search?q=dr+racket&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
>>> 
>>> http://www.google.com/search?q=dr+racket+download&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
>>> 
>>> http://www.google.com/search?q=plt+scheme&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
>>> 
>>> --Mitch
>>> 
>>> 
>>> _
>>>  For list-related administrative tasks:
>>>  http://lists.racket-lang.org/listinfo/users
>>> 
>> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] List abbreviations in Beginning Student

2010-06-30 Thread Matthias Felleisen


On Jun 30, 2010, at 5:44 AM, Horace Dynamite wrote:


Hi Barry,

I noticed that beginning students are able to use list abbreviation  
constructors. It doesn't return the list in abbreviated form,  
however.


(list 1 2 3)
returns
(cons 1 (cons 2 (cons 3 empty)))

Is that correct?



Yes. It accommodates people who use the Little books with the teaching  
languages. (I used to have a language collection for TLL/S, but I  
failed to maintain it.) Also see (define f (lambda (x) x)).




I've noticed some overlaps of functionality between the teaching
languages myself too. I remember using this feature when I first
encountered the list abbreviations though, since for a while I wasn't
confident what a nested (list ... (list ...)) might look like in the
cons form.

As a side note, a lot of people have trouble with the arrangements
exercise in section 12, which is a little cleaner to work with using
list abbreviations, so thats another possible reason for including
this functionality in the beginning student language.


I am in the process of working this extended exercise into HtDP/2e  
AFTER introducing (list "h" "e" "l" "l").


-- Matthias

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Racket & Netbook

2010-06-30 Thread Matthias Felleisen


Well, a polite person would phrase this as "could you fix this ...  
please?"


On Jun 30, 2010, at 2:37 PM, Robby Findler wrote:


Sounds very advanced to me. In all seriousness, answers to those
questions are not the kind of things I would pay money for anyways.
The kinds of questions I pay money for are more like "make this thing
work again; it is broken." (which isn't a question, I know. ...)

Robby

On Wed, Jun 30, 2010 at 1:22 PM, Eli Barzilay   
wrote:

On Jun 30, Shriram Krishnamurthi wrote:


Of course, you won't get Apple-level support from Acer.  But that
cuts both ways (Acer support staff don't assume they are inherently
more advanced genetic beings).


??

When I got the #(@^(!&* ipad, I called Apple support to ask how I can
transfer random files to it.  The guy was "helpfully" suggesting
whatever their word equivalent is -- I gave up after about 5 minutes
of me going from "files, not `documents'" through "an icon in my
laptop" and ending up with "a pile of bits".

Oh, and I also asked if there's anything that can play music in ogg
format.  He consulted with two supervisors (for no less than 10
minutes), and finally announced that I should get some software that
converts the files to mp3.

[I'm sure that some people would consider that advanced...]

--
 ((lambda (x) (x x)) (lambda (x) (x x)))  Eli  
Barzilay:
   http://barzilay.org/   Maze is  
Life!

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Redefining selectors - another newbie question

2010-07-01 Thread Matthias Felleisen

(define posn.x posn-x) 

But that's not quite what you want :-)


On Jul 1, 2010, at 10:35 AM, Brad Long wrote:

> Thankyou racket gurus for your advice. My program using a "loop" now works:
> (for-each (fn(x)(display x)(newline)) (.. 10 1)) (display "blastoff!")
> --
> I have another question, is it possible (preferably easy) to use dot notation 
> for the auto-generated selectors (e.g. for (point x y z), instead of point-x 
> can we use point.x)? I am not exactly sure how to redefine that since it is 
> auto-created on construction of the struct.
> 
> I have just donned my flame-proof clothing.
> 
> Thanks.
> 
> _
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Redefining selectors - another newbie question

2010-07-01 Thread Matthias Felleisen

It's not about verbosity alone. 

(define-struct posn (x y z))

(define s (struct 1 2 3))

(posn-z s) performs two different tasks 
 -- checks that s is an instance of posn 
 -- then retrieves 3 from the structure 

s.z in C or C++ does only the second. 
s.z in Java is statically assigned a type. 
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] problem (?) with typed racket

2010-07-05 Thread Matthias Felleisen

On Jul 5, 2010, at 7:19 AM, Jose A. Ortega Ruiz wrote:

> 
> Hi,
> 
> The following (contrived) typed/racket program doesn't typecheck:
> 
>  (define-struct: (E) Arrow
>([arrow : (E -> (Listof E))]))
> 
>  (: compose-arrows (All (E) ((Arrow E) (Arrow E) -> (Arrow E
>  (define (compose-arrows a b)
>(Arrow (lambda (e) ((Arrow-arrow a) (car ((Arrow-arrow b) e))

As Noel points out, all that's missing is a type declaration for 
the parameter e in the lambda: 

 (lambda ({e : E}) ...)

will do the trick. 

Why? TR does not infer types. It checks them. When a type declaration
is missing, TR assumes that e is of type TheRacketType, aka Any. For 
a parameter of type Any, it makes no sense to be used in a position 
where it is supposed to be a number, a boolean, or an E. Your program
must somehow 'narrow' the type of e down to what the operation expects, 
in your case E. 

If I knew where the TR guide lives, I'd add the appropriate two-line 
paragraph to clarify this point. 

;; --- 

> Is the failure to type check a genuine limitation of the type inference
> engine, or is it me expecting too much from type inference in general?
> And, is there a more compact way of indicating the type of that lambda?

It is not quite true that TR doesn't infer types. It does so but in 
an extremely limited manner. Technically, this is called LOCAL Inference. 

What does this mean? 

When you write (lambda (x) ...) TR can't know what this function will be 
applied to. It must really assume x ranges over Any. 

When you write (let ((x 7)) ...) however, TR assumes you want x to range 
over numbers in the body of let because the initial value has type Number. 
To see how this fails, try 

 (let ([x 7]) (set! x "hello") x)

Again, I wish I could clarify this bit in the docs. 

-- Matthias




_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] problem (?) with typed racket

2010-07-05 Thread Matthias Felleisen

On Jul 5, 2010, at 10:09 AM, Jose A. Ortega Ruiz wrote:

> 
>  (: carrow (All (E) (C (Arrow E
>  (define carrow
>(C #{compose-arrows :: ((Arrow E) (Arrow E) -> (Arrow E))}))

That one stumps me too. Here is what works: 

#lang typed/racket

(define-struct: (E) Arrow ([arrow : (E -> (Listof E))]))

(: compose-arrows (All (E) ((Arrow E) (Arrow E) -> (Arrow E
(define (compose-arrows a b)
  (Arrow (lambda: ((e : E)) ((Arrow-arrow a) (car ((Arrow-arrow b) e))

(define-struct: (A) C ([compose : (A A -> A)]))

(: carrow (All (E) (Any -> (C (Arrow E)

(define (carrow a)
  (C (inst compose-arrows E)))

(define c (carrow 0))

I am beginning to wonder whether this is a scoping bug. E should be available 
in the scope of your carrow. 

-- Matthias

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] [htdp] Help with Exercise 12.4.2

2010-07-06 Thread Matthias Felleisen


Amen.

-- Make sure you truly understand list vs cons. If you have any  
doubts, stick to cons. 
-- For your template, spell out what each expression produces before  
you finish the definition. 
-- Use the examples, especially the ones that fail. 
-- Figure out what you need to combine the pieces. 
-- Ideally, arrange the thing in a table: 


 input | (first input) |  | recursive result | expected result

and keep adding examples until it clicks: i.e., until you know how to  
combine recursive result with some other things to get the expected  
result.


And do stick to the design recipe all the way down.





On Jul 6, 2010, at 5:30 PM, David Yrueta wrote:


Hi Sam --

As Jos commented, this is a very tough exercise, but it looks like  
you're off to a good start.


The most obvious problem with your current solution lies with  
'insert-everywhere/in-single-word.'  My first suggestion is to check  
the function examples to make sure the values they expect are  
consistent with your data definitions.


Dave



On Tue, Jul 6, 2010 at 1:15 PM, Jos Koot   
wrote:
Exercise 12.4.2 is notorius. When looking to (list 'a 'b 'c), you  
should

exspect 6 distinct permutations.
Jos

> -Original Message-
> From: users-boun...@racket-lang.org
> [mailto:users-boun...@racket-lang.org] On Behalf Of Sam Griff
> Sent: 06 July 2010 20:00
> To: users@racket-lang.org
> Subject: [racket] [htdp] Help with Exercise 12.4.2
>
> Hello. Like many others working through HtDP I have hit the
> wall at this exercise. I'm not sure what I have so far is in
> line with the "proper" way to do this exercise and would
> appreciate any help/suggestions. Here is the code I have so far:
>
> ;; A list of words is either
> ;; 1. empty
> ;; 2. (cons w low)
> ;;where w is a word and low is a list of words
>
> ;; arrangements : word  ->  list-of-words ;; to create a list
> of all rearrangements of the letters in a-word (define
> (arrangements a-word)
>   (cond
> [(empty? a-word) (cons empty empty)]
> [else (insert-everywhere/in-all-words (first a-word)
> (arrangements (rest a-word)))]))
>
> ;; Contract:
> ;; insert-everywhere/in-single-word : symbol word ->
> list-of-words ;; Purpose:
> ;; to insert a symbol everywhere in a single word ;; Examples:
> ;; (insert-everywhere/in-single-word 'a empty) should produce
> (list 'a) ;; (insert-everywhere/in-single-word 'b (list 'a))
> should produce (list (list 'a 'b) (list 'b 'a)) ;;
> (insert-everywhere/in-single-word 'c (list 'a 'b)) should
> produce (list (list 'c 'a 'b) (list 'a 'c 'b) (list 'a 'b
> 'c)) ;; Template:
> ;; (define (insert-everywhere/in-single-word s w)
> ;;   (cond
> ;; [(empty? w) ...]
> ;; [else ... (first w) ...
> (insert-everywhere/in-single-word s w) ...]))
> (define (insert-everywhere/in-single-word s w)
>   (cond
> [(empty? w) (list s)]
> [else  (list (list s (first w)) (cons (first w)
> (insert-everywhere/in-single-word s (rest w]))
>
> ;; insert-everywhere/in-all-words : symbol list-of-words ->
> list-of-words ;; to insert a symbol everywhere in a list of
> words (define (insert-everywhere/in-all-words s low)
>   (cond
> [(empty? low) empty]
> [else (append (insert-everywhere/in-single-word s (first
> low)) (insert-everywhere/in-all-words s (rest low)))]))
>
>
> ;; Tests:
> (define testword1 (list 'a))
> (define testword2 (list 'a 'b))
> (check-expect (insert-everywhere/in-single-word 'a empty)
> (list 'a)) (check-expect (insert-everywhere/in-single-word 'b
> testword1) (list (list 'b 'a) (list 'a 'b))) (check-expect
> (insert-everywhere/in-single-word 'c testword2) (list (list
> 'c 'a 'b) (list 'a 'c 'b) (list 'a 'b 'c)))
>
>
> Thanks,
>
> Sam
> _
>   For list-related administrative tasks:
>   http://lists.racket-lang.org/listinfo/users


_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] [htdp] Help with Exercise 12.4.2

2010-07-07 Thread Matthias Felleisen

Isn't that too much help? 


On Jul 6, 2010, at 6:46 PM, David Yrueta wrote:

> my base case the function should return a
> list of words but before returned a single word.
> 
> Very good decision.  Now take a close look at how you phrased the second 
> condition.  According to the design recipe, it should be structured to match 
> the second condition of your data definition for list-of-words.  Does it?
> 
> 
> (define (insert-everywhere/in-single-word s w)
>  (cond
>[(empty? w) (list s)]
>[else  (list (list s (first w)) (cons (first w)
> (insert-everywhere/in-single-word s (rest w]))
> 
> 
> 
> 
> On Tue, Jul 6, 2010 at 3:14 PM, Sam Griff  wrote:
> > Exercise 12.4.2 is notorius. When looking to (list 'a 'b 'c), you should
> > exspect 6 distinct permutations.
> > Jos
> 
> Thanks for your response but that really doesn't help me much. I'm
> focusing on insert-everywhere/in-single-word now. I understand what
> arrangements does
> and what permutations to expect.
> 
> > My first suggestion is to check the function examples to make sure the 
> > values they expect are consistent with your data definitions.
> 
> Can you explain please? I'm not sure I fully understand. The only
> thing I could see was in my base case the function should return a
> list of words but before returned a single word. Is that what you
> mean?
> 
> (define (insert-everywhere/in-single-word s w)
>  (cond
>[(empty? w) (cons (cons s empty) empty)]
>[else ... (first w) ... (insert-everywhere/in-single-word s (rest w))]))
> 
> > Amen.
> >
> > -- Make sure you truly understand list vs cons. If you have any doubts,
> > stick to cons.-- For your template, spell out what each expression produces
> > before you finish the definition.-- Use the examples, especially the ones
> > that fail.-- Figure out what you need to combine the pieces.-- Ideally,
> > arrange the thing in a table:
> >  input | (first input) |  | recursive result | expected result
> >
> > and keep adding examples until it clicks: i.e., until you know how to
> > combine recursive result with some other things to get the expected result.
> >
> > And do stick to the design recipe all the way down.
> 
> Thanks! I will try those suggestions and see if they help.
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] [htdp] Help with Exercise 12.4.2

2010-07-08 Thread Matthias Felleisen

On Jul 7, 2010, at 10:31 PM, Sam Griff wrote:

>> You're not consistent with the formatting of your documentation.
> Yeah... Sorry about that... I was mostly documenting the functions in
> a way that would most help me understand what was going on. I agree
> with you consistent documentation is important.

Consistency is half your life if you work on large systems (no 
matter whether they are software or economies). 

Practice is what gets you 'finger tips' consistency. Just do it. 



>> So, is that table really useful?
> I think so. I'm a visual person and it helped me see what was going on
> in the function and what each recursive step was producing. I know you
> advocate the DRs and making a Wish List but at the beginning of this
> exercise I wasn't clear what the process was and what functions would
> be needed in the Wish List but making the chart helped me see what
> functions were needed.


The milage of the table varies with the student. It's worth
trying on a 1-1 basis in office hours. This is one of those
tricks that a teachers needs to have handy but that may not 
apply universally. 

-- Matthias

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] [redex] Structured Semantics

2010-07-08 Thread Matthias Felleisen

This isn't truly a structured semantics, though yes it comes close. 

Do we show the GC rules in the Redex book? It would do the same. 

-- Matthias




On Jul 7, 2010, at 11:53 PM, Jay McCarthy wrote:

> How should I use Redex to encode a structured semantics... For example,
> 
> Suppose I have the L_thread language and the ->_thread reduction
> relation with contract
> 
> (store_global store_local term) ->_thread (store_global store_local term)
> 
> and I want to have another language L_system with an ->_system rr with 
> contract
> 
> (store_global (store_local term) ...) ->_system (store_global
> (store_local term) ...)
> 
> where (among other rules) I have the rule:
> 
> (store_global store_local term) ->_thread (store_global' store_local' term')
> -
> (store_global (store_local term) any_others ...) ->_system
> (store_global' (store_local' term') any_others ...)
> 
> I could easily use reduction-relation for ->_thread and most of
> ->_system, but for this particular rule, it doesn't seem possible to
> express in Redex. If the reduction-relation? structure were exposed
> (or perhaps had a struct property associated with it), then I could
> code this one rule in Racket and dispatch to the two other rrs when
> necessary, but that seems wrong.
> 
> Another way I could do it is combine the two languages and rules into
> one with a "mode" switching...
> 
> L_synthetic = (THREAD L_thread L_system/thread-hole) + (SYSTEM L_system)
> 
> ->_synthetic =
> 
> (THREAD thread sys) -> (THREAD thread' sys)
> 
> ...
> 
> (SYSTEM (in-hole sys thread)) -> (THREAD thread sys)
> 
> But that seems like the wrong thing too.
> 
> Any other ideas or examples?
> 
> Jay
> 
> -- 
> Jay McCarthy 
> Assistant Professor / Brigham Young University
> http://teammccarthy.org/jay
> 
> "The glory of God is Intelligence" - D&C 93
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] [redex] Structured Semantics

2010-07-08 Thread Matthias Felleisen


On Jul 8, 2010, at 11:06 AM, Robby Findler wrote:

> On Thu, Jul 8, 2010 at 10:01 AM, Matthias Felleisen
>  wrote:
>> Do we show the GC rules in the Redex book? It would do the same.
> 
> Only in part I.

I was afraid of that. 

I think a revision should demonstrate how to run GC on a store 
machine. That would have solved Jay's problem. 

-- Matthias

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] [redex] Structured Semantics

2010-07-08 Thread Matthias Felleisen

Yes, we do. 


On Jul 8, 2010, at 11:27 AM, Robby Findler wrote:

> I think Casey's right that we need better support for this in Redex.
> 
> Robby
> 
> On Thu, Jul 8, 2010 at 10:12 AM, Matthias Felleisen
>  wrote:
>> 
>> 
>> On Jul 8, 2010, at 11:06 AM, Robby Findler wrote:
>> 
>>> On Thu, Jul 8, 2010 at 10:01 AM, Matthias Felleisen
>>>  wrote:
>>>> Do we show the GC rules in the Redex book? It would do the same.
>>> 
>>> Only in part I.
>> 
>> I was afraid of that.
>> 
>> I think a revision should demonstrate how to run GC on a store
>> machine. That would have solved Jay's problem.
>> 
>> -- Matthias
>> 
>> 

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Difference when choosing language vs. #lang line

2010-07-10 Thread Matthias Felleisen

#lang htdp/bsl isn't ready for consumption. 

On Jul 10, 2010, at 2:27 PM, Todd O'Bryan wrote:

> When I run:
> ---
> #lang htdp/bsl
> (require 2htdp/image)
> 
> (circle 50 "solid" "blue")
> ---
> I get '(instantiate (class ...) ...) rather than the pretty picture I expect.
> 
> It works fine, however, if I choose the language from the menu and
> leave out the #lang line.
> 
> Intended behavior or is a snip not getting loaded that should be?
> 
> Todd
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] DrRacket never uses more than 1 GB?

2010-07-14 Thread Matthias Felleisen

On Jul 14, 2010, at 6:22 PM, Greg Hendershott wrote:

> I hope it's clear that if I didn't like Racket I wouldn't bother
> offering the feedback, so although this may not feel like a
> compliment, indirectly it is. :)


Thank you for the feedback. The above has been my motto for 20+ years (as I 
used to tell Matthew, Robby and other PhD students, if your paper isn't all red 
and marked up, it's bad news: I didn't like it) and I appreciate it very much 
when someone else lives it, too. 

We'll take this up at PLT Day. -- Matthias


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] changing a string into a list

2010-07-14 Thread Matthias Felleisen

I'd compose the two maps into one: 

 (map (compose string->symbol string) (string->list x))



On Jul 14, 2010, at 10:51 PM, Todd O'Bryan wrote:

> I want to change a "STRING" into a list of symbols '(S T R I N G), but
> can't find a very direct way to do it.
> 
> The best I've got is
> 
> (map string->symbol (map string (string->list "STRING")))
> 
> Is there something better I'm missing?
> 
> Todd
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] HTDP.org solutions access?

2010-07-18 Thread Matthias Felleisen

The solutions are available for teachers who dont have 
time to make up new exercises every year. 

If you are unsure about a solution, it is acceptable to 
ask questions on this list. 

It is a bad idea, though, to post a (guess at a) solution 
and to ask "is this it." 

-- Matthias



On Jul 18, 2010, at 3:58 PM, Byron Gibson wrote:

> Does anyone know if it's possible for someone who is not a teacher
> (nor an enrolled student) to get access to the HTDP.org solution
> website?
> 
> http://htdp.org/2003-09-26/Solutions/
> 
> It's only available to teachers, but I'm a web developer working my
> way through HTDP.org in my spare time.
> 
> Several times I've gotten a working program, but with a different and
> stylistically incorrect structure (when the answers were available in
> the text).
> 
> I suspect I'm doing the same thing on many of the exercises, and would
> like to be able to see the correct way without pinging the mailing
> list or irc channel every time.
> 
> I emailed this request to passwo...@htdp.org a few days ago, but no
> response yet.  Anyone know how to go about this?
> 
> Thanks,
> Byron
> 
> --
> I think I think, therefore I think I am.
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] rotate an image using 2htdp/image

2010-07-19 Thread Matthias Felleisen

But these are two orthogonal questions: 

 -- rotating an image 
 -- placing an image in a "constrained" background 

Shouldn't they be provided by two distinct functions? 


On Jul 19, 2010, at 5:32 PM, Eugene Wallingford wrote:

> 
>>> Just want to clear up thingsthe how can adjust the pinhole or the
>>> rotation center?
>> 
>> There is no pinhole. My earlier reply was trying to tell you that this
>> question does not make sense.
> 
> Perhaps Matthew is concerned not so much with the
> resulting orientation of the image as with its
> resulting location in the original field.  If I
> rotate an image 180 degrees about its upper
> leftmost corner, most or all of it may be out 
> the original view.
> 
>  Eugene
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] sicp exercise 2.20

2010-07-20 Thread Matthias Felleisen



Do you mean this?

#lang racket

(require rackunit)

;; Nat Nat *-> [Listof Nat]
;; which of the
(define (same-parity x . xs)
  (cons x (filter (λ (o) (or (and (even? x) (even? o)) (and (odd? x)  
(odd? o xs)))


(check-equal? (same-parity 1 2 3 4 5 6 7) '(1 3 5 7))
(check-equal? (same-parity 2 3 4 5 6 7) '(2 4 6))




On Jul 20, 2010, at 9:36 AM, Martin DeMello wrote:


By way of a puzzle, I've been trying to solve SICP exercise 2.20

Using the (define (f x . args)) notation, write a procedure
"same-parity" that takes one or more integers and returns a list of
all the arguments that have the same even-odd parity as the first
argument. For example,
(same-parity 1 2 3 4 5 6 7)
(1 3 5 7)
(same-parity 2 3 4 5 6 7)
(2 4 6)

using "straight recursion", that is, without using any `let` or
`define` constructs. Still not managed to find the trick that will
tack on the first argument as the head of the list. Anyone have a
hint?

martin
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users

Re: [racket] Project Ideas

2010-07-20 Thread Matthias Felleisen



Modify the module browse in drracket so that it can somehow display
what variables a module exports and what contracts are imposed on the
variable, if any.

I have been asking for this for a while but couldn't find a volunteer
to implement it.

-- Matthias







On Jul 20, 2010, at 3:37 PM, Joe Snikeris wrote:


I'm interested in acquiring experience using racket to solve real
world problems as opposed to the SICP bookwork I've been doing lately.
Does anyone have any ideas for medium sized projects?  Extra points
for things that could be useful to others in the community.

I wanted to check out the first link of this search, but it appears
that the mailing list archive has changed:
http://www.google.com/search?q=PLT+projects+waiting+for+contributors

Thanks in advance,
Joe
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] image teachpack lacks above

2010-07-20 Thread Matthias Felleisen

I push releases of HtDP/2e at the same time as new versions of the software are 
released: every odd month of the year. 

The announcements are available on   but also on 
low-frequency announcement lists: 

 http://racket-lang.org/community.html



On Jul 20, 2010, at 6:43 PM, Richard Mittel wrote:

> Thanks, it does help to know this.  Is there some easy way (like a mailing 
> list) for me to be notified when the HtDP/2e rewrites are done?  -RM
> 
> On Tue, Jul 20, 2010 at 5:33 PM, Matthias Felleisen  
> wrote:
> 
> Here is the full explanation:
> 
> There are two distinct teachpacks for images:
>  2htdp/image (the new one; experimental; only available with require)
>  htdp/image (the old one; available both ways)
> 
> We are right now transitioning from the old one to the new one.
> Many programs work in both, but not all. I started rewriting
> the HtDP/2e examples with the new teachpack, but in a way that
> I thought was compatible.
> 
> The problem is that we wish to keep evolving the new teachpack
> and make it only available widely when things are close to
> finished. BUT, so many people have discovered it and so many
> people already know that it is better than the old one that
> we have had lots of request for the new one.
> 
> I guess I will need to rewrite the HtDP/2e version so that
> it is all about the new version.
> 
> Does this help?
> 
> -- Matthias
> 
> 
> 
> 
> 
> 
> 
> 
> On Jul 20, 2010, at 5:31 PM, Richard Mittel wrote:
> 
> Hi,
> 
> Thanks for the speedy response.  Yes, I do get the expected red circle over 
> the blue rectangle.  But I believe HtDP(2) says it should work without the 
> explicit (require 2htdp/image), as long as one first adds the "image" 
> teachpack through the "Add Teachpack" option of the Language menu.  And yet 
> when I do this, it doesn't work, from which I infer (maybe wrongly?) that 
> "above" is missing from the teachpack implementation.
> 
> Thanks again for your time,
> RM
> 
> On Tue, Jul 20, 2010 at 2:16 PM, Matthias Felleisen  
> wrote:
> 
> Hi --
> 
> Thanks for asking. I am not sure I understand the question properly.
> When you write
> 
>  (require 2htdp/image)
>  (above (circle 30 "solid" "red") (rectangle 50 10 "solid" "blue"))
> 
> and click on Run you get the expected red circle over a blue rectangle.
> Correct?
> 
> And now you wish to use the Teachpack menu instead of the require line?
> Or are you saying that your implementation of the teachpack doesn't have 
> above?
> 
> Thanks -- Matthias
> 
> 
> 
> 
> 
> 
> On Jul 20, 2010, at 2:41 PM, Richard Mittel wrote:
> 
> Dear Professor Felleisen,
> 
> DrRacket's "image" teachpack does not seem to define the "above" function, as 
> HtDP (second edition, stable version) says it should.  The context is
> 
> (define BDY
>   (above
> (rectangle (...
> 
> in http://www.ccs.neu.edu/home/matthias/HtDP2e/htdp.html, and I have also 
> added the "universe" teachpack.  I can get "above" by doing (require 
> 2htdp/image), but I really need the teachpack approach to work.  Please help. 
>  If the problem is somehow due to my own error, please accept my apologies in 
> advance.
> 
> Thank you,
> RM
> 
> 
> 
> 

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] tool: show module exports

2010-07-21 Thread Matthias Felleisen

Thou shall ask and receive. Thanks! 

Can I get the contracts if it comes via provide/contract and/or the types if it 
comes from Typed Racket (this might be the difficult one, because types are 
gone after expansion). 

And I think we should somehow combine provide-document with provide/contract 
and show the docs, too. And while I am at it, the tool should gather the 
check-xyz's and turn them into examples so hat people can easily use the 
function/class/method :-) 

My preference would be to include this into the module browser. That's where it 
belongs 

-- Matthias



On Jul 21, 2010, at 2:15 AM, Jon Rafkind wrote:

> I wrote a simple tool (attached) that displays all the exports from a module; 
> their name as well as their phase. I'll probably make it show imports too 
> when I get a chance.
> 
> I'd like this sort of information in DrRacket as well, either I can make a 
> plugin or maybe check syntax can do it.
> 
> $ racket ~/tmp/check.rkt match.rkt
> Phase 0 (runtime)
> Variables
>  exn:misc:match? from /home/jon/svn/plt/collects/racket/match/match.rkt
>  match-equality-test from /home/jon/svn/plt/collects/racket/match/match.rkt
> Syntaxes
>  define-match-expander
>  match from /home/jon/svn/plt/collects/racket/match/match.rkt
>  match* from /home/jon/svn/plt/collects/racket/match/match.rkt
>  match*/derived from /home/jon/svn/plt/collects/racket/match/match.rkt
>  match-define from /home/jon/svn/plt/collects/racket/match/match.rkt
>  match-lambda from /home/jon/svn/plt/collects/racket/match/match.rkt
>  match-lambda* from /home/jon/svn/plt/collects/racket/match/match.rkt
>  match-lambda** from /home/jon/svn/plt/collects/racket/match/match.rkt
>  match-let from /home/jon/svn/plt/collects/racket/match/match.rkt
>  match-let* from /home/jon/svn/plt/collects/racket/match/match.rkt
>  match-letrec from /home/jon/svn/plt/collects/racket/match/match.rkt
>  match/derived from /home/jon/svn/plt/collects/racket/match/match.rkt
>  struct* from /home/jon/svn/plt/collects/racket/match/match.rkt
> Phase 1 (syntax)
> Variables
>  match-...-nesting from /home/jon/svn/plt/collects/racket/match/match.rkt as 
> match-...-nesting
> Syntaxes
> 
> $ racket ~/tmp/check.rkt -h
> checker [  ... ] 
> where  is one of
>  --phase  : Only show identifiers at this phase
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] tool: show module exports

2010-07-21 Thread Matthias Felleisen

Jon, do you want to give it a try? And perhaps Sam and you can then figure out 
how to get the types out. 


On Jul 21, 2010, at 7:26 AM, Robby Findler wrote:

> One, non-optimal way to get the contracts is to evaluate the module
> and use object-contract on the exports (non-optimal because dependent
> contracts will have ...s in them, etc).
> 
> Robby
> 
> On Wed, Jul 21, 2010 at 4:26 AM, Matthias Felleisen
>  wrote:
>> 
>> Thou shall ask and receive. Thanks!
>> 
>> Can I get the contracts if it comes via provide/contract and/or the types if 
>> it comes from Typed Racket (this might be the difficult one, because types 
>> are gone after expansion).
>> 
>> And I think we should somehow combine provide-document with provide/contract 
>> and show the docs, too. And while I am at it, the tool should gather the 
>> check-xyz's and turn them into examples so hat people can easily use the 
>> function/class/method :-)
>> 
>> My preference would be to include this into the module browser. That's where 
>> it belongs
>> 
>> -- Matthias
>> 
>> 
>> 
>> On Jul 21, 2010, at 2:15 AM, Jon Rafkind wrote:
>> 
>>> I wrote a simple tool (attached) that displays all the exports from a 
>>> module; their name as well as their phase. I'll probably make it show 
>>> imports too when I get a chance.
>>> 
>>> I'd like this sort of information in DrRacket as well, either I can make a 
>>> plugin or maybe check syntax can do it.
>>> 
>>> $ racket ~/tmp/check.rkt match.rkt
>>> Phase 0 (runtime)
>>> Variables
>>>  exn:misc:match? from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>  match-equality-test from /home/jon/svn/plt/collects/racket/match/match.rkt
>>> Syntaxes
>>>  define-match-expander
>>>  match from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>  match* from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>  match*/derived from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>  match-define from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>  match-lambda from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>  match-lambda* from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>  match-lambda** from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>  match-let from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>  match-let* from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>  match-letrec from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>  match/derived from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>  struct* from /home/jon/svn/plt/collects/racket/match/match.rkt
>>> Phase 1 (syntax)
>>> Variables
>>>  match-...-nesting from /home/jon/svn/plt/collects/racket/match/match.rkt 
>>> as match-...-nesting
>>> Syntaxes
>>> 
>>> $ racket ~/tmp/check.rkt -h
>>> checker [  ... ] 
>>> where  is one of
>>>  --phase  : Only show identifiers at this phase
>>> _
>>>  For list-related administrative tasks:
>>>  http://lists.racket-lang.org/listinfo/users
>> 
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>> 

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] CoreMIDI bindings

2010-07-21 Thread Matthias Felleisen

On Jul 21, 2010, at 2:51 PM, Evan Hanson wrote:

> Also, is this the kind of thing that should be namespaced? In contrast to 
> other languages where namespacing is used heavily (sometimes even to a 
> fault), it seems that many scheme libraries are quite flat. Is this simply 
> left up to the user to manage, or does the module system take care of this, 
> or is there something else I'm missing altogether? Forgive the naïveté if 
> this should be clear to 


I suspect that where you use 'namespace', I think we would say 'module'. Your 
module is a ~200 loc so that's a reasonable size. But if you wanted to, you 
could split into modules that are unsafe and modules that are 'safe'. 

On planet a library is more often than not a bunch of modules, with one module 
playing the role of entry point. 

;; --- 

The one thing I noticed in your code is the use of let-loop to specify loops. 
Look up 'for' and try things like 

 (for ((i (in-range (length args ... )

You may even wish to for-loop over the args here (I think). 

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] tool: show module exports

2010-07-21 Thread Matthias Felleisen

Yeap, that's the goal. 


On Jul 21, 2010, at 4:47 PM, Jon Rafkind wrote:

> Yea sure. I was just getting the import stuff to show. If hacking contracts 
> is too hard maybe I can get some advice at PLT/Racket day.
> 
> On 07/21/2010 12:46 PM, Matthias Felleisen wrote:
>> Jon, do you want to give it a try? And perhaps Sam and you can then figure 
>> out how to get the types out.
>> 
>> 
>> On Jul 21, 2010, at 7:26 AM, Robby Findler wrote:
>> 
>>> One, non-optimal way to get the contracts is to evaluate the module
>>> and use object-contract on the exports (non-optimal because dependent
>>> contracts will have ...s in them, etc).
>>> 
>>> Robby
>>> 
>>> On Wed, Jul 21, 2010 at 4:26 AM, Matthias Felleisen
>>>   wrote:
>>>> Thou shall ask and receive. Thanks!
>>>> 
>>>> Can I get the contracts if it comes via provide/contract and/or the types 
>>>> if it comes from Typed Racket (this might be the difficult one, because 
>>>> types are gone after expansion).
>>>> 
>>>> And I think we should somehow combine provide-document with 
>>>> provide/contract and show the docs, too. And while I am at it, the tool 
>>>> should gather the check-xyz's and turn them into examples so hat people 
>>>> can easily use the function/class/method :-)
>>>> 
>>>> My preference would be to include this into the module browser. That's 
>>>> where it belongs
>>>> 
>>>> -- Matthias
>>>> 
>>>> 
>>>> 
>>>> On Jul 21, 2010, at 2:15 AM, Jon Rafkind wrote:
>>>> 
>>>>> I wrote a simple tool (attached) that displays all the exports from a 
>>>>> module; their name as well as their phase. I'll probably make it show 
>>>>> imports too when I get a chance.
>>>>> 
>>>>> I'd like this sort of information in DrRacket as well, either I can make 
>>>>> a plugin or maybe check syntax can do it.
>>>>> 
>>>>> $ racket ~/tmp/check.rkt match.rkt
>>>>> Phase 0 (runtime)
>>>>> Variables
>>>>>  exn:misc:match? from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>>>  match-equality-test from 
>>>>> /home/jon/svn/plt/collects/racket/match/match.rkt
>>>>> Syntaxes
>>>>>  define-match-expander
>>>>>  match from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>>>  match* from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>>>  match*/derived from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>>>  match-define from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>>>  match-lambda from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>>>  match-lambda* from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>>>  match-lambda** from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>>>  match-let from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>>>  match-let* from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>>>  match-letrec from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>>>  match/derived from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>>>  struct* from /home/jon/svn/plt/collects/racket/match/match.rkt
>>>>> Phase 1 (syntax)
>>>>> Variables
>>>>>  match-...-nesting from /home/jon/svn/plt/collects/racket/match/match.rkt 
>>>>> as match-...-nesting
>>>>> Syntaxes
>>>>> 
>>>>> $ racket ~/tmp/check.rkt -h
>>>>> checker [  ... ]
>>>>> where  is one of
>>>>>  --phase  : Only show identifiers at this phase
>>>>> _
>>>>>  For list-related administrative tasks:
>>>>>  http://lists.racket-lang.org/listinfo/users
>>>> _
>>>>  For list-related administrative tasks:
>>>>  http://lists.racket-lang.org/listinfo/users
>>>> 
> 

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] CoreMIDI bindings

2010-07-21 Thread Matthias Felleisen

Parameterized modules are called 'units' and it's a different ball game. Yes, 
something like this is doable. In this world, you can write 

 (define (f some-unit-module)
...  (connect a b c) ... ) 

and connect comes from the 'unit module' you pass in. -- Matthias





On Jul 21, 2010, at 4:43 PM, Evan Hanson wrote:

> Makes sense. That's nice flexibility for module users.
> 
> Out of curiosity, how dynamic are module names? Can they be
> manipulated? Say you had two modules that each provide a function
> "connect". You would load them as mod1:connect and mod2:connect using
> prefix-in -- how might one design a form that would associate a call
> to connect inside a passed expression to a given module?
> 
> (define (within-module module-name fun)
>  (module-associate module-name fun) ... )
> 
> (within-module mod1:
>  (lambda (...)
>(connect arg arg arg) ... )) ; --> equates to (mod1:connect ...)
> 
> This is miles from how it would work, I'm sure, but is it possible?
> 
> Evan
> 
> On Wed, Jul 21, 2010 at 2:45 PM, Todd O'Bryan  wrote:
>>> On Jul 21, 2010, at 2:51 PM, Evan Hanson wrote:
>>> 
>>> Also, is this the kind of thing that should be namespaced? In
>>> contrast to other languages where namespacing is used heavily
>>> (sometimes even to a fault), it seems that many scheme libraries
>>> are quite flat. Is this simply left up to the user to manage, or does
>>> the module system take care of this, or is there something else
>>> I'm missing altogether? Forgive the naïveté if this should be clear to
>> 
>> One way that name collisions get avoided is the
>> 
>> (require (prefix-in pre: "imported-module.rkt"))
>> 
>> form. Every name in the module is prefixed with pre: when you use it
>> in your module, so if you have any name collisions or want to remind
>> yourself where something came from, you just give the module an
>> appropriate prefix when you import it in.
>> 
>> Todd
>> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Newbie question - Drscheme hangs on directory-exists?

2010-07-21 Thread Matthias Felleisen



On Jul 21, 2010, at 5:22 PM, John Sampson wrote:

> Hello -
> 
> If I enter "(directory-exists? "C:\iconsource")" into DrRacket
> I would expect it to answer with "#t" or "'#f" but in fact the
> cursor goes to the next line, leaving an indent.
> I am running this on Windows 7.


Do you mean you used the REPL/Interactions window like this: 

> (directory-exists? "C:\iconsource")
   |  ;; and the cursor was somehow indented like that and there was no 
response? 


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] tool: show module exports

2010-07-21 Thread Matthias Felleisen

That's damn cute! 



On Jul 21, 2010, at 9:41 PM, Stevie Strickland wrote:

> On Jul 21, 2010, at 9:33 PM, Jon Rafkind wrote:
>> On 07/21/2010 05:26 AM, Robby Findler wrote:
>>> One, non-optimal way to get the contracts is to evaluate the module
>>> and use object-contract on the exports (non-optimal because dependent
>>> contracts will have ...s in them, etc).
>> `object-contract' looks like its only for stuff from the class system, 
>> right? Did you mean some other function?
> 
> I believe he meant 'value-contract'.  That'll give you the contract for 
> values that have it stored appropriately, and then you can use 
> 'contract-name' on the contract to get a s-expression representation.
> 
> Stevie

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] procedure, contract, assoc, and REPL

2010-07-22 Thread Matthias Felleisen

YC, this can all work out IF you organize your program like this: 

 module A: define functions, export with contracts and only with contracts 
 module B: import A and create the assoc lists from here 
 module C: the client imports from B only and performs all ops on the assoc 
list via B operations 

Then the keys are contracted procedures and lookup works out fine. 







On Jul 22, 2010, at 12:48 AM, YC wrote:

> Hi Robby - 
> 
> What I am trying to do is to look up a key/value pair where the key happens 
> to be the procedure.  The struct idea will work only if I can serialize/hash 
> the procedure into a unique key, which means I will still have to rely on a 
> procedure matching itself (otherwise it's too much work for the client). 
> 
> The scenario really boils down to - why does a contracted procedure not eq 
> itself?  
> 
> The same script above shows that a contracted procedure returns #f with eq?, 
> but a plain procedure returns #t in REPL (both returns #t in module). 
> 
> > (eq? test? test?) ;; test? is contracted. 
> #f
> > (eq? test2? test2?) ;; test2? is not contracted 
> #t
> 
> Looking at the definition of eq? shows that eq? is for determining whether 
> two objects are the same.  And since both test? and test2? are exposed via a 
> module, i.e. they are "fixed" once exposed outside of module, whether 
> contracted or not - I would have expected eq? would return #t for both cases 
> in REPL. 
> 
> Am I misunderstand what eq? is all about?  Thanks. 
> 
> yc
> 
> On Wed, Jul 21, 2010 at 5:40 PM, Robby Findler  
> wrote:
> You seem to be relying on identity of procedures (which is a bad
> idea). Contracts on functions are implemented with wrappers which
> breaks that by making fewer things equal but compiler optimizations
> can take things the other direction making more things equal than you
> might expect.
> 
> Overall I think you should just avoid relying on the identity of
> procedures. One way to do that (without knowing more about your code)
> would be to use struct procedures and put an extra field on the struct
> that gives you the key for a comparison.
> 
> Hth,
> Robby
> 
> On Wednesday, July 21, 2010, YC  wrote:
> > Hi all -
> >
> > I am running into an interesting issue where an alist of procedures in 
> > REPL, the ones without a contract works with assoc, but the ones with 
> > contract do not work with assoc.
> >
> > What I have is an alist where the keys are procedures.  Some of these 
> > procedures have contracts attached to them, and some do not.  Then I tried 
> > to use assoc to match the procedures.  If the code are run within the 
> > module itself - both types match, but within REPL only the ones without 
> > contract matches.
> >
> > Here's an simplified example, where foo.ss defines the procedures, and the 
> > test.ss uses foo.ss to construct the alist.
> >
> > ;; foo.ss
> > #lang scheme
> > (define (test? v) #t) ;; provided with contract
> >
> > (define (test2? v) #t) ;; provided without contract
> >
> > (provide/contract
> >  (test? (-> any/c boolean?))
> >  )
> >
> > (provide test2?)
> >
> > ;; test.ss
> > #lang scheme
> > (require "foo.ss")
> >
> > (define table `((,test2? . 1) (,test? . 2)))
> >
> > (assoc test? table) ;; works in module setting but not in REPL
> >
> > (assoc test2? table) ;; works in module setting AND in REPL
> >
> > Both the assoc test above returns the correct result.  But if I try to copy 
> > and run (assoc test? table) in REPL again, it will not match, whereas 
> > (assoc test2? table) continues to match.
> >
> > Is there any particular reason for the divergence of the behaviors?  I 
> > verified the behavior in both v4.2.5 and v5.0.  Thanks.
> >
> > yc
> >
> >
> >
> >
> >
> 
> 
> 
> -- 
> Cheers,
> yc
> 
> Taming the software dragon - http://dragonmaestro.com
> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] Facing some flickering problems

2010-07-22 Thread Matthias Felleisen

Matt, if this project ran on Universe using the world canvas, it shouldn't have 
the double buffering. 


On Jul 22, 2010, at 12:30 PM, Doug Williams wrote:

> I have a package on PLaneT called animated-canvas that does the double 
> buffering automatically. I use it for my own animations.
> 
> On Wed, Jul 21, 2010 at 9:53 PM, Noel Welsh  wrote:
> Are you doing double buffering? This answer is probably relevant:
> 
> http://lists.racket-lang.org/users/archive/2009-April/032035.html
> 
> HTH,
> N.
> 
> On Thu, Jul 22, 2010 at 4:46 AM, Mathew Kurian  
> wrote:
> > Hey guys,
> > Recently, I had started coding a game in racket and its grown a bit
> > recently. Its still just 2D/ semi 3D, but I am facing some serious
> > flickering when running on a linux machine. However, on a Windows it works
> > fine. Its about 310 MB, so its a bit hard on the memory. (not completely
> > optimized.)
> > So, I was wondering if that was normal? or would it be more likely be the
> > program's optimization?
> > BTW. I saw the black PNG's were fixed in the latest build. Thank you all.
> > Mathew Kurian
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] Facing some flickering problems

2010-07-22 Thread Matthias Felleisen


On Jul 22, 2010, at 2:25 PM, Mathew Kurian wrote:

> Yes, Matthias...mine is using universe, so i don't think i can pesonally 
> implement double buffering... i think it is caused from the game being to 
> large...but its just a thought you guys are the pros, so you teach me.
> 
> I have a lot of transparency in my images...i personally make them using 
> fireworks and photoshop, so that too might be an issue.


We have noticed performance problems in 2htdp/universe and images before. So 
which image package are you using and can you describe the conditions under 
which you see flickering? (I am assuming that you're running 5.0.) 
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Facing some flickering problems

2010-07-23 Thread Matthias Felleisen

Matt, what's missing from Universe to avoid your kind of flickering isn't 
double buffering. It is a handler that allows you to send updates to an 
established scene so that you don't have to draw the whole scene over into the 
canvas. 

(Plus a change to the timing guarantees. I made the mistake of measuring the 
clock ticks from tick to tick. As Matthew (Flatt) pointed out in January, I 
should start the next tick at the end of the draw action of the preceding tick. 
That will simplify your programming model and my internal organization.) 
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] read of numbers with decimal point default to exact?

2010-07-23 Thread Matthias Felleisen

On Jul 23, 2010, at 8:40 AM, Neil Van Dyke wrote:

> To support programmers who want to use exact numbers by default, such as some 
> financial programmers, without making that the default for Racket, let's say 
> we define a new Racket variant for these programmers ("#lang numbers-racket", 
> heh).  In this case, I'm wondering whether there is a problem with any Racket 
> *libraries* confusing these programmers when the numbers they get out of the 
> libraries can quietly become inexact.  Perhaps the solution here is simply 
> that authors of numerical libraries should provide multiple two versions of 
> certain of operations: a version that preserves exactness, and a version that 
> is fast?

I have been thinking about this issue a bit for the SEC issue (Python for 
waterfall finance models). This may indeed require a different library 
interaction, possibly with coercions inserted that express interval guarantees. 
Let's put it on our list of things to discuss -- Matthias

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] tool: show module exports

2010-07-23 Thread Matthias Felleisen

If I can't have the integration with check syntax, can I get a variation on 
this: 

  the tool should act like F1 in DrRacket. 
  Click on a require path and press F1. 
  Instead of opening HelpDesk, however, 
  the tool opens a window and lists all exports from the module 
  (and ideally it should list them as hyperlinks that point to their 
documentation
   in a sense, that's why we have scribble, right?)

-- Matthias





On Jul 23, 2010, at 5:30 PM, Jon Rafkind wrote:

> On 07/22/2010 11:03 AM, Stephen De Gabrielle wrote:
>> This is cool,
>> 
>> I'm calling it from drracket, but it seems to be choking on mred-kernel.
>> 
> 
> I threw the tool up on planet for now: (require (planet "check.rkt" 
> ("kazzmir" "check.plt" 1 0)))
> 
> It adds a command to raco so you can do
> $ raco extract foo.rkt
> 
> It will list all the imports from racket/base, which is a lot of stuff, so 
> for now its probably best to use --exports to just get the export list.
> 
> $ raco extract --exports foo.rkt
> 
> Stephen, how were you running the tool from drracket? Maybe I'll make a 
> simple button that runs the tool on the currently opened file in drracket.
> _
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Oh, load! Where art thou?

2010-07-24 Thread Matthias Felleisen

Richard, as the oldest Schemer around with an advisor nicknamed "Lispman", I 
used two load-based scripts like that until a couple of years ago. I rewrote it 
all with require and it turned out to be the right kind of improvement. It was 
all easier to manage. 

I also used load like this for years to get into students' programs and to 
supply them with libraries. It seems to work in a way that no other language 
can provide libraries. And in a sense, teachpacks aren't close but I figured 
out ways to cope. 

This second use case is good if you send things 'over the wire'. But again, I'd 
rather write a library function that reads and evals -- in exactly the sandbox 
I want if I had to do this. It's more secure than running raw load. 

-- Matthias







On Jul 23, 2010, at 9:58 PM, Richard Cleis wrote:

> Given a file of "some-scheme.rxt":
> 
> *
> ;#lang racket
> 
> (define a-var 'a-val)
> *
> 
> and a program in a definitions window:
> 
> *
> #lang racket
> 
> (define (f) (load "some-scheme.rkt"))
> ;(f)
> *
> 
> ... Entering (f) in the interactions window defines a-var.
> 
> If the comment is removed from ;#lang racket, a-var is not defined.  Where 
> did it go?
> 
> If the comment is removed from ;(f), an 'unbound identifier' error is 
> triggered during the Run. [(f) still works in the interactions window.] Which 
> identifier is unbound?  
> 
> How can I explain where (load) evaluates it's contents?
> 
> Does (load) have a future in racket?
> 
> rac
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] How to create 'Internal Definitions' in a scheme interpreter.

2010-07-24 Thread Matthias Felleisen

Let me propose this: 

1. Define the grammar properly. In particular, distinguish the grammar for 
expressions from those for definitions. For example, 

  Expr is one of: 
-- Variable 
-- (+ Expr Expr) 
-- (local (Definition*) Expr) 
-- ...

  Definition is one of: 
-- (define Variable Expr)
-- (define-struct Variable (Variable*))

2. Then follow the design recipe from HtDP. Design one recursive function per 
grammar but also define the outputs you wish to get from each: 

  eval-for-expr : Expr -> ValueExpr 
  eval-for-definition* : [Listof Definition] -> ValueDefinition

I leave this to you as an exercise, but I recommend thinking of definitions as 
operators on environments. 

3. The ideas are embedded in our textbook HtDP. (See htdp.org)





On Jul 24, 2010, at 12:28 PM, Pedro Del Gallego wrote:

> Hi,
> 
> I am writing my first interpreter, but  I am struggling with the
> definitions of  'define', 'let' and 'letrec'.
> 
> Here is the source code intrepreter (> 100 loc) . 
> http://gist.github.com/487501
> 
> The problem is that 'define' requires access to the enviroment. I as
> understand define is equivalent to these expansions.
> 
>  Top level.
> (define (foo)
>   (... (bar) ...))
> 
> => Will be
> 
> (define foo
>(lambda ()
>   (... (bar) ...)))
> 
> 
>  In a lambda environment.
> 
> (define (my-proc)
>   (define (local-proc-1)
>  ...)
>   (define (local-proc-2)
>  ...)
>   (local-proc-1)
>   (local-proc-1))
> 
> => Will be
> 
> (define my-proc
>(lambda ()
>   (letrec ((local-proc-1 (lambda () ...))
>(local-proc-2 (lambda () ...)))
> (local-proc-1)
> (local-proc-2)))
> 
> Can anyone point me how to implement this features. I am trying to
> implement them out of the evaluator function, but I guess that if they
> need access to the environment, maybe they should be inside of the
> evaluator method. Maybe something like this?
> 
>[`(letrec ,binds ,eb)
>  (eval-letrec binds eb env)]
> 
>[`(let,binds ,eb)
>  (eval-let binds eb env)]
> 
> ; eval for letrec:
> (define (eval-letrec bindings body env)
>  (let* ((vars (map car bindings))
> (exps (map cadr bindings))
> (fs   (map (lambda _ #f) bindings))
> (env* (extended-env* env vars fs))
> (vals (map (evlis env*) exps)))
>(env-set!* env* vars vals)
>(eval body env*)))
> 
> ; eval for let:
> (define (eval-let bindings body env)
>  (let* ((vars (map car bindings))
> (exps (map cadr bindings))
> (vals (map (evlis env) exps))
> (env* (extended-env* env vars vals)))
>(eval body env*)))
> 
> (define ? )
> 
> I am new in this list, so let me know if this question is "off-topic".
> 
> 
> Thx.
> -- 
> -
> Pedro Del Gallego
> 
> Email  :   pedro.delgall...@gmail.com
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] universal Pong question

2010-07-25 Thread Matthias Felleisen

The key to Universe programs is to allocate knowledge in the
right places. That's called protocol design in the Docs. Once 
you have decided what goes where you can do two things: 

 -- make up data definitions for the local state 
 -- decide what messages you need to send back and forth 
and make up data definitions for those 

Since you believe that there are several related and possibly 
equivalent paths, let me recommend a bit of an exercise for
your class: 

  have the students jointly discuss the two ideas above
  have them come up with two or three different choices 
  and set up some pairs/teams that implement all three of them 

When done, have the students demonstrate how the choices affect
the implementation of the local client and the server. 

You may also wish to discuss the results in terms of security
then. What happens when a bad client joins? What happens when 
a client sees too much about some other client? It's less relevant 
for pong but for many games (battleship is wonderful here, Shriram 
has an implementation, I have an old one from during the design) 
these are obviously interesting questions. 






On Jul 25, 2010, at 3:26 PM, Todd O'Bryan wrote:

> In the three-week intro course I'm teaching, the students have
> expressed a desire to program Pong played over the network, so that
> they can play against each other when they get home from camp.
> 
> I've never done universe programming before, so I'm not sure what kind
> of messages the worlds should send back and forth.
> 
> Obviously, each world needs to report on the position of the paddle
> (left or right) that its player controls, but what about the ball?
> Should I just let the worlds handle that with on-tick, or should I
> check that the ball is in the same spot on both worlds every so often,
> or should I have the universe server control the ball and tell the
> world everything except their own paddle position each time something
> changes?
> 
> I think all of these are reasonable choices, but I'm pretty sure some
> will be more or less nice in terms of performance, so I'd like not to
> head down a blind alley.
> 
> Todd
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] writing a define-world macro

2010-07-25 Thread Matthias Felleisen


We will add something appropriate to the teaching languages real soon now. 


On Jul 25, 2010, at 6:44 PM, Shriram Krishnamurthi wrote:

> Todd,
> 
> Danny has defined updaters for his world.  However, the reason we
> didn't make these public is because we ultimately need to deal with
> lvalues, which (a) are arguably not a good idea, and (b) we certainly
> can't do as a macro anyway.  Make sure you think about that.
> 
> Shriram
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Off-topic: lambda head onesie on my three-day-old granddaughter

2010-07-25 Thread Matthias Felleisen

That's great. Congrats! 

htdp wedding cakes, plt heads grand-daughters, what's next? 


On Jul 24, 2010, at 10:55 PM, Wayne Iba wrote:

> Sorry for the (mostly) off-topic post but I couldn't resist sharing this 
> photo with you'all.
> --Wayne (we now return you to your regularly scheduled programming)
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Racket Bootstrap compatibility?

2010-07-25 Thread Matthias Felleisen

DrRacket is the replacement for DrScheme, and we strongly recommend that you 
use it for teaching Bootstrap. Report errors as soon as you encounter them, 
ideally with the built-in error reporting feature -- Matthias



On Jul 25, 2010, at 10:35 PM, Paul Furber wrote:

> Hi all,
> 
> Firstly, apologies if this is the wrong mailing list to ask this but
> is racket and drracket compatible with the Bootstrap teaching
> programme? I will be attempting to teach some disadvantaged kids in
> South Africa next school term using Bootstrap's curriculum and
> wondered if there are any gotchas or things to look out for. I did a
> quick test of the Super Mario example and all seems well but that's as
> far as I got. I certainly don't have a problem using 4.2.3 for the
> time being but if someone could explain the roadmap, that would be
> great - thanks!
> 
> -- 
> Paul Furber
> Group senior writer, ITWeb
> http://www.itweb.co.za
> +27-78-347-1247
> paul.fur...@gmail.com   .
> pa...@itweb.co.za ..:
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] web applications example problem

2010-07-26 Thread Matthias Felleisen


On Jul 26, 2010, at 1:13 PM, Sean Allen wrote:


(define-struct post (title body))

(struct post (title body)  #:extra-constructor-name make-post)


These two lines have nearly the same meaning. They define a struct  
called post, aka struct:post. When you define the same thing twice in  
a module, Racket complains. I doubt this ever worked.




title : string?
body : string?


I don't understand these two lines. Neither title nor body are  
identifiers you have defined in your module/program. (You have fields  
named that, but that's all.) The ':' isn't a syntactically legitimate  
token.


_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] importing signatures

2010-07-26 Thread Matthias Felleisen


Did you mean to provide foo:


#lang racket

(define-signature foo^ (make-foo foo?))

(provide foo^)


Also you can use racket/signature like this:


#lang racket/signature

make-foo foo?


and then


#lang racket/unit

(require "sig.rkt")
(import)
(export sig^)

(define-struct foo ())





On Jul 26, 2010, at 1:55 PM, Shriram Krishnamurthi wrote:


Here's the file "sig":

 #lang racket
 (define-signature Foo (make-foo foo?))

Here's another file:

 #lang racket/unit
 (require "sig")
 (import)
 (export Foo)
 (define-struct foo ())

When I execute this, I get

 define-unit: unknown signature in: Foo

I would have thought that the the signature is precisely what the
(require "sig") line would have imported.  I must be missing something
in the grammar -- anyone?

Shriram
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/users


Re: [racket] Using Futures

2010-07-28 Thread Matthias Felleisen

(Nothing about futures. But may I recommend a nice and simple 'optimization': 

 (cond 
[(= 1 (length values)) ...]

adds quite some complexity to a recursive function over a list. 
I'd use 

  (empty? (rest values))

instead. 

Also, I assume that you will protect your function with a 
contract or a main function. 

-- Matthias)



On Jul 28, 2010, at 4:35 PM, Joe Snikeris wrote:

> All,
> 
> Please see: http://pastie.org/1064484
> 
> Apparently, spawning futures recursively is a bad idea.  This problem
> seems like it should be easily parallelizable.  What am I doing wrong
> here?
> 
> Thanks,
> Joe
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Using Futures

2010-07-28 Thread Matthias Felleisen

[I don't think he cares about (). See remark on protecting the function.]


On Jul 28, 2010, at 5:12 PM, Sam Tobin-Hochstadt wrote:

> On Wed, Jul 28, 2010 at 1:44 PM, Matthias Felleisen
>  wrote:
>> 
>> (Nothing about futures. But may I recommend a nice and simple 'optimization':
>> 
>>  (cond
>>[(= 1 (length values)) ...]
>> 
>> adds quite some complexity to a recursive function over a list.
>> I'd use
>> 
>>  (empty? (rest values))
>> 
>> instead.
> 
> This breaks on `null'.
> -- 
> sam th
> sa...@ccs.neu.edu

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


[racket] syntax, differently

2010-07-31 Thread Matthias Felleisen

Shriram's proposal and a private conversation with Mike suggested the following 
feature requests for the drracket teaching languages: 

1. Could drracket limit the width of programs in the teaching language world to 
80 columns? 

2. Could drracket reindent all every time a programmer hits {return | run | 
submission server request }? 

These two alone would help ensure that programs look better than what we 
currently see. The reindent all would also immediately suggest to students 
missing parens etc. It would disallow the behavior where students spend time 
inserting N spaces at the beginning of the line. 

;; --- 

Once we solve these two problems, I think we should consider one other problem: 

* when to break lines. I am not sure how to enforce style rules in beginner 
languages because I have my own style that I personally enforce to the point of 
editing student programs. E.g.

(place-image IMAGE 
 X-EXPRESSION Y-EXPRESSION
 BACKGROUND-IMAGE)

is my preferred breakage for this one function. For others I follow old Scheme 
norms. 

-- Matthias



_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] syntax, differently

2010-07-31 Thread Matthias Felleisen

On Jul 31, 2010, at 11:19 AM, Robby Findler wrote:

> On Sat, Jul 31, 2010 at 10:00 AM, Matthias Felleisen
>  wrote:
>> 
>> Shriram's proposal and a private conversation with Mike suggested the 
>> following feature requests for the drracket teaching languages:
>> 
>> 1. Could drracket limit the width of programs in the teaching language world 
>> to 80 columns?
> 
> This one seems doable (I'd probably make the text turn red when it
> passes the 80th column or somethign instead of rejecting keystrokes).


I wouldn't reject keystrokes, I'd just act as if the student had typed return. 



>> 2. Could drracket reindent all every time a programmer hits {return | run | 
>> submission server request }?
> 
> I'd be worried about this that some edits one does (maybe opening a
> string?) would cause strange things to happen to the editor based on
> intermediate states of the program.


I'd be happy with shifting everything on RUN and SUBMIT. At that point the 
student thinks that the program is complete. 
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] syntax, differently

2010-07-31 Thread Matthias Felleisen

On Jul 31, 2010, at 11:38 AM, Robby Findler wrote:

> You mean that, right as they cross into the 80th column you hit return?
> 
> Judging from my experience with pretty-print (which does similar
> things sometimes), that could be bad news.
> 
> For example
> 
> (+ 1 2 3 4 5 6  (+ 
> 
> a return at that point isn't going to help much.


Yes, I fully expect that non-pretty things will happen but 
I also expect students will begin to respect the boundary 
and hit return soon enough. 

;; --- 

> ... to get started experimenting.


I think experimenting means releasing it to students. 
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] syntax, differently

2010-07-31 Thread Matthias Felleisen

I clean up in drracket with 80-column wide  ;; --- lines. So there's support 
for the idea. 


On Jul 31, 2010, at 11:44 AM, Neil Van Dyke wrote:

> Robby Findler wrote at 07/31/2010 11:19 AM:
>> 
>> On Sat, Jul 31, 2010 at 10:00 AM, Matthias Felleisen
>>  wrote:
>>   
>>> 1. Could drracket limit the width of programs in the teaching language 
>>> world to 80 columns?
>>> 
>> 
>> This one seems doable (I'd probably make the text turn red when it passes 
>> the 80th column or somethign instead of rejecting keystrokes).
>>   
> 
> If it's a visual indicator, I would very much like to have that available as 
> an option in the non-teaching languages as well.  After working on a file in 
> DrRacket for a while, I usually have to clean up the new overly-long lines in 
> Emacs.
> 
> Typical indicators are a gray line in the background after column 79 or 80, 
> or a background color change there, like from white to light gray.
> 
> I'm not sure about red.  Sometimes, rightward drift and a long identifier or 
> literal means you have no practical choice but to violate the 79/80 border.  
> IMHO, border incursion is not quite as grave an offense as some of the other 
> things for which we might want to use red.
> 
> Regarding 79 or 80, 80 is now good for lots of people who previously had to 
> use 79, though probably some people would like the option of 79.  (For a long 
> time, it was 79 for lots of Unix people, first because some terminals would 
> to an automatic newline of some kind on a write in column 80, and then 
> because some tools liked to put adornments in column 80.  Some tools still 
> like to.)  100 also seems a popular max width in some people's 'coding 
> standards'.  MS Visual Studio, for example, lets you set this border to an 
> arbitrary number, IIRC.
> 
> -- 
> http://www.neilvandyke.org/
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] syntax, differently

2010-07-31 Thread Matthias Felleisen

The file wouldn't move all the time. It would move on RUN and on SAVE. 

Most experienced programmers wouldn't see any movement whatsoever. 
Students would see movement for a short time. Then they'd follow 
the flow. 

-- Matthias





On Jul 31, 2010, at 2:25 PM, Robby Findler wrote:

> Thinking as someone who would be implementing these changes, I can
> easily see a whole slew of bug reports coming in of the form "When I
> save my file DrRacket moves all the lines around. What's going on?!".
> So, while I agree that there is something to be done here vis a vis
> indentation help in the PDE, I don't think we quite are at the "try to
> implement it and play with it" stage yet.
> 
> Robby
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] syntax, differently

2010-08-01 Thread Matthias Felleisen

On Aug 1, 2010, at 12:34 AM, Mathew Kurian wrote:

1. Your comments are appreciated. Thank you. 

2.

> Because some of the code can get very long (unlike some other languages),

What do you mean with that? When I have students write large programs, my 
Racket programs are routinely a factor of 3 or more shorter than those of the 
best of my students (5Kloc in Racket vs 15Kloc in Java or C# or C++), tend to 
perform more tasks, and are more stable. 

> it is important for students to be able to keep the code very neat,

That is true in all languages, period. 

3. 

> Since drracket ... compiles one line after another, ...

DrRacket does not compile line by line. Indeed, lines have nothing to do with 
compilation. Please take  a look at HtDP's extended exercises on interpreting 
Scheme. That'll give you an idea of what compilation is and why lines are 
irrelevant. 

-- Matthias

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] syntax, differently

2010-08-01 Thread Matthias Felleisen

On Aug 1, 2010, at 2:44 PM, Mathew Kurian wrote:

>  it may be harder to students to keep their code neater compared to some 
> other languages which usually have code that rarely exceed 1 line.

The meaning of this sentence still escapes me. Would you mind translating the 
example you sent along into such  1-liner? Thanks. 

-- Matthias

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] syntax, differently

2010-08-01 Thread Matthias Felleisen

So when define-struct introduces functional mutators as planned for a while 
now, and this program looks like this: 

 (cond
   [(mouse-in? 248 x 424 570 y 649) (set-world-background blah)]
... 

Matthew will be happy? 



On Aug 1, 2010, at 6:14 PM, Todd O'Bryan wrote:

> You'd create the new world and set field values using mutators.
> 
> So
> 
> if (x > 248 && x < 424 && y > 570 && y < 649) {
>SState newState = new SState();
>newState.setBackground(blah);
>newState.setButton(blah2);
>...
> }
> 
> On Sun, Aug 1, 2010 at 5:22 PM, Richard Cleis  wrote:
>> [snip]
>> 
>> I was trying to emphasize that it may be harder to students to keep their
>> code neater compared to some other languages which usually have code that
>> rarely exceed 1 line.
>> Example:
>> Racket using the universe teachpack:
>> (define (s-mouse-engine s x y event)
>>   (cond
>> [(and
>>   (and (> x 248)   (< x 424))
>>   (and (> y 570)   (< y 649)))
>> (make-S-STATE
>>  (get-s-background s);;I have made methods here to
>> reduce length, but other wise it would be longer.
>>  (make-button
>>   (s-mouse-engine-worker1 event "button-img")
>>   (get-s-button-x s)   ;;I have made methods here to
>> reduce length, but other wise it would be longer.
>>   (get-s-button-y s)   ;;I have made methods here to
>> reduce length, but other wise it would be longer.
>>   (s-mouse-engine-worker1 event "button-initiate")))]
>> 
>> How would you write that in another language that rarely exceeds one line?
>> rac
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] syntax, differently

2010-08-01 Thread Matthias Felleisen

On Aug 1, 2010, at 8:05 PM, Todd O'Bryan wrote:

> In a language with typing and
> overloading, you could define two distance functions, one that takes
> two posns and another that takes four numbers, and I think this would
> be the most natural way to write distance.


Like this: 

(define distance
  (case-lambda
   ((p q) (distance (posn-x p) (posn-x q) (posn-y p) (posn-y q)))
   ((x0 y0 x1 y1) (sqrt (+ (sqr (- x0 y0)) (sqr (- x1 y1)))

(distance (posn 3 4) (posn 0 0))


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] syntax, differently

2010-08-02 Thread Matthias Felleisen

On Aug 2, 2010, at 7:21 AM, Horace Dynamite wrote:

> I don't understand why instructors can't just explain to students what
> style they should write in, and shout at them when they unnecessarily
> break the style. This seems like a better method that stepping into
> the thorny area of having DrRacket do all this stuff.


Because students on the average do not listen. The very fact that 
you worked thru HtDP on your own at 16 shows that 'on the average' 
doesn't apply to you. 

;; --- 

BTW, your more than 80-column example worries me about your aesthetics. 
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket-users] Core Team: I need you decide what I should do about the spammer.

2021-12-18 Thread Matthias Felleisen

+2! And many thanks. (I was personally spared this spam until very recently. No 
clue why) 

— Matthias




> On Dec 18, 2021, at 2:55 PM, Robby Findler  wrote:
> 
> +1! Thank you. 
> 
> Robby
> 
> On Sat, Dec 18, 2021 at 1:43 PM Matthew Flatt  > wrote:
> The "members" option sounds right to me. Thanks for tracking down a way
> to improve the situation!
> 
> At Sat, 18 Dec 2021 19:35:23 +, Sage Gerard wrote:
> > Core team,
> > 
> > Sam asked me to issue bans for a troublesome spammer. I've done so, even
> > just today. I understand I need quorum for larger decisions. This is why
> > I have not yet reconfigured the list to permanently stop the spammer.
> > After researching the problem further, I need your urgent attention.
> > 
> > I found that the spam messages sometimes link to other Google group
> > posts affected by the spammer. A recent trail leads to a
> > comp.lang.python Google message in 2017. I suspect that email addresses
> > are scraped in unmoderated lists that freely hand out membership. After
> > checking the list settings, I found that this is one of those lists. I
> > hypothesize that our email addresses are being scraped and
> > cross-referenced for use in other unmoderated lists.
> > 
> > It's one thing to flatly complain about a spammer on this list, and
> > another to willingly maintain a transmission vector. We need to stop
> > automatically handing out group membership with our current settings. We
> > can have  issue list memberships. I need you all to fill in the
> > blank with "moderators" or "members." I'll translate the settings
> > accordingly.
> > 
> > Given the holidays, I respect your time. Please reciprocate with respect
> > for the urgency this problem creates. I will revoke my own mailing list
> > privileges and membership in three weeks, on January 8th, 2022. I will
> > leave the settings however they read at the time to prevent
> > interruption, and request that own messages then be deleted to limit the
> > role my email address plays for the spammer.
> > 
> > I am not volunteering to moderate membership applications, and I am not
> > commenting on how to verify the impact of possible email leaks. Between
> > the Discourse move and (majority?) perspective towards email, I'm not
> > sure how I would be useful doing either. If my opinion holds weight, I'd
> > advise the answer be "members" so that any available moderators can
> > focus on rule breakers while the community grows at a self-directed speed.
> > 
> > Let me know, and thank you.
> > 
> > 
> > 
> > -- 
> > 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 
> > .
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/racket-users/5fa6a8bb-88e4-37c6-f0b9-2ed372bc
> >  
> > 
> > e8fe%40sagegerard.com .
> 
> -- 
> 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 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/20211218124300.343%40sirmail.smtps.cs.utah.edu
>  
> .
> 
> -- 
> 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 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAL3TdOMCXH4Zio1%2B96Nj_Zgj2vByetG-%3D8i93%3DLYjTpaBrw8DA%40mail.gmail.com
>  
> .

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/649B3011-618B-466E-AE20-B4C13629CA71%40felleisen.org.


Re: [racket-users] Core Team: I need you decide what I should do about the spammer.

2022-01-12 Thread Matthias Felleisen



Thank you Sage for taking on this task. — 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/FC8531A1-1D73-47EB-B379-E0138DF143EC%40felleisen.org.


Re: [racket-users] How 'Pythonic' Can Racket Be Made?

2023-10-12 Thread Matthias Felleisen


We tried embedding Python into Racket nee PLT Scheme some 20 years ago, twice: 

Here is a paper on the second attempt: 

  From Python to PLT Scheme 
  https://www2.ccs.neu.edu/racket/pubs/#scheme2003-ms

Daniel Silva took the lead on this initiative. The surface language was (back 
then) covered. 
It’s Python runtime system that made it essentially impossible to interop with 
the (even 
then) many C libs. 

-- 
This group is deprecated and retained as an archive. 

Racket discussions have moved to the Racket Discourse at  
https://racket.discourse.group/ .

---
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.
--- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/C4A7AF02-5A8B-4BB1-8864-67EC358471D6%40felleisen.org.


Re: [racket] future

2011-08-30 Thread Matthias Felleisen

I can see a Haskellian, a Cleaner-upper, or a Cameleer impose the 
no-macros-for-thunks rule. They have always claimed that there is no need to 
avoid the repetition of (lambda () because it is so short. When you can't do 
it, just say it ain't necessary. Better, say it's bad. -- Matthias


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Neophyte Alert

2011-08-31 Thread Matthias Felleisen

On Aug 31, 2011, at 4:43 PM, Jukka Tuominen wrote:

> 
>> 
>> A few minutes ago, Neil Van Dyke wrote:
>>> Josh Tilles wrote at 08/31/2011 01:03 PM:
 -- Is there any sort of general practice or prevailing taste in when
 to use (for example) *null* vs *empty* vs *(list)*? What about *(let
 ([...]))* vs *(local (define ...))*?
>>> 
>>> I think most people do "'()" when they want a literal null list.
>>> Don't use "(list)", since that's a procedure call.
>> 
>> Two quick notes: (list) would be optimized the same, I think; and at
>> least in the Racket sources I think that `null' is the more popular
>> choice.  (With `empty' winning in the more HtDP-oriented side.)
>> 
> 
> #lang racket a.k.a. default language seems to be clear on this one when
> evaluated
> 
> (list) >>  '()  didn't know this one myself
> empty  >>  '()
> null   >>  '()
> '()>>  '()


I'd stick with '() and HtDP/2e will move there. 




> Then what is the 'correct' predicate to go with?
> 
> empty?
> null?
> 
> anything else?


I'd stick with empty?. History brought in car, cdr, null? and null and that's 
bad because programmers may accidentally connect this to Java's NULL, which is 
a horrible idea. 




_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Splicing format string?

2011-09-01 Thread Matthias Felleisen

See CL's format language for where you don't want to go. 
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Adding teachpack from Language menu?

2011-09-01 Thread Matthias Felleisen


On Sep 1, 2011, at 2:17 PM, John Chandler wrote:

> The docs tell me in several places to load a teachpack with the
> Language->Add Teachpack menu pane in Dr. Racket.  Unfortunately, my
> Language menu does not contain an "Add Teachpack" item, the only item
> it contains is "Choose Language ...".


Teachpacks are only available in the menu-selected HtDP languages. 
Please switch to Beginning Student Language under How to Design Programs. 


> Selecting this item brings up a dialog which includes a non-editable
> field which is labeled "Teachpacks" and contains the text:
> 
> (lib "convert.ss" "teachpack" "htdp")
> 
> Dr. Racket's Help->Check for Updates tells me I'm up-to-date.
> 
> The "convert.ss" module is one that I loaded, somehow, within the last
> couple of days.
> 
> Please advise.
> 
> -jmc
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] which version of DrRacket to download

2011-09-02 Thread Matthias Felleisen

Does 5.1.3 not work? 


On Sep 2, 2011, at 9:14 AM, Stephen Bloch wrote:

> for a RedHat Linux system?
> 
> uname -a says
> Linux panther.adelphi.edu 2.6.9-89.0.23.ELsmp #1 SMP Fri Mar 5 17:56:21 EST 
> 2010 i686 i686 i386 GNU/Linux
> 
> cat /etc/redhat-release says
> Red Hat Enterprise Linux AS release 4 (Nahant Update 8)
> 
> 
> Stephen Bloch
> sbl...@adelphi.edu
> 
> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] append-map and #lang lazy

2011-09-03 Thread Matthias Felleisen

That's correct, you have to force before you append-map. 

As it turns out, we are working on exactly this issue at the moment, and your 
email was perfectly timed. 

Thanks -- Matthias



On Sep 3, 2011, at 12:14 PM, Daniil wrote:

> Hello, I am trying to use the Lazy Racket for generating infinite lists.
> Here's the code:
> 
> #lang lazy
> (require racket/list)
> (define hamming
>  (list 1
>(append-map
> (lambda (x) (list
> (* 2 x)
> (* 3 x)
> (* 5 x))) hamming)))
> 
> (define bla (take 5 (sort hamming <)))
> 
> 
> However, when I evaluate (! bla) I get:
> append: expected argument of type ; given #
> 
> If I understand correctly this happens because I mix racket/list and
> lazy? How can I avoid this? Should I use stream-cons?
> 
> Thank you.
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Scribble: escaping the semicolon

2011-09-04 Thread Matthias Felleisen


Here is my emacs macro for inserting a racketblock that enables comments: 

(defun Scrbl-insert-braces ()
  "Make a pair of braces and be poised to type inside of them."
  (interactive)
  (insert "@;%
@(begin
#reader scribble/comment-reader
(racketblock
"
  )
  (save-excursion
(insert "
))\n@;%\n")))

A snippet looks like this:

@(begin
#reader scribble/comment-reader
(racketblock
;; @deftech{PositiveNumber} is a Number greater or equal to @scheme[0]. 

;; @tech{PositiveNumber} -> @tech{String}
;; compute the reward level from the given score @scheme[s]

  )) 



On Sep 4, 2011, at 5:32 AM, Mark Carter wrote:

> I'm documenting my module in a scribble file, and I have a @racket segement 
> in which I would like to include a semicolon. How do I escape a semicolon?
> 
> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Using the profiler effectively?

2011-09-05 Thread Matthias Felleisen

On Sep 4, 2011, at 8:28 PM, Eli Barzilay wrote:

> Just now, Danny Yoo wrote:
>> 
>> But I don't know how to interpret the results I'm getting back from
>> the profiler yet.  I guess I'm trying to say: I'm illiterate: I
>> don't know how to read the textual output of the profiler, and need
>> some help.
> 
> The output is a conventional one.  (It's not completely compatible
> with gprof (I've based it on the output from Allegro Lisp), but it's
> close enough that it woudn't be hard to adapt it.)


Eli, your sentence and parenthetical remark are not an answer to Danny's 
question. I will say I was equally stumped when I used the profiler, and i 
thank Robby for explaining bits and pieces to me. 

In general, the entire answer suggests that there is serious room for 
improvement. Sadly the whole problem sounds like a problem of presenting 
information in a useful and easily consumable manner -- which isn't PLT's 
strong point. 

When I see such things, I sure wish we had an "HCI department" :-) 

-- Matthias



_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Why check-expect only at the top level?

2011-09-06 Thread Matthias Felleisen

Here is a simplistic teachpack: 

#lang racket/base

(require rackunit)

(provide internal-check-expect)

(define-syntax-rule
  (internal-check-expect call expected)
  (begin (check-equal? call expected) #true))

It is simplistic in that its error messages are probably not up to the 
Guillaume standards. I placed it in the same folder as a minor variation of 
your program: 

(require "ice.rkt") ;; and required it explicitly but you could go thru the 
teachpack menu

(define (divides-modulo? d n) (= (modulo n d) 0))
(define (divides-divide? d n) (integer? (/ n d)))
(define (divides? d n) (divides-modulo? d n))

(define (check-divides d?)
  (and (internal-check-expect (d? 4 16) true)
   (internal-check-expect (d? 4 17) false)))

(check-divides divides-modulo?)
(check-divides divides-divide?)
(check-divides divides?)

This runs fine. The 'and' is needed because we need to combine expressions in a 
functional language. The 'true' that you see then is the result of the two. 

Does this help? 

Thanks for reporting the error in the teachpack docs. -- Matthias





On Sep 5, 2011, at 5:42 PM, John Riedl wrote:

> Hello Racketeers.
> 
> Summary: Why does check-expect only work at the top level?
> 
> I often find myself writing a few versions of the same function, to
> show students different ways of doing things, or to experiment with
> the performance of different approaches.  As a trivial example,
> consider:
> 
> ; Check whether one number divides evenly into another.
> ; The modulo form is common, but the other form might be easier to understand.
> ; I'd like to check which one is faster.  On my laptop the
> divides-modulo function is nearly
> ; twice as fast as the divides-divide function.
> (define (divides-modulo? d n) (= (modulo n d) 0))
> (define (divides-divide? d n) (integer? (/ n d)))
> (define (divides? d n) (divides-modulo? d n))
> 
> I'd like to test that the two divides? functions work the same by
> writing a test harness that takes a divides? function and tries it out
> on a bunch of values with check-expect.  For instance:
> 
> (define (check-divides d?)
>  (check-expect (d? 4 16) true)
>  (check-expect (d? 4 17) false))
> 
> But when I run it I get:
> . check-expect: found a test that is not at the top level in:
> (check-expect (d? 4 16) true)
> 
> I've read http://docs.racket-lang.org/test-engine/index.html, which says:
> "Each check form may only occur at the top-level; results are
> collected and reported by the test function."
> 
> ... but it doesn't say *why* this rule.  Is it just to keep things
> simple for students, or is there a deep reason for this limitation?
> 
> In slightly related news, I can't parse the following, in part because
> of what seems to be an accidentally repeated part of the text:
> 
> (check-member-of (test any/c) (expected any/c) ...)
> Accepts at least two value-producing expressions. Structurally
> compares the first value to each value subsequent value specified.
> 
> Thanks,
> John
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Why check-expect only at the top level?

2011-09-06 Thread Matthias Felleisen

Here is a simplistic teachpack: 

#lang racket/base

(require rackunit)

(provide internal-check-expect)

(define-syntax-rule
  (internal-check-expect call expected)
  (begin (check-equal? call expected) #true))

It is simplistic in that its error messages are probably not up to the 
Guillaume standards. I placed it in the same folder as a minor variation of 
your program: 

(require "ice.rkt") ;; and required it explicitly but you could go thru the 
teachpack menu

(define (divides-modulo? d n) (= (modulo n d) 0))
(define (divides-divide? d n) (integer? (/ n d)))
(define (divides? d n) (divides-modulo? d n))

(define (check-divides d?)
  (and (internal-check-expect (d? 4 16) true)
   (internal-check-expect (d? 4 17) false)))

(check-divides divides-modulo?)
(check-divides divides-divide?)
(check-divides divides?)

This runs fine. The 'and' is needed because we need to combine expressions in a 
functional language. The 'true' that you see then is the result of the two. 

Does this help? 

Thanks for reporting the error in the teachpack docs. -- Matthias





On Sep 5, 2011, at 5:42 PM, John Riedl wrote:

> Hello Racketeers.
> 
> Summary: Why does check-expect only work at the top level?
> 
> I often find myself writing a few versions of the same function, to
> show students different ways of doing things, or to experiment with
> the performance of different approaches.  As a trivial example,
> consider:
> 
> ; Check whether one number divides evenly into another.
> ; The modulo form is common, but the other form might be easier to understand.
> ; I'd like to check which one is faster.  On my laptop the
> divides-modulo function is nearly
> ; twice as fast as the divides-divide function.
> (define (divides-modulo? d n) (= (modulo n d) 0))
> (define (divides-divide? d n) (integer? (/ n d)))
> (define (divides? d n) (divides-modulo? d n))
> 
> I'd like to test that the two divides? functions work the same by
> writing a test harness that takes a divides? function and tries it out
> on a bunch of values with check-expect.  For instance:
> 
> (define (check-divides d?)
>  (check-expect (d? 4 16) true)
>  (check-expect (d? 4 17) false))
> 
> But when I run it I get:
> . check-expect: found a test that is not at the top level in:
> (check-expect (d? 4 16) true)
> 
> I've read http://docs.racket-lang.org/test-engine/index.html, which says:
> "Each check form may only occur at the top-level; results are
> collected and reported by the test function."
> 
> ... but it doesn't say *why* this rule.  Is it just to keep things
> simple for students, or is there a deep reason for this limitation?
> 
> In slightly related news, I can't parse the following, in part because
> of what seems to be an accidentally repeated part of the text:
> 
> (check-member-of (test any/c) (expected any/c) ...)
> Accepts at least two value-producing expressions. Structurally
> compares the first value to each value subsequent value specified.
> 
> Thanks,
> John
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Why check-expect only at the top level?

2011-09-06 Thread Matthias Felleisen

On Sep 5, 2011, at 5:42 PM, John Riedl wrote:

> 
> In slightly related news, I can't parse the following, in part because
> of what seems to be an accidentally repeated part of the text:
> 
> (check-member-of (test any/c) (expected any/c) ...)
> Accepts at least two value-producing expressions. Structurally
> compares the first value to each value subsequent value specified.


I have committed a repair for this: 

(check-member-of (test any/c) (expected any/c) ...)
Checks whether the value of the test expression is structurally equal to any of 
the values produced by the expected expressions.
It is an error for test or any of the expected expression to produce a function 
value.

(check-range (test number/c) (min number/c) (max number/c))
Checks whether value of test is between the values of the min and max 
expressions [inclusive].

Thanks again. 
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Dynamically calling struct accessors/method names

2011-09-06 Thread Matthias Felleisen

In Racket, accessors are functions and are thus perfectly legitimate arguments: 

(define (foo some-posn some-accessor)
  (some-accessor some-posn))

> (foo my-posn posn-x)
3





On Sep 6, 2011, at 2:17 PM, Todd Bittner wrote:

> Hi, 
> 
> I'm trying to something along the following lines:
> 
> > (define-struct posn (x y))
> > (define my-posn (3 4))
> > (define (foo posn-instance field)
> (posn-field posn-instance))
> 
> where calling 
> 
> (foo my-posn "x")  
> 
> would dynamically substitute posn-field with posn-x and the function would 
> return 3.
> 
> I don't know what to do with either "x" or posn-field to get this to work.  I 
> *think* I'm looking for something like a string->function function, where I 
> could pass in "x" and posn-field would be replaced by 
> 
> (string->function (string-append "posn-" field)) 
> 
> I just don't know if there's something that currently serves that purpose or, 
> if not, how to go about creating that function.
> 
> Thanks, 
> 
> Todd
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Dynamically calling struct accessors/method names

2011-09-06 Thread Matthias Felleisen

Are you reading the desired field name from somewhere? 



On Sep 6, 2011, at 2:29 PM, Todd Bittner wrote:

> Right, but what I want to do in this case is pass in 'x' and dynamically 
> construct posn-x rather than pass in the accessor 'posn-x' itself.  In other 
> words, I know I want to call a posn accessor, but I don't know which one yet.
> 
> I want to dynamically build and call the method rather than just dynamically 
> call the method.
> 
> On Tue, Sep 6, 2011 at 1:22 PM, Matthias Felleisen  
> wrote:
> 
> In Racket, accessors are functions and are thus perfectly legitimate 
> arguments:
> 
> (define (foo some-posn some-accessor)
>  (some-accessor some-posn))
> 
> > (foo my-posn posn-x)
> 3
> 
> 
> 
> 
> 
> 
> 

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Re: [racket] Dynamically calling struct accessors/method names

2011-09-06 Thread Matthias Felleisen

On Sep 6, 2011, at 2:44 PM, Todd Bittner wrote:

> Actually, on pondering it for a few more minutes,  your original solution is 
> sufficient for what I'm trying to do, which is to consolidate a lot of 
> similar code into one common parent function, but it would be interesting to 
> know how to call the function if I only had a string.  

Good. 


> So, if for argument's sake, I had a file with a list of approved functions 
> and one of them were 'posn-x', how would I take "posn-x" the string and turn 
> into posn-x, the accessor call (or function call if it weren't a struct)?  

Here are three solutions, which I would use in the order v0, v1, and defined 
select: 

#lang racket

(struct posn (x y) #:transparent)

(define in 
  (open-input-string (string-append "posn-" (if (< (random 100) 50) "x" "y"

;; case next protects me from someone sending me a bad command 
(define (select.v0 in) 
  (define next (read in))
  (case next 
[(posn-x) posn-x]
[(posn-y) posn-y]
[else (error 'select "attack!")]))

;; but if there are lots of commands and I need some speed, I'd create a hash 
table and associate symbols and functions 
(define (select.v1 in)
  "use some hash table")

;; if all of this fails, I may fall back on eval but only with trepidation 
(define-namespace-anchor top)

(define (select in)
  (eval (read in) (namespace-anchor->namespace top)))

;; test it all 
(define (foo a-posn a-selector)
  (a-selector a-posn))

(foo (posn 3 4) (select in))
 
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] syntax-parse and literals

2011-09-07 Thread Matthias Felleisen

I wonder whether this re-exporting problem isnt a problem of the 'signatures' 
in our module system. 

In the unit world, we can organize signatures in such a way that pieces are 
available for separate re-export elsewhere. We lack this in the module world. 
What I could imagine is 

 (provide (all-from-out cond-specs racket/base))

where cond-specs would specify cond and the else and => that come with it. It 
would require some more work on the provider's part but I think it would be 
well worth it. 

-- Matthias



On Sep 7, 2011, at 3:01 PM, Jay McCarthy wrote:

> I think that's true. Eli has an idea about how to use "sub-binding"
> information to deal with this better. I also think "modulets" might be
> an answer too. It's definitely something that needs to be improved in
> this case and in quite a few others. (For example, the documentation
> does a poor job letting you know what pre-defined struct properties
> there are.)
> 
> Jay
> 
> On Wed, Sep 7, 2011 at 12:57 PM, Shriram Krishnamurthi  
> wrote:
>> Thanks for the very informative thread.
>> 
>> Piecing together what Asumu, Jay, Robby, and Eli said, I think I
>> understand what's going on, and I think this actually answers a
>> question I asked last year and didn't get an answer to: Why do require
>> and provide export their sub-forms as macros rather than just make
>> them local keywords.
>> 
>> What I understand now is that by exporting the sub-forms as macros,
>> one can ensure that the binding structure is just right.  I think this
>> is what Jay means when he says "I consider insisting on bindings a
>> feature, because it promotes well-behaved macros".
>> 
>> The downside is that a single "feature" now has a whole bunch of
>> exports, and anyone who wants to re-export the feature has to know
>> about and re-export all the other bound names as well.  For instance,
>> I can't just re-export "require" -- I have to track all the require
>> sub-forms and re-export those as well.
>> 
>> Shriram
>> 
> 
> 
> 
> -- 
> Jay McCarthy 
> Assistant Professor / Brigham Young University
> http://faculty.cs.byu.edu/~jay
> 
> "The glory of God is Intelligence" - D&C 93
> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] online check syntax error display tweak

2011-09-09 Thread Matthias Felleisen
On Sep 9, 2011, at 12:05 PM, Vincent St-Amour wrote:

> At Fri, 9 Sep 2011 10:58:23 -0500,
> Robby Findler wrote:
>> I thought about that, but I didn't want it to overlap the text and I
>> didn't want it to slide everything over to make space.
> 
> What about horizontal lines before and after the relevant line,
> running across the whole editor. Finding the relevant code becomes a
> matter of following the lines. Grant Rettke's IntelliJ screenshot does
> something similar, and I think it helps.


The lines there look like method separators (possibly collapsible 
method cells in the editor). 

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Documenting a financial model in Racket?

2011-09-09 Thread Matthias Felleisen

On Sep 9, 2011, at 11:23 AM, Grant Rettke wrote:

> Hi,
> 
> At work I've inherited a financial application whose model that is too
> complicated to be documented.
> 
> It has got me really curious how I might use Racket to document,
> understand, and implement the model so that we can really flesh out
> how it works. It would be useful purely from that regard, and also if
> we ever migrated to a different technology (than Java).
> 
> What approaches, techniques, or features of Racket do you think might
> be interesting?
> 
> My list: Typed Racket, in-code documentation, Rackunit,
> purely-functional or perhaps classes and interfaces, not sure what
> would be easier for people to read.


I like Neil's answer. Here is a supplement. 

You say 'is too complicated to be documented' but I hope that this 
is not what you mean. To be precise, I hope you mean the author didn't 
take the time to document it and that you wish to document it in a way
that you and others find useful in the future. 

In a sense you are in the same position as someone who wishes to understand
Javascript as a programming language. You can run some exploratory programs
but this approach does not produce the general insights you need to make 
predictions about the entire language. Instead you wish to (re-)engineer 
a semantic model that you can use to predict things the way weathermen
predict the weather. 

A program like yours might be as complex as a programming language but 
I am sure it needs a slightly different approach. 

If the program has a test suite, I would try to use the test suite 
to develop a mathematical understanding of this model: 

  a concise, short, executable specification. 

I insist on executable so that you can run it on the existing test
suite. As you recover the underlying mathematical model in this manner
you get (1) useful documentation and (2) a second but possibly slow 
implementation. I claim that Racket and or Typed Racket are one good 
way to develop this executable model. When you have covered the entire
test suite, you can start working on the [Typed]Racket with the methods
that Neil proposed. 

If your program does not have a test suite, your first job to understand
and document it is to create a test suite. 

-- Matthias


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] About bug reporting

2011-09-09 Thread Matthias Felleisen

Please don't use 'user' to report bugs. The bug database is valuable to all of 
us. 

We just switched 'bug czars' and the new one is still finding his way into 
assignments. 

Sorry for any delays -- Matthias



On Sep 9, 2011, at 6:44 PM, Jos Koot wrote:

> My experienve too is that bugs reported via the Racket users list are
> responded to more quickly. Nevertheless I think a bug report is the right
> medium. Let's not forget that the PLT team has much work at hand. My
> experience is that after some patience, bug reports are treated very
> sincerely. May be the PLT team is too kind accepting bugs reported on the
> users list where the reports should be posted on the bugs report site. By
> using this site you also inform the PLT team what version and platform you
> are using.
> Jos 
> 
> -Original Message-
> From: users-boun...@racket-lang.org [mailto:users-boun...@racket-lang.org]
> On Behalf Of Stephen Chang
> Sent: viernes, 09 de septiembre de 2011 23:20
> To: Eddie Rucker
> Cc: users@racket-lang.org
> Subject: Re: [racket] About bug reporting
> 
> It looks like it has been received but not assigned yet. The beginning
> of the school year tends to be a busier time for most, so it may take
> slightly longer for bugs to get fixed.
> 
> You can track the status of your bug report here:
> 
> http://bugs.racket-lang.org/query/?cmd=view&pr=12149
> 
> 
> 
> 
> 
> On Fri, Sep 9, 2011 at 4:58 PM, Eddie Rucker  wrote:
>> Hello,
>> 
>> I sent a list-box% bug to b...@racket-lang.org on August 31. Since I
> haven't gotten a response, I just wondered if you got the report, or I did
> something incorrectly, or you guys haven't gotten to it yet? If you haven't
> gotten to it yet, I promise to be more patient.
>> 
>> Eddie Rucker
>> 
>> Director of Institutional Research
>> Blue Mountain College
>> 
>> 
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>> 
> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
> 
> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] how can we modify the example from the reference

2011-09-11 Thread Matthias Felleisen


The paragraph in 1.2.3.9 starts with "For a top-level definition (outside of a 
module), the order of evaluation affects the binding of a generated definition 
for a generated identifier use." So when you run this example in a top-level 
environment, e.g., the interactions window (aka repl) it works fine: 

 > (defs-and-usess)
 #t

If you place this example in a definitions window with #lang racket, it is 
INSIDE a module and signals the error you mention in your message. 

This is indeed a subtle point, and I wish we had no top-level. -- Matthias




On Sep 11, 2011, at 8:18 PM, André Mayers wrote:

> In the section 1.2.3.9 : Macro-Introduced Bindings
> 
> the example below give the following error 
> "define-syntaxes: context (defining "odd.1", ...) expected 2 values,
> received 0 values"
> 
>  (define-syntax defs-and-uses
> (syntax-rules ()
>   [(def-and-use)
>(begin
> ; Declare before definition via no-values define-syntaxes:
> (define-syntaxes (odd even) (values))
> (define (odd x) (if (zero? x) #f (even (sub1 x
> (define (even x) (if (zero? x) #t (odd (sub1 x
> (odd 17))]))
> 
> 
> 
> 
> André Mayers, Ph.D., M. Ps.
> professeur agrégé
> Département d'informatique
> Université de Sherbrooke
> Sherbrooke (Québec) Canada J1K 2R1
> tél: +1 819-821-8000 poste 62041
> fax: +1 819-821-8200
> andre.may...@usherbrooke.ca
> http://info.usherbrooke.ca/AndreMayers
> 
> 
> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


[racket] Racket style guide (was Re: Argument order conventions (was: Variable naming conventions))

2011-09-14 Thread Matthias Felleisen


For the past few months, I have been writing a style guide for new Racket 
PLTers. The current draft is available at 

http://www.ccs.neu.edu/home/matthias/Style/style/ 

I had hoped to complete it a bit more and polish it a bit more, but this 
discussion suggests that people might be interested in reading it and 
commenting on it. 

-- Matthias


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Racket style guide (was Re: Argument order conventions(was: Variable naming conventions))

2011-09-15 Thread Matthias Felleisen

What do you mean with 'centered'? Could you send a url and a description of 
what you see? I see nothing centered. -- Matthias




On Sep 15, 2011, at 7:20 AM, Jos Koot wrote:

> Thanks, Matthias. Even after a quick glance, I have seen many good advices.
> 
> However, why is the text in all code examples I have seen sofar centered? To
> me this seems bad.
> 
> Jos 
> 
> -Original Message-
> From: users-boun...@racket-lang.org [mailto:users-boun...@racket-lang.org]
> On Behalf Of Matthias Felleisen
> Sent: jueves, 15 de septiembre de 2011 2:47
> To: Rodolfo Carvalho
> Cc: Racket-users
> Subject: [racket] Racket style guide (was Re: Argument order
> conventions(was: Variable naming conventions))
> 
> 
> 
> For the past few months, I have been writing a style guide for new Racket
> PLTers. The current draft is available at 
> 
>http://www.ccs.neu.edu/home/matthias/Style/style/ 
> 
> I had hoped to complete it a bit more and polish it a bit more, but this
> discussion suggests that people might be interested in reading it and
> commenting on it. 
> 
> -- Matthias
> 
> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
> 


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Racket in the world

2011-09-15 Thread Matthias Felleisen

Cool. 


On Sep 14, 2011, at 6:57 PM, Matt Jadud wrote:

> Hi all,
> 
> Start with the video of an installation piece at Ars Electronica:
> 
> http://vimeo.com/29037809
> 
> This was announced on the Fluxus mailing list (where I lurk):
> 
> http://lists.pawfal.org/pipermail/fluxus-pawfal.org/2011-September/004508.html
> 
> Fluxus is notable because it is built using the Mz/DrRacket platform.
> The code for the piece you saw in the video is here:
> 
> https://github.com/gaborpapp/Chromosonia
> 
> In the event that any of the Fluxus peeps lurk here: awesome work.
> I've acquired a third thumb so as to give it three thumbs up.
> 
> Cheers,
> Matt
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Racket style guide (was Re: Argument order conventions (was: Variable naming conventions))

2011-09-16 Thread Matthias Felleisen

On Sep 16, 2011, at 1:42 PM, Greg Hendershott wrote:

> This is very helpful! Thank you for creating it.
> 
> One tiny thing I noticed is that section 3 has comments that start
> with one semi-colon, but section 4.1 seems to recommend two?


Scribble does one semi-colon no matter how many you put into the source. I 
should probably say so :-) 



> 
> On Wed, Sep 14, 2011 at 8:47 PM, Matthias Felleisen
>  wrote:
>> 
>> 
>> For the past few months, I have been writing a style guide for new Racket 
>> PLTers. The current draft is available at
>> 
>>http://www.ccs.neu.edu/home/matthias/Style/style/
>> 
>> I had hoped to complete it a bit more and polish it a bit more, but this 
>> discussion suggests that people might be interested in reading it and 
>> commenting on it.
>> 
>> -- Matthias
>> 
>> 
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>> 


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Accessing lambda arguments in a macro

2011-09-16 Thread Matthias Felleisen


What should (foo bar) return? 


On Sep 16, 2011, at 3:46 PM, Daniel MacDougall wrote:

> Is there any way to define a macro that expands out to a lambda, and then 
> access the arguments passed to that lambda from outside the macro in the 
> calling context?
> Here's an example of what I mean:
> 
> #lang racket
> 
> (define-syntax-rule (foo form ...)
>   ((lambda (bar) form ...) "ARG"))
> 
> (foo "Hello") ; => returns "Hello"
> 
> (foo bar) ; => expand: unbound identifier in module in: bar
> 
> 
> I'd like access to the "bar" argument on the last line. Is this possible with 
> Racket macros?
> 
> Thanks,
> Daniel
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Accessing lambda arguments in a macro

2011-09-16 Thread Matthias Felleisen


Why not just store the arguments to lambda in some 'register' and ask for them? 




On Sep 16, 2011, at 4:09 PM, Daniel MacDougall wrote:

> In this example it should return "ARG".
> 
> On Fri, Sep 16, 2011 at 1:08 PM, Matthias Felleisen  
> wrote:
> 
> 
> What should (foo bar) return?
> 
> 
> On Sep 16, 2011, at 3:46 PM, Daniel MacDougall wrote:
> 
> > Is there any way to define a macro that expands out to a lambda, and then 
> > access the arguments passed to that lambda from outside the macro in the 
> > calling context?
> > Here's an example of what I mean:
> >
> > #lang racket
> >
> > (define-syntax-rule (foo form ...)
> >   ((lambda (bar) form ...) "ARG"))
> >
> > (foo "Hello") ; => returns "Hello"
> >
> > (foo bar) ; => expand: unbound identifier in module in: bar
> >
> >
> > I'd like access to the "bar" argument on the last line. Is this possible 
> > with Racket macros?
> >
> > Thanks,
> > Daniel
> > _
> >  For list-related administrative tasks:
> >  http://lists.racket-lang.org/listinfo/users
> 
> 


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Accessing lambda arguments in a macro

2011-09-16 Thread Matthias Felleisen

Yes, I was thinking of naming the register explicitly too. 

On Sep 16, 2011, at 4:17 PM, Daniel MacDougall wrote:

> I suppose that would work. Sam suggested on #racket that I include the name 
> of the argument in the macro definition:
> 
> (define-syntax-rule (foo bar form ...)
>   ((lambda (bar) form ...) "ARG"))
> 
> Then you could say:
> 
> (foo bar
>   ; Do stuff with bar here...
>   )
> 
> On Fri, Sep 16, 2011 at 1:12 PM, Matthias Felleisen  
> wrote:
> 
> 
> Why not just store the arguments to lambda in some 'register' and ask for 
> them?
> 
> 
> 
> 
> On Sep 16, 2011, at 4:09 PM, Daniel MacDougall wrote:
> 
> > In this example it should return "ARG".
> >
> > On Fri, Sep 16, 2011 at 1:08 PM, Matthias Felleisen  
> > wrote:
> >
> >
> > What should (foo bar) return?
> >
> >
> > On Sep 16, 2011, at 3:46 PM, Daniel MacDougall wrote:
> >
> > > Is there any way to define a macro that expands out to a lambda, and then 
> > > access the arguments passed to that lambda from outside the macro in the 
> > > calling context?
> > > Here's an example of what I mean:
> > >
> > > #lang racket
> > >
> > > (define-syntax-rule (foo form ...)
> > >   ((lambda (bar) form ...) "ARG"))
> > >
> > > (foo "Hello") ; => returns "Hello"
> > >
> > > (foo bar) ; => expand: unbound identifier in module in: bar
> > >
> > >
> > > I'd like access to the "bar" argument on the last line. Is this possible 
> > > with Racket macros?
> > >
> > > Thanks,
> > > Daniel
> > > _
> > >  For list-related administrative tasks:
> > >  http://lists.racket-lang.org/listinfo/users
> >
> >
> 
> 


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Dr. Racket for FPGA development

2011-09-17 Thread Matthias Felleisen

What we really need is a #lang pre. 


On Sep 17, 2011, at 12:24 PM, Neil Van Dyke wrote:

> If someone wanted to implement a somewhat Racket-like language for FPGAs, 
> PreScheme is worth looking at.
> http://mumble.net/~kelsey/papers/prescheme.ps.gz
> 
> -- 
> http://www.neilvandyke.org/
> _
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Quoted expressions in #lang racket

2011-09-18 Thread Matthias Felleisen

On Sep 18, 2011, at 10:34 AM, Grant Rettke wrote:

> 2011/9/18 Racket Noob :
>> In Common Lisp or Clojure REPL, expression '(1 2 3) evaluates to (1 2 3).


No it doesn't. In CL and Clojure, '(1 2 3) evaluates to '(1 2 3) and then the 
printer turns it into (1 2 3). 

Now imagine you wish to experiment at the REPL. (What an outrageous idea but 
some of us do.) In that case, you may wish to reuse a result from some REPL 
computation in the repl again. Just paste it back in and run. Ouch for Common 
Lisp. Ouch for Clojure: 

 function expected; given 1 

This issue was clarified in a beautiful MIT dissertation around 1980 (Brian 
Smith) and nailed once and for all. Sadly Brian chose a horrible slogan, which 
the rest of the MIT lispers didn't understand and so his ideas got buried. I 
re-discovered them and so did many others. 

Go figure why Lispers are hung up on a mistake from the 1950s. 

-- Matthias




_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Quoted expressions in #lang racket

2011-09-18 Thread Matthias Felleisen

Mr Noob: if (1 2 3) is a value, why can't I compute (car (1 2 3)). 4 is a value 
and I can compute (+ 4 3). #t is a value and I can compute (not #t). Why do you 
insist that I cannot compute with (1 2 3) if it is a value? 
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Quoted expressions in #lang racket

2011-09-18 Thread Matthias Felleisen

Just because Lisp got it wrong for 22+ years and most Lisps are still doing it 
wrong, we don't have to continue making the same mistake. Long live 2Lisp, 
3Lisp, and all other rational Lisps. 
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


Re: [racket] Racket style guide (was Re: Argument order conventions (was: Variable naming conventions))

2011-09-20 Thread Matthias Felleisen

On Sep 20, 2011, at 1:42 AM, Tom McNulty wrote:

> Thanks for the guide!
> 
> What is the Racket convention for named constants? 
> 
> Somewhere along the way I picked up the convention of prefixing constants 
> with k, ie. kMyConstant.   Transmuted into racket I find myself typing:
> (define k-my-constant ...)  is there an established convention?


We have personal conventions (cap C, all caps) but no universal one, which is 
why the style guide doesn't have one. 

-- Matthias


_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users


  1   2   3   4   5   6   7   8   9   10   >