[racket-users] 1-d Haar wavelet transform?

2015-11-29 Thread 'John Clements' via Racket Users
I’m a bit of the way down this rabbit hole—I’ve written code to generate Haar 
basis functions for the slow n^2 decomposition on 1-d arrays—so before I go any 
further, is there already a library that does this in Racket?

Thanks!

John


-- 
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.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


[racket-users] Re: Paths in Racket

2015-11-29 Thread Jay McCarthy
This section of the tutorial explains how to get more static file
paths to be inspected:

http://docs.racket-lang.org/continue/index.html#%28part._.Decorating_.With_.Style_%29

Jay

On Sun, Nov 29, 2015 at 4:31 PM, Лера Гранкина  wrote:
> Hello, Mr.McCarthy!
> I cannot figure out the way Racket finds files referred to in  link or
> even  tag. It doesn't search for them in the directory of the currently
> running file.
> When I run, say, x.rkt in Dr.Racket, defined as `(html (head ...(a
> ((href="index.rkt")) "go))), localhost prints "file not found", although I
> _know_ x.rkt and index.rkt are in the same directory.
> So, how make Racket _see_ this 'index.rkt' file?
>
> Best regards,
> Valerie Grankina



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

   "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
  - D 64:33

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] [racket] Racket 6.3(.0.7) breaks old code

2015-11-29 Thread WarGrey Gyoudmon Ju
It is compiled by myself with no strange options.
Rebuilding the project (without DrRacket) fails due to two strange
behaviors.

The first one is module-path-index-resolve: "self" index has no resolution.
It breaks lots of scripts, I cannot locate where it is exactly occurs.
1. errortrace says  makefile.rkt:364:35: (namespace-mapped-symbols)
 this is my building facility written in untyped racket, the stack
point is parameterized with (variable-reference->namespace
(#%variable-reference)).

2. errortrace says nothing, while `racket` puts
module-path-index-resolve: "self" index has no resolution
  module path index: #
  context...:
   /opt/PLTracket/collects/syntax/private/id-table.rkt:77:2: do-ref

 
/opt/PLTracket/share/pkgs/typed-racket-lib/typed-racket/rep/interning.rkt:22:13:
*Opaque
   (submod .../digitama/posix.rkt typed/ffi #%type-decl): [running body]

 /opt/PLTracket/share/pkgs/typed-racket-lib/typed-racket/env/env-req.rkt:8:4:
for-loop

 /opt/PLTracket/share/pkgs/typed-racket-lib/typed-racket/tc-setup.rkt:82:0:
tc-module/full

 /opt/PLTracket/share/pkgs/typed-racket-lib/typed-racket/typed-racket.rkt:24:4
   standard-module-name-resolver

 /opt/PLTracket/share/pkgs/typed-racket-lib/typed-racket/tc-setup.rkt:82:0:
tc-module/full

 /opt/PLTracket/share/pkgs/typed-racket-lib/typed-racket/typed-racket.rkt:24:4
   standard-module-name-resolver

this is a normal module, only posix.rkt is written by me,
but... `racket posix.rkt` is okay, in which case, ffi bindings are written
in the top level module,   typed/ffi is its submodule, `racket` run the
tests based on the typed one. DrRacket complains
(current-load-relative-directory)
is false.



The second one is compiled/expanded code out of context; cannot find
exports to restore imported renamings for module: ...
It seems that (dynamic-require) does not work with the correct
(current-directory) or (current-load-relative-directory).

Thanks.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] "bad variable linkage" after restarting handin server under load

2015-11-29 Thread Paolo Giarrusso
On Friday, November 27, 2015 at 3:44:20 AM UTC+1, Robby Findler wrote:
> Yes, I think you're right. I originally wrote that because I was
> thinking that this code might be involved in evaluating the user's
> submission, but I am not pretty sure I was wrong about that.

"not pretty sure"?

AFAICS, `auto-reload-value` is used to extract the `checker` binding from the 
various checker.rkt. but the lock will not be held while running `checker`. 
(Luckily we're not using hooks, I haven't studied that code).

> So, yes I
> agree that putting this into the production server may be worth a try
> (depending on how severe the problem you're having is I suppose).
> 
> It may make sense to try it out yourself a little bit between due
> dates or something. I did some testing, but more is better.

Yes, we have a staging server for that, I think these courses were my first 
time :-).

As a side note, having proper unit tests is somewhat hard though, many 
interfaces seem not designed for testability. (Many side effects get in the 
way; fixing this is easyish but tedious).
I'm almost ready to "unit test" checkers, but haven't looked into automatic 
submissions.

> Also, while I was reading the code again, however, I noticed that my
> diff didn't have enough syncronization. Here's an improved one.

>  (reload-module modspec path)
>  (set! proc (dynamic-require modspec procname))
>  (reload)
> -(lambda xs (reload) (apply proc xs
> +(lambda xs (protect (reload)) (apply proc xs



> diff --git a/info.rkt b/info.rkt
> index 00a42f9..a5686d5 100644
> --- a/info.rkt
> +++ b/info.rkt
> @@ -11,6 +11,7 @@
> "net-lib"
> "pconvert-lib"
> "sandbox-lib"
> +   "rackunit-lib"
> "web-server-lib"))
>  (define build-deps '("gui-doc"
>   "racket-doc"
> 
> 
> On Thu, Nov 26, 2015 at 6:23 PM, Paolo Giarrusso wrote:
> > On 25 November 2015 at 14:54, Robby Findler wrote:
> >> I'm still not completely
> >> sure, but since you seem to be able to provoke the error, that
> >> emboldens me to suggest you apply the diff below and see if it goes
> >> away.
> >
> > I'm doing this. Annoyingly, I can't force the crash at will yet, and
> > an automated handin-server stress-tester is not in our plans yet :-|.
> >
> >> That diff is probably not what we'd want in the end, since it is too
> >> much locking (we would want a namespace-specific lock not a global
> >> one) but if the error does go away, that means that this is probably
> >> the right place to put the lock in.
> >
> > Makes sense.
> >
> > But for my production environment, I guess that this patch won't
> > overly restrict concurrency: I guess namespaces correspond to checkers
> > in the handin-server, right? So, since I only ever open one
> > assignment, I should only have one namespace anyway?
> >
> > Cheers,
> > Paolo

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] "bad variable linkage" after restarting handin server under load

2015-11-29 Thread Robby Findler
On Sunday, November 29, 2015, Paolo Giarrusso  wrote:

> On Friday, November 27, 2015 at 3:44:20 AM UTC+1, Robby Findler wrote:
> > Yes, I think you're right. I originally wrote that because I was
> > thinking that this code might be involved in evaluating the user's
> > submission, but I am not pretty sure I was wrong about that.
>
> "not pretty sure"?


Sorry. No "not".



>
> AFAICS, `auto-reload-value` is used to extract the `checker` binding from
> the various checker.rkt. but the lock will not be held while running
> `checker`. (Luckily we're not using hooks, I haven't studied that code).


Yes that's also what I noticed and why I sent a second diff. Or did I miss
another place?

Robby



>
> > So, yes I
> > agree that putting this into the production server may be worth a try
> > (depending on how severe the problem you're having is I suppose).
> >
> > It may make sense to try it out yourself a little bit between due
> > dates or something. I did some testing, but more is better.
>
> Yes, we have a staging server for that, I think these courses were my
> first time :-).
>
> As a side note, having proper unit tests is somewhat hard though, many
> interfaces seem not designed for testability. (Many side effects get in the
> way; fixing this is easyish but tedious).
> I'm almost ready to "unit test" checkers, but haven't looked into
> automatic submissions.
>
> > Also, while I was reading the code again, however, I noticed that my
> > diff didn't have enough syncronization. Here's an improved one.
>
> >  (reload-module modspec path)
> >  (set! proc (dynamic-require modspec procname))
> >  (reload)
> > -(lambda xs (reload) (apply proc xs
> > +(lambda xs (protect (reload)) (apply proc xs
>
>
>
> > diff --git a/info.rkt b/info.rkt
> > index 00a42f9..a5686d5 100644
> > --- a/info.rkt
> > +++ b/info.rkt
> > @@ -11,6 +11,7 @@
> > "net-lib"
> > "pconvert-lib"
> > "sandbox-lib"
> > +   "rackunit-lib"
> > "web-server-lib"))
> >  (define build-deps '("gui-doc"
> >   "racket-doc"
> >
> >
> > On Thu, Nov 26, 2015 at 6:23 PM, Paolo Giarrusso wrote:
> > > On 25 November 2015 at 14:54, Robby Findler wrote:
> > >> I'm still not completely
> > >> sure, but since you seem to be able to provoke the error, that
> > >> emboldens me to suggest you apply the diff below and see if it goes
> > >> away.
> > >
> > > I'm doing this. Annoyingly, I can't force the crash at will yet, and
> > > an automated handin-server stress-tester is not in our plans yet :-|.
> > >
> > >> That diff is probably not what we'd want in the end, since it is too
> > >> much locking (we would want a namespace-specific lock not a global
> > >> one) but if the error does go away, that means that this is probably
> > >> the right place to put the lock in.
> > >
> > > Makes sense.
> > >
> > > But for my production environment, I guess that this patch won't
> > > overly restrict concurrency: I guess namespaces correspond to checkers
> > > in the handin-server, right? So, since I only ever open one
> > > assignment, I should only have one namespace anyway?
> > >
> > > Cheers,
> > > Paolo
>
> --
> 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 .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] [racket] Racket 6.3(.0.7) breaks old code

2015-11-29 Thread Matthew Flatt
My guess is that you're running into an incompatibility created by the
new macro system. Something like lifting code out of an expanded
`module` form and dropping it into a different one? A change related to
submodule expansion? Or something related to the top-level namespace?
It might be an unavoidable incompatibility, or it might be a bug.

I'm unclear on what I'd need to do to replicate the problem, though. Is
there some code of yours that's available and that I could try to run?

At Mon, 30 Nov 2015 06:53:28 +0800, WarGrey Gyoudmon Ju wrote:
> It is compiled by myself with no strange options.
> Rebuilding the project (without DrRacket) fails due to two strange
> behaviors.
> 
> The first one is module-path-index-resolve: "self" index has no resolution.
> It breaks lots of scripts, I cannot locate where it is exactly occurs.
> 1. errortrace says  makefile.rkt:364:35: (namespace-mapped-symbols)
>  this is my building facility written in untyped racket, the stack
> point is parameterized with (variable-reference->namespace
> (#%variable-reference)).
> 
> 2. errortrace says nothing, while `racket` puts
> module-path-index-resolve: "self" index has no resolution
>   module path index: #
>   context...:
>/opt/PLTracket/collects/syntax/private/id-table.rkt:77:2: do-ref
> 
>  
> /opt/PLTracket/share/pkgs/typed-racket-lib/typed-racket/rep/interning.rkt:22:13
> :
> *Opaque
>(submod .../digitama/posix.rkt typed/ffi #%type-decl): [running body]
> 
>  /opt/PLTracket/share/pkgs/typed-racket-lib/typed-racket/env/env-req.rkt:8:4:
> for-loop
> 
>  /opt/PLTracket/share/pkgs/typed-racket-lib/typed-racket/tc-setup.rkt:82:0:
> tc-module/full
> 
>  /opt/PLTracket/share/pkgs/typed-racket-lib/typed-racket/typed-racket.rkt:24:4
>standard-module-name-resolver
> 
>  /opt/PLTracket/share/pkgs/typed-racket-lib/typed-racket/tc-setup.rkt:82:0:
> tc-module/full
> 
>  /opt/PLTracket/share/pkgs/typed-racket-lib/typed-racket/typed-racket.rkt:24:4
>standard-module-name-resolver
> 
> this is a normal module, only posix.rkt is written by me,
> but... `racket posix.rkt` is okay, in which case, ffi bindings are written
> in the top level module,   typed/ffi is its submodule, `racket` run the
> tests based on the typed one. DrRacket complains
> (current-load-relative-directory)
> is false.
> 
> 
> 
> The second one is compiled/expanded code out of context; cannot find
> exports to restore imported renamings for module: ...
> It seems that (dynamic-require) does not work with the correct
> (current-directory) or (current-load-relative-directory).
> 
> Thanks.
> 
> -- 
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Contracts vs Signatures for HtDP?

2015-11-29 Thread Matthias Felleisen

0. No you’re not missing something. The issue has come up in a recent internal 
discussion. 
1. The intention is that docs are primarily for Racket programmers who wish to 
use teachpacks in ordinary Racket programs though within reach for beginners 
(as in, “ignore some of the things you don’t understand and focus on the 
example.”) 
2. In my courses, I suggest to read the words in the docs for functions, to 
read the examples, and ignore other things. 

We will have to discuss internally how to have both kinds of documentation. No 
promises. 

— Matthias





> On Nov 28, 2015, at 10:00 PM, Paolo Giarrusso  wrote:
> 
> While pointing students at teachpacks for HtDP/2e, one of our tutors 
> correctly pointed out that they're not documented using HtDP signatures, but 
> using standard Racket contracts. For instance, in big-bang's docs:
> 
>> (to-draw render-expr)
>> render-expr: (-> WorldState scene?)
> 
> http://docs.racket-lang.org/teachpack/2htdpuniverse.html?q=posn#%28form._world._%28%28lib._2htdp%2Funiverse..rkt%29._big-bang%29%29
> 
> Instead, the beginner language seems to use a mixture, alternating between 
> "class" `number` and predicate `boolean?`:
> 
> http://docs.racket-lang.org/htdp-langs/beginner.html
> 
> And in fact, `number` is the style of HtDP/1e, while HtDP/2e uses `Number`.
> 
> The differences aren't huge, but I'd guess that sometimes they're noticeable 
> or problematic for beginners.
> 
> 0. Am I mistaking something?
> 1. Is this intended or are changes planned?
> 2. How do you deal with this in your courses? Do you teach both signature 
> styles? Will this not confuse students?
> 
> Cheers,
> Paolo
> 
> -- 
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] [racket] How to extend image-snip% with a new field

2015-11-29 Thread Guilherme Ferreira
Hello,


I'm trying to implement an image-snip% subclass which has 
a new field (hash table) to store some metadata.

I follow the example described in the documentation, but 
the constructor of my image-snip subclass does not display
the bitmap.

Here is my code.. Thanks in advance.

(define image-data-snip%
  (class image-snip%
(inherit set-snipclass
 get-flags set-flags
 get-admin
 get-extent
 draw)

(init-field [metadata (make-hash)])
(super-new)

(set-snipclass image-data-snip-class)
(send (get-the-snip-class-list) add image-data-snip-class)
(set-flags (cons 'handles-events (get-flags)))

(define/override (copy)
  (new image-data-snip% [metadata metadata]))

(define/override (write f)
  (super write f)
  (send f put (list->bytes (hash->list metadata


;;Operations on the metadata ;;;


(define/public (get-arg-pos arg)
  (hash-ref metadata arg '(0.5 0.5)))

(define/public (set-arg-pos arg pos)
  (hash-set! metadata arg pos))

(define/public (get-args-pos)
  (hash->list metadata

(define image-data-snip-class%
  (class snip-class%
(inherit set-classname)

(super-new)
(set-classname (~s '(lib "main.rkt" "image-data-snip")))

(define/override (read f)
  #;(super read f)
  (define size-b (box 0.0))
  (send f get size-b)
  ;; I do not know how can I restore the hash map here
  (new image-data-snip% [metadata (bytes->list (unbox size-b))]

(define image-data-snip-class (new image-data-snip-class%))

-- 
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.
For more options, visit https://groups.google.com/d/optout.