[racket-dev] Fwd: Sandbox evaluation problem - files with comment boxes

2015-01-26 Thread Nadeem Abdul Hamid
Ah, I am still struggling with this sandbox problem! (previous message to
'users' below) I'm starting to feel like maybe there's a bug in 6.1.1, or
else something changed in recent versions that I'm missing. The following
screenshots show the entire contents of the BSL file that I'm trying to
load using make-module-evaluator, with gracket v6.1.1 failing the second
time you try to load the file (or another one) that contains a comment box,
while racket v6.1.1 and gracket 6.0 don't have this behavior:

http://cs.berry.edu/~nhamid/temp/foo.png
http://cs.berry.edu/~nhamid/temp/foo60.png

???

--- nadeem



-- Forwarded message --
From: Nadeem Abdul Hamid 
Date: Sun, Jan 25, 2015 at 10:35 PM
Subject: Sandbox evaluation problem - files with comment boxes
To: users 



I'm trying to create a simple sandbox evaluator (to load in programs in
*SL). I have the following code:

#lang racket
(require racket/sandbox)
(define E
  (parameterize ([sandbox-path-permissions
  '([write "/var/folders"]
[exists "/"]
[read "/"])]
 )
(make-module-evaluator (string->path "test-file.rkt"


This works fine as long as test-file.rkt does *not* contain a comment box.
If the file contains a comment box, then the following error occurs:

/Applications/Racket
v6.1.1/share/pkgs/snip-lib/racket/snip/private/load-one.rkt:21:2:
dynamic-require: unknown module
  module name: #



I thought maybe parameterizing sandbox-namespace-specs with 'framework
might do something:

(require racket/sandbox racket/gui)
(define E
  (parameterize ([sandbox-path-permissions
  '([write "/var/folders"]
[exists "/"]
[read "/"])]
 [sandbox-namespace-specs
  (list make-gui-namespace 'framework)]
 )
(make-module-evaluator (string->path "lab01-insulin.rkt"

But it results in:
   namespace-attach-module: a different instance of the same module is
already in the destination namespace
  module name: "/Applications/Racket
v6.1.1/collects/racket/stxparam-exptime.rkt"


Any suggestions?

Thanks!

--- nadeem
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Sandbox evaluation problem - files with comment boxes

2015-01-27 Thread Nadeem Abdul Hamid
Ok, thank you! I can use the latest build.
--- nadeem

On Tuesday, January 27, 2015, Matthew Flatt  wrote:

> Yes, it's a bug in v6.1.1. I've just pushed a repair for the next
> build.
>
> Do you need a workaround for v6.1.1? Your variant that sets
> `sandbox-namespace-specs` is what I would have tried; unfortunately,
> that runs into a second bug in v6.1.1 that I recently fixed. If you
> need a workaround other than using the next snapshot, I can look harder
> for one.
>
> Thanks for the report!
>
> At Mon, 26 Jan 2015 21:27:31 -0500, Nadeem Abdul Hamid wrote:
> > Ah, I am still struggling with this sandbox problem! (previous message to
> > 'users' below) I'm starting to feel like maybe there's a bug in 6.1.1, or
> > else something changed in recent versions that I'm missing. The following
> > screenshots show the entire contents of the BSL file that I'm trying to
> > load using make-module-evaluator, with gracket v6.1.1 failing the second
> > time you try to load the file (or another one) that contains a comment
> box,
> > while racket v6.1.1 and gracket 6.0 don't have this behavior:
> >
> > http://cs.berry.edu/~nhamid/temp/foo.png
> > http://cs.berry.edu/~nhamid/temp/foo60.png
> >
> > ???
> >
> > --- nadeem
> >
> >
> >
> > -- Forwarded message --
> > From: Nadeem Abdul Hamid >
> > Date: Sun, Jan 25, 2015 at 10:35 PM
> > Subject: Sandbox evaluation problem - files with comment boxes
> > To: users >
> >
> >
> >
> > I'm trying to create a simple sandbox evaluator (to load in programs in
> > *SL). I have the following code:
> >
> > #lang racket
> > (require racket/sandbox)
> > (define E
> >   (parameterize ([sandbox-path-permissions
> >   '([write "/var/folders"]
> > [exists "/"]
> > [read "/"])]
> >  )
> > (make-module-evaluator (string->path "test-file.rkt"
> >
> >
> > This works fine as long as test-file.rkt does *not* contain a comment
> box.
> > If the file contains a comment box, then the following error occurs:
> >
> > /Applications/Racket
> > v6.1.1/share/pkgs/snip-lib/racket/snip/private/load-one.rkt:21:2:
> > dynamic-require: unknown module
> >   module name: # > v6.1.1/share/pkgs/gui-lib/framework/main.rkt">
> >
> >
> >
> > I thought maybe parameterizing sandbox-namespace-specs with 'framework
> > might do something:
> >
> > (require racket/sandbox racket/gui)
> > (define E
> >   (parameterize ([sandbox-path-permissions
> >   '([write "/var/folders"]
> > [exists "/"]
> > [read "/"])]
> >  [sandbox-namespace-specs
> >       (list make-gui-namespace 'framework)]
> >  )
> > (make-module-evaluator (string->path "lab01-insulin.rkt"
> >
> > But it results in:
> >namespace-attach-module: a different instance of the same module is
> > already in the destination namespace
> >   module name: "/Applications/Racket
> > v6.1.1/collects/racket/stxparam-exptime.rkt"
> >
> >
> > Any suggestions?
> >
> > Thanks!
> >
> > --- nadeem
> > _
> >   Racket Developers list:
> >   http://lists.racket-lang.org/dev
>


-- 

--
Nadeem Abdul Hamid
Associate Professor, Computer Science
Berry College, Mount Berry, GA 30149
http://cs.berry.edu/~nhamid/
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Feature suggestion

2010-06-05 Thread Nadeem Abdul Hamid
I think the earlier discussion was for a more ambitious feature than the one 
suggested below. This would be to fill in just a template of the arguments 
*after* the function name had already been entered. Would not involve searching 
for functions/methods applicable to a particular type. 
--- nadeem

On Jun 5, 2010, at 12:20 PM, Matthias Felleisen wrote:

> 
> We discussed this extensively a while a ago on this list in response to a 
> comment by Simon Peyton Jones when he visited NEU for a few days -- Matthias
> 
> 
> 

> From: Paul Steckler 
> Date: June 4, 2010 10:20:29 PM EDT
> To: dev@racket-lang.org
> Subject: [racket-dev] Feature suggestion
> 
> Over the past few months, I've had to spend a lot of time in Visual
> Studio (no comments from the
> peanut gallery, please!).  It has a feature that might be useful in
> DrRacket.  When you enter a
> class or class instance name followed by a dot, you get a popup of
> valid methods.  Yes, DrRacket
> has the name completion feature.  But after you enter one of the VS
> method names and an open
> paren, you get a signature (or often, many signatures due to a
> maddening number of overloads).
> As you type in arguments, the relevant part of the signature becomes
> bold-faced.
> 
> You really get addicted to this setup -- see the article "Does Visual
> Studio Rot the Mind?" by
> Charles Petzold.
> 
> Currently, DrRacket offers name completion and the ability to lookup
> names in Help Desk.
> That works, but it's a bit ungainly.  It would be ne plus ultra cool
> if when you entered
> 
>  (some-fun
> 
> you got a popup with the arguments to be entered.   If `some-fun' is
> in Help Desk, their arguments
> could have their names and types.  If `some-fun' is defined in the
> current file or require'd, you'd
> just have the argument names.  Ambitiously, if the argument had a
> corresponding predicate in a
> contract, you could show that.
> 
> -- Paul

> On Jun 4, 2010, at 10:47 PM, Neil Van Dyke wrote:
> 
>> Perhaps also worth considering for inspiration is "elsoc", a useful hack 
>> that Emacs has had for arguments quick-reference.
>> 
>> "eldoc" does a transient display of the args to the innermost function/form 
>> that point is in.  This display appears in the ``echo area'' of the frame 
>> (roughly, status bar at the bottom of the window), so you can glance at it, 
>> but it doesn't get in your face while you're looking at the code and typing.
>> 
>> http://www.gnu.org/software/emacs/manual/html_node/emacs/Lisp-Doc.html
>> http://www.emacswiki.org/emacs/ElDoc
>> 
>> I'm sure that DrRacket would do it not as a hack like "eldoc", but instead 
>> use some info that Check Syntax has. :)
>> 
>> Neil V.
>> 
>> _
>> For list-related administrative tasks:
>> http://lists.racket-lang.org/listinfo/dev
> 
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev

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

[racket-dev] Feature request: allow 2htdp/image bitmap function to load from URL

2010-06-13 Thread Nadeem Abdul Hamid
Below is a quick hack I did to allow loading a 2htdp/image bitmap from a url 
like this:

(bitmap (url "http://docs.racket-lang.org/teachpack/4e85791a5.png";))

There's no error checking, and I was too lazy to do a diff, but I've marked the 
three pieces that I added with "; .nah." comments. Would it be possible to add 
this feature to the library? This would have been a little easier maybe if 
bitmap% provided load from ports, but I see that's an open PR (9335). 

Thanks,
--- nadeem


(define-syntax (bitmap stx)
  (syntax-case stx ()
[(_ arg)
 (let* ([arg (syntax->datum #'arg)]
[url? (and (pair? arg) (eq? (car arg) 'url))]   ; .nah.
[path
 (cond
   [(and (pair? arg)
 (eq? (car arg) 'planet))
(raise-syntax-error 'bitmap "planet paths not yet supported" 
stx)]
   ; .nah. ...
   [url?
(let ([temp-path (make-temporary-file)])
  (call-with-output-file temp-path
(lambda (outp) 
  (call/input-url 
   (string->url (cadr arg)) get-pure-port
   (lambda (inp) 
 (copy-port inp outp)
)))
#:exists 'replace
)
  (display temp-path)
  temp-path
  )]
   ; ... .nah.
   [(symbol? arg)
(let ([pieces (regexp-split #rx"/" (symbol->string arg))])
  (cond
[(null? pieces)
 (raise-syntax-error 'bitmap "expected a path with a / in 
it" stx)]
[else
 (let loop ([cps (current-library-collection-paths)])
   (cond
 [(null? cps)
  (raise-syntax-error 'bitmap
  (format "could not find the ~a 
collection" (car pieces))
  stx)]
 [else
  (if (and (directory-exists? (car cps))
   (member (build-path (car pieces))
   (directory-list (car cps
  (let ([candidate (apply build-path (car cps) 
pieces)])
(if (file-exists? candidate)
candidate
(raise-syntax-error 'bitmap 
(format "could not find 
~a in the ~a collection"
(apply 
string-append (add-between (cdr pieces) "/"))
(car pieces))
stx)))
  (loop (cdr cps)))]))]))]
   [(string? arg)
(path->complete-path 
 arg
 (or (current-load-relative-directory)
 (current-directory)))])]
)
   ; .nah. ...
   #`(let ([result (make-object image-snip% (make-object bitmap% #,path 
'unknown/mask))])
   (when #,url? (delete-file #,path))
   result)
   ; ... .nah.
   )]))
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] self-documenting feature

2010-07-19 Thread Nadeem Abdul Hamid
Yes, when I taught "HtDP" in Python two years ago, this feature was handy. It 
provide a more convenient way for recalling/looking up contract/purpose 
statements right in the REPL than opening a search in a browser. If I remember 
correctly, I think the IDE might have also done something smart with these, 
like providing a popup hint with the function doc (or at least the first line) 
when you typed the function name while editing a file. Here's a quick 
interaction with the Python shell in IDLE:

>>> def f(x):
'''this is the first line
   this is the second line of the doc
   and so on'''
return 3+x

>>>f(

(at this point a text hint pops up with the following contents:
|-
| (x)
| this is the first line
|-

So, it worked very well with the design recipe if you put the contract as the 
first line in the comment. Then for more detail, you use "help":

>>> help(f)
Help on function f in module __main__:

f(x)
this is the first line
of the doc
and so on



--- nadeem


On Jul 19, 2010, at 10:16 AM, Shriram Krishnamurthi wrote:

> Python apparently has a feature where you essentially put the
> contract/purpose in the text of a function, and when you type the
> function's name, it prints out that documentation.  (It sounds like
> the docstrings of Common Lisp.)
> 
> This came up on day 1, minute 15 of the TSRJ workshop.
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev

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


Re: [racket-dev] self-documenting feature

2010-07-19 Thread Nadeem Abdul Hamid
>> Do ask the person who asked whether Python has coverage now. -- Matthias

Maybe not packaged for beginners, but it is doable...
  http://pypi.python.org/pypi/coverage/2.85 
  http://nedbatchelder.com/code/coverage/





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


Re: [racket-dev] self-documenting feature

2010-07-19 Thread Nadeem Abdul Hamid
Yes, but Racket docstrings aren't even there at all (yet :))...

On Jul 19, 2010, at 4:58 PM, Matthias Felleisen wrote:

> 
> That's the question. Packaged for beginners; always there, never to ask for. 
> 
> 
> On Jul 19, 2010, at 4:55 PM, Nadeem Abdul Hamid wrote:
> 
>>>> Do ask the person who asked whether Python has coverage now. -- Matthias
>> 
>> Maybe not packaged for beginners, but it is doable...
>> http://pypi.python.org/pypi/coverage/2.85 
>> http://nedbatchelder.com/code/coverage/
>> 
>> 
>> 
>> 
>> 
> 

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


[racket-dev] What happened to image=? in 2htdp/image

2010-08-29 Thread Nadeem Abdul Hamid
Is the idea to use equal? to compare images? Wouldn't it be better to
define image=? just for the sake of uniformity?

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


Re: [racket-dev] What happened to image=? in 2htdp/image

2010-08-29 Thread Nadeem Abdul Hamid
Oh, I see what happened: image=? is provided from lang/htdp-*, which I
happened to not have not imported -- I was working in a Racket file
that only imported 2htdp/image. And then I looked in the "Equality
testing of images" section of the 2htdp/image documentation:
   
http://docs.racket-lang.org/teachpack/2htdpimage.html#(part._.Equality_.Testing_of_.Images)
and it didn't mention image=?, nor was it anywhere else on the page,
while it does occur in the documentation of htdp/image:
   
http://docs.racket-lang.org/teachpack/image.html#(def._((lib._htdp/image..rkt)._image~3d~3f))

So, yes, maybe image=? should be re-exported from 2htdp/image, or at
least mentioned/linked to in the section about equality of images.

--- nadeem


On Sun, Aug 29, 2010 at 2:58 PM, Robby Findler
 wrote:
> image=? seems to work okay to me.  Is there some misleading
> documentation or something somewhere that gives you the impression
> that image=? doesn't work?
>
> Robby
>
> On Sun, Aug 29, 2010 at 12:58 PM, Nadeem Abdul Hamid  wrote:
>> Is the idea to use equal? to compare images? Wouldn't it be better to
>> define image=? just for the sake of uniformity?
>>
>> --- nadeem
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/dev
>>
>
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


[racket-dev] Universe double buffering

2010-09-02 Thread Nadeem Abdul Hamid
Why doesn't 2htdp/universe use double-buffering?

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


Re: [racket-dev] Universe double buffering

2010-09-02 Thread Nadeem Abdul Hamid
> Why do you think it doesn't?

(I'm assuming you mean: "What makes me think that it is not
double-buffering?") ...

I have a list of 15 thumbnail images of people and a function that
places pairs of them side by side, using above/beside to create a 133
x 581 image. i.e.
   choose-and-show-pairs : (listof image) -> image

Now, when I do:
(big-bang PIC-LIST
  (on-draw choose-and-show-pairs))

I see each individual image getting laid out, one by one, rather
excrutiatingly slowly. The choose-and-show-pairs actually randomizes
the pairing up, and so if I move the mouse over the canvas, apparently
the redraw handler is called, so I see a new set of pairs getting laid
out, very slowly.

I would have expected a double-buffered implementation to lay out the
images in memory on some bitmap buffer and then quickly transfer the
bitmap buffer to the canvas, so you don't actually witness the effect
of all the above/beside operations happening.


>
>
>
>
> On Sep 2, 2010, at 8:52 AM, Nadeem Abdul Hamid wrote:
>
>> Why doesn't 2htdp/universe use double-buffering?
>>
>> --- nadeem
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/dev
>
>



-- 
Nadeem Abdul Hamid
Associate Professor, Computer Science
Berry College
PO Box 5014
2277 Martha Berry Hwy NW
Mount Berry, GA 30149-5014
(706) 368-5632
http://cs.berry.edu/~nhamid/
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] Universe double buffering

2010-09-02 Thread Nadeem Abdul Hamid
It still behaves the same. I can literally capture a screenshot of the
canvas at any point where only a portion of the pictures have been
drawn on it.


On Thu, Sep 2, 2010 at 9:53 AM, Robby Findler
 wrote:
> What happens if you restart drracket and try the same program again?
> (If the double buffering appears to come back I think I know what
> happened.)
>
> Robby
>
> On Thu, Sep 2, 2010 at 8:15 AM, Nadeem Abdul Hamid  wrote:
>>> Why do you think it doesn't?
>>
>> (I'm assuming you mean: "What makes me think that it is not
>> double-buffering?") ...
>>
>> I have a list of 15 thumbnail images of people and a function that
>> places pairs of them side by side, using above/beside to create a 133
>> x 581 image. i.e.
>>   choose-and-show-pairs : (listof image) -> image
>>
>> Now, when I do:
>> (big-bang PIC-LIST
>>          (on-draw choose-and-show-pairs))
>>
>> I see each individual image getting laid out, one by one, rather
>> excrutiatingly slowly. The choose-and-show-pairs actually randomizes
>> the pairing up, and so if I move the mouse over the canvas, apparently
>> the redraw handler is called, so I see a new set of pairs getting laid
>> out, very slowly.
>>
>> I would have expected a double-buffered implementation to lay out the
>> images in memory on some bitmap buffer and then quickly transfer the
>> bitmap buffer to the canvas, so you don't actually witness the effect
>> of all the above/beside operations happening.
>>
>>
>>>
>>>
>>>
>>>
>>> On Sep 2, 2010, at 8:52 AM, Nadeem Abdul Hamid wrote:
>>>
>>>> Why doesn't 2htdp/universe use double-buffering?
>>>>
>>>> --- nadeem
>>>> _
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


[racket-dev] Providing macro definitions for BSL programs

2010-09-04 Thread Nadeem Abdul Hamid
Suppose I make a "teachpack" that defines a macro:

#lang racket
...
(define-syntax (my-macro stx)
  (syntax-case stx (->)
[(_ (func arg ...) -> rslt)
 #`(check-expect (func arg ...) rslt)]))
(my-macro (+ 4 5) -> 10)
(test)
(provide my-macro)

Running this file works fine.

Now, how exactly do I make this macro available to programs written in
Beginning/Intermediate Student? Opening up a file in BSL level and
typing:
  (require "my-macro.rkt")
  (my-macro (+ 4 5) -> 9)
gives the error:
  my-macro: bad syntax

This macro is a simplification of the real thing I'm working on, but
note that the arguments to this macro include name(s) of functions
defined in the BSL file. I though of maybe using
provide-higher-order-primitive, but it doesn't seem to work either.

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


Re: [racket-dev] Providing macro definitions for BSL programs

2010-09-04 Thread Nadeem Abdul Hamid
Ah, thank you. Now, how about this definition:

(define-syntax (my-macro stx)
  (syntax-case stx (->)
[(_ (func arg ...) -> rslt)
 #`(length (cons func (list arg ...)))]))
(provide my-macro ->)

i.e. my macro takes the function name, bundles in up in a structure
(here I just used "cons") and then maybe passes it off to something
else for processing (here I just used "length" for illustration).

Now, doing something like this in the BSL file:
   (my-macro (reward 3) -> "bronze")

produces:
  reward: this is a procedure, so it must be applied to arguments
(which requires using a parenthesis before the name)





On Sat, Sep 4, 2010 at 4:42 PM, Matthias Felleisen  wrote:
>
> You need to define and export -> . Otherwise students don't have access to 
> the specific -> in your macro.
>
> BTW, injecting macros into *sl languages demands a lot of error checking 
> because novices are easily confused.
>
>
>
>
> On Sep 4, 2010, at 4:37 PM, Nadeem Abdul Hamid wrote:
>
>> Suppose I make a "teachpack" that defines a macro:
>>
>> #lang racket
>> ...
>> (define-syntax (my-macro stx)
>>  (syntax-case stx (->)
>>    [(_ (func arg ...) -> rslt)
>>     #`(check-expect (func arg ...) rslt)]))
>> (my-macro (+ 4 5) -> 10)
>> (test)
>> (provide my-macro)
>>
>> Running this file works fine.
>>
>> Now, how exactly do I make this macro available to programs written in
>> Beginning/Intermediate Student? Opening up a file in BSL level and
>> typing:
>>  (require "my-macro.rkt")
>>  (my-macro (+ 4 5) -> 9)
>> gives the error:
>>  my-macro: bad syntax
>>
>> This macro is a simplification of the real thing I'm working on, but
>> note that the arguments to this macro include name(s) of functions
>> defined in the BSL file. I though of maybe using
>> provide-higher-order-primitive, but it doesn't seem to work either.
>>
>> --- nadeem
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/dev
>
>
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] Providing macro definitions for BSL programs

2010-09-04 Thread Nadeem Abdul Hamid
> See `first-order->higher-order'.

Yep. That does the trick.
Thanks,
--- nadeem


>
> At Sat, 4 Sep 2010 17:00:52 -0400, Nadeem Abdul Hamid wrote:
>> Ah, thank you. Now, how about this definition:
>>
>> (define-syntax (my-macro stx)
>>   (syntax-case stx (->)
>>     [(_ (func arg ...) -> rslt)
>>      #`(length (cons func (list arg ...)))]))
>> (provide my-macro ->)
>>
>> i.e. my macro takes the function name, bundles in up in a structure
>> (here I just used "cons") and then maybe passes it off to something
>> else for processing (here I just used "length" for illustration).
>>
>> Now, doing something like this in the BSL file:
>>    (my-macro (reward 3) -> "bronze")
>>
>> produces:
>>   reward: this is a procedure, so it must be applied to arguments
>> (which requires using a parenthesis before the name)
>>
>>
>>
>>
>>
>> On Sat, Sep 4, 2010 at 4:42 PM, Matthias Felleisen 
>> wrote:
>> >
>> > You need to define and export -> . Otherwise students don't have access to
>> the specific -> in your macro.
>> >
>> > BTW, injecting macros into *sl languages demands a lot of error checking
>> because novices are easily confused.
>> >
>> >
>> >
>> >
>> > On Sep 4, 2010, at 4:37 PM, Nadeem Abdul Hamid wrote:
>> >
>> >> Suppose I make a "teachpack" that defines a macro:
>> >>
>> >> #lang racket
>> >> ...
>> >> (define-syntax (my-macro stx)
>> >>  (syntax-case stx (->)
>> >>    [(_ (func arg ...) -> rslt)
>> >>     #`(check-expect (func arg ...) rslt)]))
>> >> (my-macro (+ 4 5) -> 10)
>> >> (test)
>> >> (provide my-macro)
>> >>
>> >> Running this file works fine.
>> >>
>> >> Now, how exactly do I make this macro available to programs written in
>> >> Beginning/Intermediate Student? Opening up a file in BSL level and
>> >> typing:
>> >>  (require "my-macro.rkt")
>> >>  (my-macro (+ 4 5) -> 9)
>> >> gives the error:
>> >>  my-macro: bad syntax
>> >>
>> >> This macro is a simplification of the real thing I'm working on, but
>> >> note that the arguments to this macro include name(s) of functions
>> >> defined in the BSL file. I though of maybe using
>> >> provide-higher-order-primitive, but it doesn't seem to work either.
>> >>
>> >> --- nadeem
>> >> _
>> >>  For list-related administrative tasks:
>> >>  http://lists.racket-lang.org/listinfo/dev
>> >
>> >
>> _
>>   For list-related administrative tasks:
>>   http://lists.racket-lang.org/listinfo/dev
>
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


[racket-dev] Web continuations interaction with BSL

2010-09-04 Thread Nadeem Abdul Hamid
OK, next puzzle:
Here's a simple web servlet that displays two linked pages:

;; serveit.rkt
#lang racket
(require web-server/servlet
 web-server/servlet-env)
; serve-it : string string -> void
(define (serve-it text1 text2)
  (serve/servlet
   (λ(req)
 (send/suspend/dispatch
  (λ(make-url)
(letrec ([page1 (λ(req) `(html (p ,text1)
   (p (a ([href ,(make-url
page2)]) "Page2"]
 [page2 (λ(req) `(html (p ,text2)
   (p (a ([href ,(make-url
page1)]) "Page1"])
  (page1 req)))
(provide serve-it)


This runs fine on its own.

Now, trying to use this from a BSL program,
   (require "serveit.rkt")
   (serve-it "This is the first page" "This is the second page")

will render the first page fine, but the link doesn't work. It seems
like the continuations are being generated, but are then not
accessible somehow?
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

[racket-dev] define-struct exports something to BSL

2010-09-21 Thread Nadeem Abdul Hamid
Consider a beginner file with:
   (define-struct boa (name length))

Student writes a template/function with parameter named "a-boa", but
misspells one occurrence, writing "boa" instead of "a-boa".

(define (feed a-boa)
  (make-boa (boa-name a-boa)
(boa-length boa)))

Their tests then fail at runtime with:
   boa-length: expects argument of type ; given (make-signature ...)

Why is "boa" as a type visible at all in the student languages? The
make-signature thing is really confusing, because they recognize it as
something like a constructor but they don't know what structure it
corresponds to.

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


Re: [racket-dev] Simple loop checking in beginner?

2010-11-10 Thread Nadeem Abdul Hamid
HtDP in Coq? Hadn't thought of of that before...

On Wed, Nov 10, 2010 at 1:26 PM, Matthias Felleisen
 wrote:
>
> A factor of 2.+.
>
> (We could provide a type system, take away recursion, and replace it with a 
> structural induction form. It would be impossible to write infinite loops.)
>
>
> On Nov 10, 2010, at 12:41 PM, John Clements wrote:
>
>>
>> On Nov 10, 2010, at 6:50 AM, Matthias Felleisen wrote:
>>
>>>
>>> Your reasoning is correct. What's the performance hit?
>>
>> In order to try it, I used the legendary 12.4.2, and... uh, it seg faulted.
>>
>> Okay, I submitted a bug report on that. Moving right along:
>>
>> Testing in the simplest way, here's what I got for permute of size 9:
>>
>>
>> Debugging enabled, no loop protection:
>> cpu time: 2520 real time: 2539 gc time: 1554
>> cpu time: 1504 real time: 1523 gc time: 542
>> cpu time: 1515 real time: 1534 gc time: 552
>>
>> Debugging enabled, with loop protection:
>> cpu time: 4496 real time: 4532 gc time: 1940
>> cpu time: 3653 real time: 3694 gc time: 1079
>> cpu time: 3692 real time: 3730 gc time: 1112
>>
>> Debugging disabled, no loop protection:
>> cpu time: 2181 real time: 2200 gc time: 1651
>> cpu time: 1132 real time: 1152 gc time: 597
>> cpu time: 1143 real time: 1163 gc time: 603
>>
>> Debugging disabled, with loop protection:
>> cpu time: 3458 real time: 3494 gc time: 2007
>> cpu time: 2434 real time: 2471 gc time: 972
>> cpu time: 2424 real time: 2461 gc time: 1001
>>
>> ... so it's quite a bit slower. Note that a whole bunch of this slowdown in 
>> the "debugging enabled" category is presumably due to the errortrace 
>> annotation of the macro expansion.  I'm guessing that folding this into the 
>> errortrace expansion would reduce its overhead quite a bit.
>>
>> John
>>
>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev
>
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


[racket-dev] Something wrong with check-within

2010-11-11 Thread Nadeem Abdul Hamid
The check-within in the follow program (in BSL/ISL) seems to hang.
This is sort of the simplest example I can reproduce, but my students
have been running into this with some more complicated test cases. I
thought it might have to do with the inexact numbers, but even if you
change the #i0.501 to 0.501, it still hangs. I'm seeing this problem
in version 5.0.2, but I believe my students are running 5.0.1...


(define-struct anim (ctrl-pts curve-pts t running?))

(define SAMPLE-WORLD-NEXT (make-anim (list (make-posn 20 190) (make-posn 10 10)
  (make-posn 100 10) (make-posn 125 190)
  (make-posn 150 30))
(list (make-posn 20 190))
0.501 true))

(check-within SAMPLE-WORLD-NEXT
  (make-anim (list (make-posn 20 190) (make-posn 10 10)
  (make-posn 100 10) (make-posn 125 190)
  (make-posn 150 30))
(list (make-posn 20 190))
#i0.501 true)
  0.001)
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] overwrite

2011-02-26 Thread Nadeem Abdul Hamid
I get this a lot, using just the binary installer version downloaded
from racket-lang.org. And it happens even when I'm not using
check-syntax, though it might happen more frequently when I do use
check-syntax; hard to tell.



On Sat, Feb 26, 2011 at 12:05 PM, Matthias Felleisen
 wrote:
>
> Well it just occurred for a file under Git but WITHOUT check syntax.
>
>
>
> On Feb 26, 2011, at 11:48 AM, Matthias Felleisen wrote:
>
>>
>> I confirm the check syntax observation.
>>
>> On Feb 26, 2011, at 11:39 AM, Kathy Gray wrote:
>>
>>> I also see this quite frequently (for files not under Git control). I was 
>>> thinking at one point it might be related to when I run check syntax, but I 
>>> haven't confirmed a repeatable pattern.
>>>
>>> -Kathy
>>>
>>>
>>>
>>>
>>> On 26 Feb 2011, at 4:36:37, Matthias Felleisen wrote:
>>>
>>>>
>>>> The files I have been editing this morning are not under Git control.
>>>> (And yes, I have on one occasion checked the file via Emacs and didn't
>>>> see any difference.)
>>>>
>>>>
>>>> On Feb 26, 2011, at 11:35 AM, Jay McCarthy wrote:
>>>>
>>>>> It's from git touching the files and giving them a new timestamp. It
>>>>> probably didn't really change.
>>>>>
>>>>> Jay
>>>>>
>>>>> 2011/2/26 Matthias Felleisen :
>>>>>>
>>>>>> When I use drracket, I frequently get a warning that my file has been 
>>>>>> modified on disk and the question of whether I want to save the file or 
>>>>>> revert. Is anyone else suffering from this problem?
>>>>>> _
>>>>>> For list-related administrative tasks:
>>>>>> http://lists.racket-lang.org/listinfo/dev
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> 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/dev
>>>
>>
>>
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/dev
>
>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev
>



-- 
Nadeem Abdul Hamid
Associate Professor, Computer Science
Berry College
PO Box 5014
2277 Martha Berry Hwy NW
Mount Berry, GA 30149-5014
(706) 368-5632
http://cs.berry.edu/~nhamid/

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


Re: [racket-dev] New error messages for *SL

2011-07-11 Thread Nadeem Abdul Hamid
Yes, they're useful for 'teachpacks' like the Kiva teachpack...
(https://github.com/nadeemabdulhamid/Kiva-Teachpack)

On Mon, Jul 11, 2011 at 7:28 PM, Shriram Krishnamurthi  
wrote:
> Whoa, whoa there.  They're there for a reason.  I can't remember why,
> but I am pretty certain I have actually used such a function.  Please
> don't go around chopping and changing the language a few days before
> the deadline.
>
> On Mon, Jul 11, 2011 at 7:21 PM, Guillaume Marceau  wrote:
>> On Mon, Jul 11, 2011 at 6:32 PM, Matthias Felleisen
>>  wrote:
>>> I'd much prefer eliminating such function calls.
>>
>> Do you want them out in this release?

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


Re: [racket-dev] planet bug reporting interface

2011-09-06 Thread Nadeem Abdul Hamid
By the way, something happened recently (in the past week or two) to
the tickets on planet. I had opened two tickets in early August to
remind myself of things to fix, but a few days ago when I looked,
there were no open tickets listed anymore for the package
(http://planet.racket-lang.org/display.ss?package=racketui.plt&owner=nah22).
I still have the confirmation emails (one is below), and the trac
ticket URLs now go to some completely unrelated ticket and I can't
seem to find mine by searching the trac site.

--- nadeem

#343: removing entry from empty list of saved entries causes error
+---
Reporter:  nadeem@…|Owner:  nah22
Type:  defect  |   Status:  new
Priority:  minor   |Milestone:
   Component:  nah22/racketui.plt  | Keywords:
Planetversion:  (1 5)   |   Pltversion:
+---
 removing entry from empty list of saved entries causes error

--
Ticket URL: 
PLaneT Issue Tracking System 
A Trac-based issue-tracking system for PLaneT, the package repository for Racket

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


Re: [racket-dev] planet bug reporting interface

2011-09-06 Thread Nadeem Abdul Hamid
OK, no problem.
Thanks,
--- nadeem


On Tue, Sep 6, 2011 at 10:30 AM, Robby Findler
 wrote:
> I'm not sure what happened here, but it could have been that I
> accidentally deleted them because of all of the spam tickets that we
> get (ie I messed up and thought they were spam or I typed the wrong
> numbers). I'm very sorry if that was the case. I do try to be careful
> (and nearly all of the spam goes to a specific package (not yours) so
> it is usually a big red flag when I'm deleting a ticket that didn't go
> to that package).
>
> Anyways, if that did happen, I'm very sorry. Please do re-file them.
>
> Robby
>
> On Tue, Sep 6, 2011 at 9:23 AM, Nadeem Abdul Hamid  wrote:
>> By the way, something happened recently (in the past week or two) to
>> the tickets on planet. I had opened two tickets in early August to
>> remind myself of things to fix, but a few days ago when I looked,
>> there were no open tickets listed anymore for the package
>> (http://planet.racket-lang.org/display.ss?package=racketui.plt&owner=nah22).
>> I still have the confirmation emails (one is below), and the trac
>> ticket URLs now go to some completely unrelated ticket and I can't
>> seem to find mine by searching the trac site.
>>
>> --- nadeem
>>
>> #343: removing entry from empty list of saved entries causes error
>> +---
>>    Reporter:  nadeem@…            |        Owner:  nah22
>>        Type:  defect              |       Status:  new
>>    Priority:  minor               |    Milestone:
>>   Component:  nah22/racketui.plt  |     Keywords:
>> Planetversion:  (1 5)               |   Pltversion:
>> +---
>>  removing entry from empty list of saved entries causes error
>>
>> --
>> Ticket URL: <http://planet.racket-lang.org/trac/ticket/343>
>> PLaneT Issue Tracking System <http://planet.racket-lang.org/>
>> A Trac-based issue-tracking system for PLaneT, the package repository for 
>> Racket
>>
>> _
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/dev
>>
>

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


Re: [racket-dev] See, that's what I'm talking about

2011-09-09 Thread Nadeem Abdul Hamid
If you will kindly fax your account information on a company letterhead I
will contact my lawyer to initiate transfer of the requisite funds
forthwithly.


On Fri, Sep 9, 2011 at 5:56 PM, Robby Findler
wrote:

> Now when do we get our check for $179 (or whatever it was). Can I just send
> my address to the internets?
>
> Robby
>
>
> On Fri, Sep 9, 2011 at 4:55 PM, Robby Findler  > wrote:
>
>> Yes, thanks!
>>
>> Robby
>>
>>
>> On Fri, Sep 9, 2011 at 4:54 PM, Jay Kominek  wrote:
>>
>>> You're welcome?
>>>
>>> On Fri, Sep 9, 2011 at 2:49 PM, John Clements >> > wrote:
>>>
 Thanks, Jay! Uh... whoever you are?

 John

 Begin forwarded message:

 *From: *"Facebook" 
 *Date: *September 9, 2011 1:33:15 PM PDT
 *To: *John Clements 
 *Subject: **Jay Kominek likes PLT Racket.*
 *Reply-To: *Facebook 

  
 facebook
   
 
  Jay
 Kominek likes PLT Racket.  Update PLT 
 Racket
   See
 All 
 Notifications
  The message was sent to
 aoeufaceb...@brinckerhoff.org. If you don't want to receive these
 emails from Facebook in the future or have your email address used for
 friend suggestions, you can 
 unsubscribe.
 Facebook, Inc. P.O. Box 10005, Palo Alto, CA 94303 



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

>>>
>>>
>>>
>>> --
>>> Jay Kominek
>>>
>>> _
>>>  For list-related administrative tasks:
>>>  http://lists.racket-lang.org/listinfo/dev
>>>
>>
>>
>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev
>
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Re: [racket-dev] plea for short planet syntax in student languages?

2011-10-05 Thread Nadeem Abdul Hamid
Yes, please!
--- nadeem

On Wed, Oct 5, 2011 at 12:20 PM, John Clements
 wrote:
> I'm using the rsound planet package in beginning student languages, and 
> requiring them to type
>
> (require (planet "main.rkt" ("clements" "rsound.plt 2 6")))
>
> at the top of every file is a bit painful.
>
> Would it be difficult to support the shorter
>
> (require (planet clements/rsound))
>
> syntax in the student languages?
>
> John
>
>
> _
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev
>

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


Re: [racket-dev] plea for short planet syntax in student languages?

2011-11-13 Thread Nadeem Abdul Hamid
Thank you very much for this!

The documentation for *SL needs updating to reflect support for the
short planet syntax, e.g.
  
http://docs.racket-lang.org/htdp-langs/beginner.html?q=require#(form._((lib._lang/htdp-beginner..rkt)._require))

--- nadeem

On Fri, Oct 7, 2011 at 12:50 PM, Robby Findler
 wrote:
> I've just now pushed a change for this.
>
> Robby
>
> On Wed, Oct 5, 2011 at 11:20 AM, John Clements
>  wrote:
>> I'm using the rsound planet package in beginning student languages, and 
>> requiring them to type
>>
>> (require (planet "main.rkt" ("clements" "rsound.plt 2 6")))
>>
>> at the top of every file is a bit painful.
>>
>> Would it be difficult to support the shorter
>>
>> (require (planet clements/rsound))
>>
>> syntax in the student languages?
>>
>> John
>>
>>
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


[racket-dev] Nightly build installers not updating

2011-11-21 Thread Nadeem Abdul Hamid
The nightly build installers page
(http://pre.plt-scheme.org/installers/ ) is not getting updated with
the latest version for several days now.
--- nadeem
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


[racket-dev] provide specs in eopl in repository use (all-defined-out) instead of (all-defined)

2012-04-02 Thread Nadeem Abdul Hamid
How come when building Racket from the latest source of the repository
(at least as of 3 days ago), #lang eopl doesn't recognize
(all-defined) as a valid provide spec and wants (all-defined-out)
instead?
--- nadeem
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] provide specs in eopl in repository use (all-defined-out) instead of (all-defined)

2012-04-02 Thread Nadeem Abdul Hamid
OK, thanks. Just wanted to make sure something wasn't broken. It's
only a minor inconvenience - my students are using the version from
the download page, while I usually use one built from source, but I've
just been using the regular 5.2.1 version to run their programs. In
any event, perhaps the documentation needs to be updated: the entry:
  
http://pre.racket-lang.org/docs/html/eopl/index.html#(form._((lib._eopl/eopl..rkt)._provide))
points to the mzscheme version of provide.

--- nadeem

On Mon, Apr 2, 2012 at 8:22 PM, Robby Findler
 wrote:
> Because it was changed to be based on "#lang racket" instead of the
> (old) "#lang mzscheme" not too long ago. I think there was a post here
> (or on the users's list) about this, but I'm not sure that this
> particular point was mentioned there, so I can see how you'd be
> surprised.
>
> Is this causing you trouble with classes or similar? Would a "#lang
> eopl/mzscheme" or something like that be useful for backwards
> compatibility? (You'd still need to use that #lang line, tho, since
> the regular eopl language is now changed for good.)
>
> Robby
>
> On Mon, Apr 2, 2012 at 7:09 PM, Nadeem Abdul Hamid  wrote:
>> How come when building Racket from the latest source of the repository
>> (at least as of 3 days ago), #lang eopl doesn't recognize
>> (all-defined) as a valid provide spec and wants (all-defined-out)
>> instead?
>> --- nadeem
>> _
>>  Racket Developers list:
>>  http://lists.racket-lang.org/dev

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] Survey for DrRacket users related to automatic parentheses behavior

2012-11-22 Thread Nadeem Abdul Hamid
Hello all,

I've been discussing with Robby a possible improvement of DrRacket's
"automatic parentheses" behavior and would like to get a sense of others'
general opinion about this. What follows is a description of my proposal
and then some concrete questions.

;;
The idea is to have DrRacket automatically skip over automatically-inserted
closing parens if the user types one while the cursor is right in front of
one. (The Eclipse Java IDE does this with various types of braces and
parens, and in the past I've found this very nice and have observed others
(my students) interact well with such a feature.)

A concrete example: suppose you are in the process of typing the expression
"(+ 4 (- 1 2) 3)". After you type the first opening parentheses and the
characters following it up to the "2", the expression in the editor looks
like:
  (+ 4 (- 1 2|))
where the | represents the cursor's position. Note the two
automatically-inserted closing parens that are after the cursor right now. With
the current implementation, you have to then use the right arrow key to
make the cursor skip past the first auto-inserted ")" and then you can type
"3". However, that really disrupts the typing process because even if you
don't type a ) as a habit and then realize you have to delete the extra
one, you still have to lift and move your finger to the arrow keys area of
the keyboard or type some other key combination to skip the cursor forward.

My proposal would be to have it so that if you type ")" in the editor state
above, it becomes:
  (+ 4 (- 1 2)|)
and now you continue typing a space and the 3. Of course, the same thing
should apply for other types of parens - ( [ { etc.

I don't know about others, but I actually get annoyed with the curent
automatic parens feature to the point of disabling it. That is, I like the
auto-parens feature not because it relieves me from having to type closing
parentheses - I don't mind that, and I actually tend to do that
automatically as I'm typing expressions; but the benefit is that it always
keeps parens balanced while I'm still in the middle of typing an
expression. However, with the current behavior, it tends to make me type
extra closing parentheses and have to go back and delete parens to balance
things up again.

;;
So, the questions:

1. Do you use the automatic parentheses feature of DrRacket?

2a. If yes, does the proposal above resonate well with you?
2b. And, do you think this "smart skipping" of auto-inserted closing
parentheses should become the intrinsic behavior of the automatic
parentheses mode, or should it be a separate preference? (i.e. have two
preference options - the current automatic parentheses one and then a
subordinate option that enables/disables this skipping over of
auto-inserted closing parentheses as the user types them)

3. If your answer to #1 is "No", why not? (Is it because you find its
current behavior awkward in some way?)

Thanks,

nadeem
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Survey for DrRacket users related to automatic parentheses behavior

2012-11-24 Thread Nadeem Abdul Hamid
On Sat, Nov 24, 2012 at 4:03 AM, Laurent  wrote:

> If you can, I think it would be a good idea to remove the paren pair if
> the user deletes the opening paren he just typed by mistake. Undo should do
> the same (which apparently it does not currently; missing
> 'begin/end-edit-sequence' ?).


Yeah, the undo behavior I've fixed. The first scenario you mention might be
tricky - how do you distinguish between typing an open paren and then
immediately deleting it vs. typing an open paren, making a bunch of other
edits, and then coming back and deleting the open paren?
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Survey for DrRacket users related to automatic parentheses behavior

2012-11-24 Thread Nadeem Abdul Hamid
On Sat, Nov 24, 2012 at 12:07 PM, Nick Shelley wrote:

> For what it's worth, Xcode differentiates these cases by inserting a
> temporary closing paren that is gray instead of black. You can make it
> permanent by arrowing over it, typing it yourself, tabbing over it, or just
> moving the cursor outside the matching parens. When it becomes permanent it
> is black like the other text and you have to delete it individually, but
> while it is still gray it will be deleted automatically if you delete the
> opening paren.
>
> I sort of like this behavior, and the visual difference gets rid of any
> potential confusion.
>

Yes, I believe Eclipse does something like this too, maybe not with such a
visual sort of indication. I agree that it's very cool functionality but it
requires really thorough tracking of some hidden state as Robby says
(history of the users' key and/or mouse interaction) and I don't think I'm
going to go for this right now.



> On Saturday, November 24, 2012, Robby Findler wrote:
>
>> On Sat, Nov 24, 2012 at 8:53 AM, Laurent 
>> wrote:
>> >
>> >
>> >
>> > On Sat, Nov 24, 2012 at 3:11 PM, Nadeem Abdul Hamid 
>> wrote:
>> >>
>> >> On Sat, Nov 24, 2012 at 4:03 AM, Laurent 
>> wrote:
>> >>>
>> >>> If you can, I think it would be a good idea to remove the paren pair
>> if
>> >>> the user deletes the opening paren he just typed by mistake. Undo
>> should do
>> >>> the same (which apparently it does not currently; missing
>> >>> 'begin/end-edit-sequence' ?).
>> >>
>> >>
>> >> Yeah, the undo behavior I've fixed. The first scenario you mention
>> might
>> >> be tricky - how do you distinguish between typing an open paren and
>> then
>> >> immediately deleting it vs. typing an open paren, making a bunch of
>> other
>> >> edits, and then coming back and deleting the open paren?
>> >
>> >
>> > I think it would already be good enough to only consider the case
>>  where the
>> > user types the paren and wants to remove them immediately (e.g., he
>> placed
>> > them in the wrong place, or wanted square brackets instead, or just
>> changed
>> > his mind).
>> > In the case of meanwhile edits, I don't think the user would bother
>> deleting
>> > the closing paren himself.
>>
>> I think that hidden state like this can lead to confusing behavior.
>> Probably you want to have deleting a paren do the same thing,
>> regardless of what the character most recently typed was.
>>
>> Robby
>> _
>>   Racket Developers list:
>>   http://lists.racket-lang.org/dev
>>
>
> _
>   Racket Developers list:
>   http://lists.racket-lang.org/dev
>
>
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] [racket] Survey for DrRacket users related to automatic parentheses behavior

2012-11-24 Thread Nadeem Abdul Hamid
On Sat, Nov 24, 2012 at 12:14 PM, Grant Rettke  wrote:

> On Sat, Nov 24, 2012 at 11:07 AM, Nick Shelley wrote:
>
>> I sort of like this behavior, and the visual difference gets rid of any
>> potential confusion.
>>
>
> Just an idea... you might duplicate Paredit's functionality:
>
> http://emacswiki.org/emacs/ParEdit
>
> It is way past beta and has probably gone through all of the pain of
> debating over points like this since a lot of people use it and have shared
> their feedback, too.
>

I haven't really used ParEdit at all - just tried it out a little bit in
the last couple of days - but it seems to be too much of a straitjacket to
me (at least in its default, out-of-the-box settings)? It overrides/ignores
too much of what I try to do in terms of typing (closing) parens, and it
seems possible to get it in a state where parentheses don't match up, like
 ( ... ], and it's not immediately evident how to correct it conveniently
because ParEdit neither lets me delete or change the ].



> Additionally, it would be a big selling point for DrRacket to be able to
> offer "Paredit equivelant functionality" in addition to the other great
> stuff it already offers.
>

Yes, or maybe, "better-than-ParEdit functionality", :-P 



>
> 
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
>
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] DrRacket automatic parentheses mode update

2012-12-03 Thread Nadeem Abdul Hamid
Some improvements to DrRacket's "automatic parentheses" mode are now
available in the nightly build version and git repository. If you have
previous tried auto-parens and abandoned it, or if you have never tried it,
please do try it now!

In auto-parens mode, typing a closing parenthesis will skip over an
existing one if the cursor is right in front of it. You can also type M+)
 (meta key + close parens), whether in auto-parens mode or not, to skip
right past the closing parentheses of the enclosing expression, or, if the
expression is not well-balanced, just forward to the next closing
parentheses. This behavior should also work as expected with other closing
parenthesis-like symbols, double quotes, and | ... | pairs. There are also
some tweaks to the auto-parens mode so that block comments #| ... |# are
inserted correctly. Also auto-parens mode has no effect when inside a
string literal or comment (you can always use M+( to force a parens pair if
you really want one) or when typing a character literal.

While 'undo' works properly now for just-inserted () pairs in auto-parens
mode, I did not mess at all with delete key behavior. I've left the
Paredit-like functionality for another time/person! :-)

Have fun,

nadeem
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Parens/string quotes automatic behavior

2013-05-23 Thread Nadeem Abdul Hamid
Hello Racket devs,

I'm working on tweaking how typing a double quote is handled in strings
when DrRacket's auto parens mode is on, per recent post on the users list.
If any of you use the mode and can offer feedback on the following, it'd be
appreciated: In addition to handling Laurent's initial feature request (see
message at bottom), I'm setting it up so that if the following string is in
the DrRacket window:
  "abcdefghi"
and you select the _def_ and press " (double quote), then it places
double-quotes around the "def" with additional quotes to ensure that the
other two portions of the string are still validly delimited, i.e.
  "abc""def""ghi"

One question is where to put the cursor following this operation? Should it
be right inside the beginning of the lifted string, or in front of its
double quotes, i.e.:
  "abc""|def""ghi"
or "abc"|"def""ghi"
?

Another question is whether to space off the "def" string that is created
from the surrounding ones, i.e.
  "abc" "def" "ghi"
instead of "abc""def""ghi"?

(As a side note: the Emacs paredit mode handles the situation of a double
quotes typed inside a string by inserting an escaped \". It uses a separate
key combination to handle splitting both strings and parenthesized
expressions into two pieces.)

Thanks,

--- nadeem

On May 22, 2013, at 7:07 AM, Laurent wrote:

> Hi,
>
> The new behavior of automatic parenthesis matching is really nice, but
there is one problem with string quotes.
> For example, if the cursor is in the middle of a string and I type the
string-quote symbol ", it places a quote which cuts the current string and
leaves the right part in a bad syntax.
>
> Most of the time, when I type a quote inside a string, it's because I
want to split the string in two parts.
> To do that, I have to type string-quote, string-quote, delete (to remove
the extra string-quote added by the paren-match behavior), and left to go
back between the two strings, which is mildly annoying.
>
> Would it be possible (unless problematic) to have the default paren-match
behavior for strings that splits the string instead of inserting a single
string-quote, possibly unless the left symbol is a backslash?
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] Fwd: Create executable problem

2014-03-28 Thread Nadeem Abdul Hamid
I have a student trying to create a standalone executable of a
2htdp/universe-based game written in ISL+lambda, but the resulting
executable crashes. On my Mac, using Racket 6.0, it results in the
following error when run from the generated disk image. Any ideas?

Thanks,
nadeem


$ ./Ant\ Attack.app/Contents/MacOS/Ant\ Attack
image%: cannot get-shape without gui libraries
  context...:
   /Applications/Racket
v6.0/share/pkgs/htdp-lib/2htdp/private/image-more.rkt:261:0: overlay/δ
   place-image/align
   /Applications/Racket v6.0/collects/racket/private/list.rkt:245:7: loop
   /Applications/Racket v6.0/collects/racket/private/list.rkt:245:7: loop
   /Applications/Racket v6.0/collects/racket/private/list.rkt:242:4: foldr
   render-world
   /Applications/Racket
v6.0/share/pkgs/htdp-lib/2htdp/private/world.rkt:360:6: ppdraw method
in ...dp/private/world.rkt:57:4
   /Applications/Racket
v6.0/share/pkgs/htdp-lib/2htdp/private/world.rkt:283:18: d
   /Applications/Racket
v6.0/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:451:6
   /Applications/Racket
v6.0/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:502:32
   /Applications/Racket
v6.0/collects/racket/private/more-scheme.rkt:147:2:
call-with-break-parameterization
   /Applications/Racket
v6.0/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:397:18: loop

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Create executable problem

2014-04-04 Thread Nadeem Abdul Hamid
Thanks for your work, Robby.
--- nadeem

On Friday, April 4, 2014, Robby Findler  wrote:

> [ Nadeem sent me the file offline. ]
>
> I've pushed a fix for the bug.
>
> It is possible to work around it: the issue comes up when you copy and
> paste the result of the 2htdp/image images back into the definitions
> window. In this case, the image I noticed that does this is a flipped cat.
> So you could delete that from the file and then put (presumably at the
> top-level) a call to flip passing in the literal cat and then just use that
> instead.
>
> That should work with the released version.
>
> Robby
>
>
> On Fri, Mar 28, 2014 at 5:06 PM, Robby Findler <
> ro...@eecs.northwestern.edu
> > wrote:
>
>> It looks like something has gone wrong in the code that figures out what
>> kind of executable to create (or maybe the dependency tracking possibly).
>>
>> Do you have the game to share? That would help a lot with the
>> investigation.
>>
>> Robby
>>
>>
>>
>> On Fri, Mar 28, 2014 at 4:08 PM, Nadeem Abdul Hamid 
>> 
>> > wrote:
>>
>>> I have a student trying to create a standalone executable of a
>>> 2htdp/universe-based game written in ISL+lambda, but the resulting
>>> executable crashes. On my Mac, using Racket 6.0, it results in the
>>> following error when run from the generated disk image. Any ideas?
>>>
>>> Thanks,
>>> nadeem
>>>
>>>
>>> $ ./Ant\ Attack.app/Contents/MacOS/Ant\ Attack
>>> image%: cannot get-shape without gui libraries
>>>   context...:
>>>/Applications/Racket
>>> v6.0/share/pkgs/htdp-lib/2htdp/private/image-more.rkt:261:0: overlay/δ
>>>place-image/align
>>>/Applications/Racket v6.0/collects/racket/private/list.rkt:245:7: loop
>>>/Applications/Racket v6.0/collects/racket/private/list.rkt:245:7: loop
>>>/Applications/Racket v6.0/collects/racket/private/list.rkt:242:4:
>>> foldr
>>>render-world
>>>/Applications/Racket
>>> v6.0/share/pkgs/htdp-lib/2htdp/private/world.rkt:360:6: ppdraw method
>>> in ...dp/private/world.rkt:57:4
>>>/Applications/Racket
>>> v6.0/share/pkgs/htdp-lib/2htdp/private/world.rkt:283:18: d
>>>/Applications/Racket
>>> v6.0/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:451:6
>>>/Applications/Racket
>>> v6.0/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:502:32
>>>/Applications/Racket
>>> v6.0/collects/racket/private/more-scheme.rkt:147:2:
>>> call-with-break-parameterization
>>>/Applications/Racket
>>> v6.0/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:397:18: loop
>>>
>>> _
>>>   Racket Developers list:
>>>   http://lists.racket-lang.org/dev
>>>
>>
>>
>

-- 

--
Nadeem Abdul Hamid
Associate Professor, Computer Science
Berry College, Mount Berry, GA 30149
http://cs.berry.edu/~nhamid/
_
  Racket Developers list:
  http://lists.racket-lang.org/dev