[racket-users] note about parsing speed of xml vs sxml?

2020-06-26 Thread 'John Clements' via users-redirect
I’m parsing a large-ish apple plist file, (18 megabytes), and I find that the 
built-in xml parsing (read-xml) takes about five times as long as the sxml 
version (11 seconds vs 2.4 seconds on my machine), and that the plist parser is 
way longer, at 18 seconds.

Would anyone object if I added a margin note to this effect to the xml docs?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/299d18fa-3e0d-4cf4-b259-c281eab6dbcc%40mtasv.net.


[racket-users] "Concolic Testing with Higher-Order Inputs"

2020-05-18 Thread 'John Clements' via users-redirect
Am I the first one to post about this? Looks like Robby’s giving a talk for the 
Chalmers online functional programming seminar series!

http://chalmersfp.org/

(and yes, this URL is non-ssl only, sigh)

Date: June 15th, 7am PDT / 10am EDT / 1400 UTC / 16:00 CEST

Title: “Concolic Testing with Higher-Order Inputs”

Abstract:

Concolic testing, dating back to the mid 2000s, has proven to be an effective, 
automatic testing technique. Roughly, a concolic tester monitors the program's 
behavior, collecting information that connects the branches that the program 
takes with the original inputs to the program. It then uses that information 
(with the help of an SMT solver) to try to construct new inputs to force the 
program to take different branches, in an attempt to uncover problems with the 
program. 

Most of the existing work on concolic testing focuses on the situation where 
the inputs to the program being tested are flat values (e.g., numbers) instead 
of higher-order values (e.g., objects or functions). Higher-order inputs, 
however, present challenges for concolic testing because the interplay between 
the input and the program being tested is much more complex. 

In this talk, I'll discuss the way we generalize concolic testing to 
higher-order inputs, explaining why it is challenging and how we answer the 
challenge. The talk will be example driven and I will try to bring across the 
intuition for how we conceptualize the generalization to higher-order inputs 
and the results we have so far.



I admit that I haven’t caught either of the first two talks in this series… 
apparently the Simon Peyton Jones one had some serious technical difficulties. 
Anyhow, those of us on the West Coast are probably getting more and more used 
to waking up early for global meetings, and this one certainly looks like a 
good one.

Can’t wait!

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/da10ff00-c5c6-4027-a2c9-9b1ee0a721cf%40mtasv.net.


[racket-users] graphql library?

2020-03-14 Thread 'John Clements' via users-redirect
Uh oh… another protocol! Has anyone done any work on a GraphQL client library 
in Racket?

https://graphql.org/code/#graphql-clients

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/e9256b27-2979-47ab-a88d-0cfd2d42357a%40mtasv.net.


Re: [racket-users] re-run really fast!

2020-03-11 Thread 'John Clements' via users-redirect
That’s it! I have to look really close to see the spikes on the ball, but there 
they are. Many thanks.

John

> On Mar 5, 2020, at 03:33, Robby Findler  wrote:
> 
> Some time ago (a lot more than a week), DrRacket started using the result of 
> online expansion to run (look for the spiky green ball to know when it will 
> work). It doesn't work in error trace mode tho. 
> 
> Could that be it?
> 
> Robby
> 
> On Thu, Mar 5, 2020 at 12:25 AM 'John Clements' via users-redirect 
>  wrote:
> Okay, I’m probably under a rock and just haven’t read my e-mail in a week, 
> but … I just noticed that re-running a long TR file of 900 lines took ONE 
> second, rather than eleven. It appears to me that either TR or DrRacket or 
> both are now cooperating to not re-compile when no edits have been made. Is 
> that a recent change, or am I just easily pleased?
> 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/0dd2ace8-3633-42d3-8e4d-943bf5f62791%40mtasv.net.
> 
> -- 
> 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/CAL3TdOOwv7DeiySjai13nTYK6GCP-N5V7o_6eqGRdz2ZZxGc4A%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/54997721-f1f8-496a-8db7-50e155f183ce%40mtasv.net.


[racket-users] re-run really fast!

2020-03-04 Thread 'John Clements' via users-redirect
Okay, I’m probably under a rock and just haven’t read my e-mail in a week, but 
… I just noticed that re-running a long TR file of 900 lines took ONE second, 
rather than eleven. It appears to me that either TR or DrRacket or both are now 
cooperating to not re-compile when no edits have been made. Is that a recent 
change, or am I just easily pleased?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/0dd2ace8-3633-42d3-8e4d-943bf5f62791%40mtasv.net.


[racket-users] Re: racket-poppler dumping core & failing contract checks

2020-02-20 Thread 'John Clements' via users-redirect
Forwarding this with permission to the kind folks on racket-users…

I’m having a strange problem with raco test; specifically, performing raco test 
on a file in a collection from the racket-poppler collection generates error 
text very fast… about 3 megabytes per second… with this text (apparently) 
repeated ad infinitum:

> > internal error: attempt to deschedule the current thread in atomic mode
> > exception raised by exception handler: abort-current-continuation: contract 
> > violation
> >   expected: continuation-prompt-tag?
> >   given: [?error-value->string-handler not ready?]; original exception 
> > raised: internal error: attempt to deschedule the current thread in atomic 
> > mode
> >   context...:
> >proc
> >loop
> >call-in-empty-metacontinuation-frame
> >abort-current-continuation
> >loop
> >call-in-empty-metacontinuation-frame
> >l
> >loop
> >dynamic-wind
> >temp52_0
> >.../ffi/unsafe.rkt:2117:27: loop
> >.../private/more-scheme.rkt:265:2: call-with-exception-handler
> >call-in-empty-metacontinuation-frame
> >.../ffi/unsafe.rkt:2104:19: retry-loop
> >call-in-empty-metacontinuation-frame
> >call-with-empty-metacontinuation-frame-for-swap

(a longer prefix appears below)

However, copying the same file to /tmp/ and running raco test on that file 
produces much saner output (included below). 

The bad news: this package uses ffi, so in some sense all bets are off.

The important question: is this difference likely to be the result of a “real" 
internal error in racket, and it would be a good idea to try and track it down, 
or is this a known problem with raco test, or something else entirely?

FWIW, this is stock 7.6, running on macOS 10.15.2.

Any thoughts welcome!

John

> On Feb 20, 2020, at 4:02 PM, Jens Axel Søgaard  wrote:
> 
> > BTW, is it okay with you if I forward this to racket-users? I feel like 
> > people there might be better able to answer some of these questions.
> 
> Of course. 
> 
> I might have forgotten to try the examples when I updated racket-poppler to 
> work with latex-pict.
> 
> And I just notices that the docs of latex-pict is missing on 
> docs.racket-lang.org.
> You hopefully found them in the source, but if not the beginning of 
> 
> https://github.com/soegaard/latex-pict/blob/master/latex-pict/tex.rkt
> 
> contains an explanation.
> 
> /Jens Axel
> 
> 
> 
> Den fre. 21. feb. 2020 kl. 00.56 skrev John Clements 
> :
> Okay, that worked! Good to see.
> 
> On the topic of the output explosion … I’m not sure exactly what’s going on. 
> The problem appears to be related to the “test-pdf-functions.rkt” file, but 
> when I run it directly, I get a different and more sensible error
> 
> hardy:/tmp clements> /Applications/Racket\ v7.6/bin/racket 
> /Users/clements/Library/Racket/7.6/pkgs/racket-poppler/racket-poppler/examples/test-pdf-functions.rkt
> #f
> #f
> pdf-title: contract violation
>   expected: pdf?
>   given: #f
>   in: the 1st argument of
>   (-> pdf? (or/c false? string?))
>   contract from: 
>   /racket-poppler/racket-poppler/main.rkt
>   blaming: 
> /racket-poppler/racket-poppler/examples/test-pdf-functions.rkt
>(assuming the contract is correct)
>   at: /racket-poppler/racket-poppler/main.rkt:42.2
>   context...:
>.../private/blame.rkt:347:0: raise-blame-error
>.../private/arrow-val-first.rkt:486:18
>call-with-values
>call-in-empty-metacontinuation-frame
>body of 
> "/Users/clements/Library/Racket/7.6/pkgs/racket-poppler/racket-poppler/examples/test-pdf-functions.rkt"
>temp35_0
>for-loop
>run-module-instance!
>perform-require!
>namespace-require+
>#%for-each
>call-in-empty-metacontinuation-frame
>[repeats 1 more time]
>call-with-empty-metacontinuation-frame-for-swap
> 
> I’m not sure why calling it with raco test causes the explosion, especially 
> since I don’t see any use of test-specific functions in this file.
> 
> BTW, is it okay with you if I forward this to racket-users? I feel like 
> people there might be better able to answer some of these questions.
> 
> John
> 
> 
> > On Feb 20, 2020, at 3:41 PM, Jens Axel Søgaard  
> > wrote:
> > 
> > 
> > Den fre. 21. feb. 2020 kl. 00.35 skrev John Clements 
> > :
> > Whoa! 
> > 
> > I just tried installing racket-poppler on my 7.6 installation, and tried 
> > running 
> > 
> > raco test -p racket-poppler
> > 
> > and generated a LOT of error text very quickly. I redirected it to a file 
> > and it generated 95 Megabytes quite quickly. After the first few pages, 
> > though, you see a pattern. 
> > 
> > FWIW, this is on macOS 10.15.2.
> > 
> > I see the same as you - but I don't know what that command is running.
> > I don't made any tests for racket-poppler?
> > 
> > I just tried this program in DrRacket 7.6 CS
> > 
> > #lang racket
> > (require racket-poppler latex-pict pict)
> > (pict->bitmap (tex-math "1+x"))
> > 
> > and that worked fine.
> > 
> > By the way - you might need 

[racket-users] racket-poppler dumping core & failing contract checks

2020-02-20 Thread 'John Clements' via users-redirect
I’m interested in converting TeX to picts. It looks like racket-poppler might 
be the way to do that. 

Unfortunately, I’m having trouble running racket-poppler. I ran into several 
problems, but fortunately, all of the problems that I saw were also observed by 
the test suite. Running 

raco test -p racket-poppler

on my machine (macOS 10.15.2, racket built from git source this morning) 
produces both a contract failure and a core dump. (Transcript below.)

One obvious problem is that it looks like the latex->pict function now requires 
a #:preamble keyword, which apparently the tests don’t expect? Also, I’m 
dumping core in the ffi calls. What’s the right way to fix this?

Thanks!

John Clements



ardy:/tmp clements> raco test -p racket-poppler
raco test: "/Users/clements/racket/racket/share/pkgs/racket-poppler/info.rkt"
raco test: 
"/Users/clements/racket/racket/share/pkgs/racket-poppler/racket-poppler/examples/test-pdf-functions.rkt"
#t
#
""
'((title "") (author "") (aubject "") (keywords "") (creator "LaTeX with 
hyperref package") (producer "pdfTeX-1.40.3") (page-count 364))
#
'(612.0 792.0)
'(0.0 0.0 612.0 792.0)
"The Racket Guide\nVersion 5.3.4.11\nMatthew Flatt,\nRobert Bruce Findler,\nand 
PLT\nJune 9, 2013\nThis guide is intended for programmers who are new to Racket 
or new to some part of\nRacket. It assumes programming experience, so if you 
are new to programming, consider\ninstead reading How to Design Programs. If 
you want an especially quick introduction to\nRacket, start with Quick: An 
Introduction to Racket with Pictures.\nChapter 2 provides a brief introduction 
to Racket. From Chapter 3 on, this guide dives into\ndetails—covering much of 
the Racket toolbox, but leaving precise details to The Racket\nReference and 
other reference manuals."
"The Racket Guide\nVersion 5.3.4.11\nMatthew Flatt,\nRobert Bruce Findler,\nand 
PLT\nJune 9, 2013\nThis guide is intended for programmers who are new to Racket 
or new to some part of\nRacket. It assumes programming experience, so if you 
are new to programming, consider\ninstead reading How to Design Programs. If 
you want an especially quick introduction to\nRacket, start with Quick: An 
Introduction to Racket with Pictures.\nChapter 2 provides a brief introduction 
to Racket. From Chapter 3 on, this guide dives into\ndetails—covering much of 
the Racket toolbox, but leaving precise details to The Racket\nReference and 
other reference manuals.\n1"
'()
'((238.76 164.7293740006 250.2426717998 180.2060186005) 
(250.2426717998 164.7293740006 259.8144342 180.2060186005) 
(259.8144342 164.7293740006 267.4580717997 180.2060186005) 
(267.4580717997 164.7293740006 271.7619218 180.2060186005) 
(271.7619218 164.7293740006 284.1914405996 180.2060186005))
Assertion failed: (! scaled_font->cache_frozen), function 
cairo_scaled_font_create, file cairo-scaled-font.c, line 1175.
test-pdf-functions.rkt: raco test: non-zero exit: 134
raco test: 
"/Users/clements/racket/racket/share/pkgs/racket-poppler/racket-poppler/examples/test-render-tex.rkt"
application: required keyword argument not supplied
  procedure: latex->pict
  required keyword: #:preamble
  arguments...:
   "$\\sqrt{x^2+y^2}$"
  context...:
   /Users/clements/racket/racket/collects/racket/private/kw.rkt:1544:14
   
"/Users/clements/racket/racket/share/pkgs/racket-poppler/racket-poppler/examples/test-render-tex.rkt":
 [running body]
   temp35_0
   for-loop
   run-module-instance!
   (submod 
"/Users/clements/racket/pkgs/compiler-lib/compiler/commands/test.rkt" process): 
[running body]
   temp35_0
   for-loop
   run-module-instance!
   eval-one-top
test-render-tex.rkt: raco test: non-zero exit: 1
raco test: 
"/Users/clements/racket/racket/share/pkgs/racket-poppler/racket-poppler/ffi.rkt"
raco test: 
"/Users/clements/racket/racket/share/pkgs/racket-poppler/racket-poppler/info.rkt"
raco test: 
"/Users/clements/racket/racket/share/pkgs/racket-poppler/racket-poppler/libs.rkt"
raco test: 
"/Users/clements/racket/racket/share/pkgs/racket-poppler/racket-poppler/main.rkt"
raco test: 
"/Users/clements/racket/racket/share/pkgs/racket-poppler/racket-poppler/render-tex.rkt"
raco test: 
"/Users/clements/racket/racket/share/pkgs/racket-poppler/test-render-tex.rkt"
application: required keyword argument not supplied
  procedure: latex->pict
  required keyword: #:preamble
  arguments...:
   "$\\sqrt{x^2+y^2+z}$"
  context...:
   /Users/clements/racket/racket/collects/racket/private/kw.rkt:1544:14
   
"/Users/clements/racket/racket/share/pkgs/racket-poppler/test-render-tex.rkt": 
[running body]
   temp35_0
   for-loop
   run-module-instance!
   (submod 
"/Users/clements/racket/pkgs/compiler-lib/compiler/commands/test.rkt" process): 
[running body]
   temp35_0
   for-loop
   run-module-instance!
   eval-one-top
test-render-tex.rkt: raco test: non-zero exit: 1
3/3 test failures
hardy:/tmp clements> 



-- 
You received this message because you are 

Re: [racket-users] cast on mutable hash table...

2020-02-15 Thread 'John Clements' via users-redirect
Yes, I’ll add this. It slightly increases the pain density, especially since I 
think students likely to mistakenly write

(list (? symbol? #{s : Symbol}) …)

instead of the correct

(list (? symbol? #{s : (Listof Symbol)}) …)

… but it’s probably better than having to cast.

Thanks!

John


> On Feb 15, 2020, at 10:33, Sam Tobin-Hochstadt  wrote:
> 
> You can annotate variables like that in match patterns using #{s : Symbol}, 
> which ought to work in common cases. 
> 
> On Sat, Feb 15, 2020, 1:23 PM 'John Clements' via users-redirect 
>  wrote:
> Yes, absolutely. One reason that students in my class wind up using cast 
> quite frequently in their parsers is that they use patterns like (list (? 
> symbol s) …) which (as I recall) expand into unannotated lambda’s, and always 
> require a cast. I write that up here:
> 
> https://www.brinckerhoff.org/clements/2202-csc430/Assignments/tr-notes.html#%28part._.Predicate_.Patterns_with_.Dot-dot-dot%29
> 
> Beyond that, though, I tell them never to use cast:
> 
> https://www.brinckerhoff.org/clements/2202-csc430/Assignments/tr-notes.html#%28part._.Other_.Casting%29
> 
> The text I came up with for mutable hash tables is here:
> 
> https://www.brinckerhoff.org/clements/2202-csc430/Assignments/tr-notes.html#%28part._.Mutable_.Hash_.Table_.Construction%29
> 
> Many thanks to all of you!
> 
> John
> 
> > On Feb 14, 2020, at 12:32, Sam Tobin-Hochstadt  wrote:
> > 
> > The advice I would really give is to give a name and a type annotation to 
> > any mutable data structure you create. 
> > 
> > Also, cast is almost never what you want. I see lots of people (maybe 
> > including this student) using it as a substitute for type annotation but it 
> > really isn't. 
> > 
> > Sam
> > 
> > On Fri, Feb 14, 2020, 2:41 PM 'John Clements' via users-redirect 
> >  wrote:
> > I think I may understand what’s going on here, but a student and I worked 
> > on this for quite a while today before I found the problem.
> > 
> > Here’s a program:
> > 
> > #lang typed/racket
> > 
> > (define-type Store (Mutable-HashTable Integer Value))
> > (define-type Value (U Real Boolean String))
> > 
> > (define top-store (cast (make-hash (list
> > (cons -1 14)
> > (cons 1 #t)
> > (cons 2 #f)))
> > Store))
> > 
> > (hash-set! top-store 5 1234)
> > 
> > It fails with this error:
> > 
> > contract violation
> >   expected: (or/c (and/c byte? positive?) #t #f)
> >   given: 1234
> >   in: the values of
> >   the 3rd conjunct of
> >   (and/c
> >hash?
> >hash-mutable?
> >(hash/c
> > exact-integer?
> > (or/c (and/c byte? positive?) #t #f)
> > #:immutable
> > #f))
> >   contract from: typed-world
> >   blaming: cast
> >(assuming the contract is correct)
> >   at: unsaved-editor:6.18
> > 
> > If I understand what’s going on here, the basic issue is that the mutable 
> > hash table’s type is being inferred as (Immutable-HashTable Exact-Integer 
> > (U Boolean Positive-Byte)), and then as part of the cast, a contract is 
> > being inserted, which checks that all added values match the expected value 
> > type. The outer cast allows type checking to proceed, but then at runtime 
> > it fails because the given value doesn’t match the inferred value type.
> > 
> > This error doesn’t occur with immutable hash tables, because it’s fine to 
> > extend an immutable hash table to a larger one that contains it; the 
> > original one’s contract isn’t violated.
> > 
> > In this case, one easy error is to change the ‘cast’ into an ‘ann’, which 
> > works fine.
> > 
> > This is the first time I’ve encouraged my students to use a mutable hash, 
> > which is presumably why I haven’t encountered this before.
> > 
> > I’m trying to formulate a solution that I can put in a Hints for TR file, 
> > and I think the answer is probably this:
> > 
> > - When you use “make-hash” in TR, you should always specify the types 
> > explicitly using an “inst”.
> > or maybe
> > - When you call “make-hash” in TR, the call should be immediately wrapped 
> > with an “ann” type annotation.
> > 
> > In a perfect world, I think I would ask for a warning when casting a 
> > mutable hash table. It could go in that nice “warnings” box. Oh, wait…
> > 
> > … joking aside, actually I just

Re: [racket-users] cast on mutable hash table...

2020-02-15 Thread 'John Clements' via users-redirect
Yes, absolutely. One reason that students in my class wind up using cast quite 
frequently in their parsers is that they use patterns like (list (? symbol s) 
…) which (as I recall) expand into unannotated lambda’s, and always require a 
cast. I write that up here:

https://www.brinckerhoff.org/clements/2202-csc430/Assignments/tr-notes.html#%28part._.Predicate_.Patterns_with_.Dot-dot-dot%29

Beyond that, though, I tell them never to use cast:

https://www.brinckerhoff.org/clements/2202-csc430/Assignments/tr-notes.html#%28part._.Other_.Casting%29

The text I came up with for mutable hash tables is here:

https://www.brinckerhoff.org/clements/2202-csc430/Assignments/tr-notes.html#%28part._.Mutable_.Hash_.Table_.Construction%29

Many thanks to all of you!

John

> On Feb 14, 2020, at 12:32, Sam Tobin-Hochstadt  wrote:
> 
> The advice I would really give is to give a name and a type annotation to any 
> mutable data structure you create. 
> 
> Also, cast is almost never what you want. I see lots of people (maybe 
> including this student) using it as a substitute for type annotation but it 
> really isn't. 
> 
> Sam
> 
> On Fri, Feb 14, 2020, 2:41 PM 'John Clements' via users-redirect 
>  wrote:
> I think I may understand what’s going on here, but a student and I worked on 
> this for quite a while today before I found the problem.
> 
> Here’s a program:
> 
> #lang typed/racket
> 
> (define-type Store (Mutable-HashTable Integer Value))
> (define-type Value (U Real Boolean String))
> 
> (define top-store (cast (make-hash (list
> (cons -1 14)
> (cons 1 #t)
> (cons 2 #f)))
> Store))
> 
> (hash-set! top-store 5 1234)
> 
> It fails with this error:
> 
> contract violation
>   expected: (or/c (and/c byte? positive?) #t #f)
>   given: 1234
>   in: the values of
>   the 3rd conjunct of
>   (and/c
>hash?
>hash-mutable?
>(hash/c
> exact-integer?
> (or/c (and/c byte? positive?) #t #f)
> #:immutable
> #f))
>   contract from: typed-world
>   blaming: cast
>(assuming the contract is correct)
>   at: unsaved-editor:6.18
> 
> If I understand what’s going on here, the basic issue is that the mutable 
> hash table’s type is being inferred as (Immutable-HashTable Exact-Integer (U 
> Boolean Positive-Byte)), and then as part of the cast, a contract is being 
> inserted, which checks that all added values match the expected value type. 
> The outer cast allows type checking to proceed, but then at runtime it fails 
> because the given value doesn’t match the inferred value type.
> 
> This error doesn’t occur with immutable hash tables, because it’s fine to 
> extend an immutable hash table to a larger one that contains it; the original 
> one’s contract isn’t violated.
> 
> In this case, one easy error is to change the ‘cast’ into an ‘ann’, which 
> works fine.
> 
> This is the first time I’ve encouraged my students to use a mutable hash, 
> which is presumably why I haven’t encountered this before.
> 
> I’m trying to formulate a solution that I can put in a Hints for TR file, and 
> I think the answer is probably this:
> 
> - When you use “make-hash” in TR, you should always specify the types 
> explicitly using an “inst”.
> or maybe
> - When you call “make-hash” in TR, the call should be immediately wrapped 
> with an “ann” type annotation.
> 
> In a perfect world, I think I would ask for a warning when casting a mutable 
> hash table. It could go in that nice “warnings” box. Oh, wait…
> 
> … joking aside, actually I just did turn on the “log” window and I don’t see 
> any warning about this, which is not too surprising. Oh, wait, I see another 
> bug…
> 
> Thanks for reading, let me know if there’s any more obvious solution.
> 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/f24851ca-32aa-40e1-9db4-691da815ebe7%40mtasv.net.



-- 
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/f1cdb734-cb79-4a1a-8bb8-3bf3d4a425b4%40mtasv.net.


[racket-users] TR: cast on mutable hash table...

2020-02-14 Thread 'John Clements' via users-redirect
I think I may understand what’s going on here, but a student and I worked on 
this for quite a while today before I found the problem.

Here’s a program:

#lang typed/racket

(define-type Store (Mutable-HashTable Integer Value))
(define-type Value (U Real Boolean String))

(define top-store (cast (make-hash (list
(cons -1 14)
(cons 1 #t)
(cons 2 #f)))
Store))

(hash-set! top-store 5 1234)

It fails with this error:

contract violation
  expected: (or/c (and/c byte? positive?) #t #f)
  given: 1234
  in: the values of
  the 3rd conjunct of
  (and/c
   hash?
   hash-mutable?
   (hash/c
exact-integer?
(or/c (and/c byte? positive?) #t #f)
#:immutable
#f))
  contract from: typed-world
  blaming: cast
   (assuming the contract is correct)
  at: unsaved-editor:6.18

If I understand what’s going on here, the basic issue is that the mutable hash 
table’s type is being inferred as (Immutable-HashTable Exact-Integer (U Boolean 
Positive-Byte)), and then as part of the cast, a contract is being inserted, 
which checks that all added values match the expected value type. The outer 
cast allows type checking to proceed, but then at runtime it fails because the 
given value doesn’t match the inferred value type.

This error doesn’t occur with immutable hash tables, because it’s fine to 
extend an immutable hash table to a larger one that contains it; the original 
one’s contract isn’t violated.

In this case, one easy error is to change the ‘cast’ into an ‘ann’, which works 
fine.

This is the first time I’ve encouraged my students to use a mutable hash, which 
is presumably why I haven’t encountered this before.

I’m trying to formulate a solution that I can put in a Hints for TR file, and I 
think the answer is probably this:

- When you use “make-hash” in TR, you should always specify the types 
explicitly using an “inst”.
or maybe
- When you call “make-hash” in TR, the call should be immediately wrapped with 
an “ann” type annotation.

In a perfect world, I think I would ask for a warning when casting a mutable 
hash table. It could go in that nice “warnings” box. Oh, wait…

… joking aside, actually I just did turn on the “log” window and I don’t see 
any warning about this, which is not too surprising. Oh, wait, I see another 
bug…

Thanks for reading, let me know if there’s any more obvious solution.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/f24851ca-32aa-40e1-9db4-691da815ebe7%40mtasv.net.


[racket-users] Racket v7.6

2020-02-13 Thread 'John Clements' via users-redirect
--
Racket version 7.6 is now available from

https://racket-lang.org/


* DrRacket's scrolling has been made more responsive.

* DrRacket's dark mode support is improved for Mac OS and Unix.

* Racket CS is ready for production use. We will work to further
  improve Racket CS before making it the default implementation, but
  it now consistently passes all of our integration tests and
  generally performs well. (Compiled code remains significantly larger
  compared to the default implementation.)

* The Web Server provides fine-grained control over various aspects of
  handling client connections (timeouts, buffer sizes, maximum header
  counts, etc.) via the new "safety limits" construct.

  Using this new construct, we have decreased the web server's default
  level of trust in client connections and made it detect additional,
  maliciously constructed requests. Resource-intensive applications may
  need to adjust the default limits (for example, to accept large file
  uploads).  In trusted settings, they can be disabled completely by
  starting the web server with `#:safety-limits
  (make-unlimited-safety-limits)`.

* The Web Server's handling of large files is improved, and its
  latency for long-running request handlers is reduced.

* The Macro Stepper has a new macro hiding algorithm that tracks term
  identity through syntax protection (see `syntax-arm`), making macro
  hiding work more reliably. Its UI indicates protected and tainted
  syntax.

* The Racket documentation includes a "building and contributing" guide.

Contributors: Alex Harsanyi, Alex Knauth, Alex Muscar, Alexis King, Ben
Greenman, Bogdan Popa, Brian Wignall, Dan Holtby, David K. Storrs,
Dionna Glaze, Dominik Pantůček, Fred Fu, Geoff Shannon, Gustavo
Massaccesi, Jack Firth, Jay McCarthy, Jens Axel Søgaard, Jesse Alama,
Joel Dueck, John Clements, Jordan Johnson, Julien Delplanque, Leo Uino,
Luka Hadži-Đokić, Luke Lau, Matthew Flatt, Matthias Felleisen, Mike
Sperber, Paulo Matos, Philip McGrath, Reuben Thomas, Robby Findler, Ross
Angle, Ryan Culpepper, Sage Gerard, Sam Tobin-Hochstadt, Shu-Hung You,
Sorawee Porncharoenwase, Stephen De Gabrielle, Syntacticlosure, Timo
Wilken, Tommy McHugh, Winston Weinert, Zaoqi

Feedback Welcome
--



-- 
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/417a89bb-5a84-407c-9e24-dc6be6e017b2%40mtasv.net.


[racket-users] resources for learning JS / React?

2020-01-25 Thread 'John Clements' via users-redirect
I have a graduate student that wants a self-guided introduction to JS and 
React. The problem here, to some degree, is that there are so *many* 
introductions. Does anyone here have specific references that might be helpful? 
(Say, e.g., if Gregor Kiczales did a JS course on coursera… that would be 
pretty much perfect.)

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/4b0bae35-f14d-42b6-a3fb-b6a116da836a%40mtasv.net.


[racket-users] symlink to raco changes its behavior?

2019-11-15 Thread 'John Clements' via users-redirect
I’ve been testing the release version of racket for a few weeks now, and I 
notice a strange difference between using the “raco” binary that’s part of the 
distribution and using a symlink to that binary. Specifically, calling raco 
setup always requires an explicit ‘-l’ when I use the symlink. When I provide 
the path to raco explicitly, it works fine without the -l. Attached see a 
transcript that shows the problem. I just want to make sure that … this is 
expected behavior?

John


```
# here’s the symlink:
hardy:/tmp/moss clements> ls -ld ~/bin/nuraco
lrwxr-xr-x  1 clements  staff  40 Oct 15 11:30 /Users/clements/bin/nuraco -> 
/Applications/Racket v7.4.0.902/bin/raco
# calling it with an explicit path works fine:
hardy:/tmp/moss clements> /Applications/Racket\ v7.4.0.902/bin/raco setup 
csse-scheduling
raco setup: version: 7.4.0.902
raco setup: platform: x86_64-macosx [3m]
raco setup: target machine: racket
raco setup: installation name: 7.4.0.902
raco setup: variants: 3m
raco setup: main collects: /Applications/Racket v7.4.0.902/collects
raco setup: collects paths: 
raco setup:   /Users/clements/Library/Racket/7.4.0.902/collects
raco setup:   /Applications/Racket v7.4.0.902/collects
raco setup: main pkgs: /Applications/Racket v7.4.0.902/share/pkgs
raco setup: pkgs paths: 
raco setup:   /Applications/Racket v7.4.0.902/share/pkgs
raco setup:   /Users/clements/Library/Racket/7.4.0.902/pkgs
raco setup: links files: 
raco setup:   /Applications/Racket v7.4.0.902/share/links.rktd
raco setup:   /Users/clements/Library/Racket/7.4.0.902/links.rktd
raco setup: main docs: /Applications/Racket v7.4.0.902/doc
raco setup: --- updating info-domain tables ---[16:31:56]
raco setup: --- pre-installing collections --- [16:31:56]
raco setup: --- installing foreign libraries ---   [16:31:56]
raco setup: --- installing shared files ---[16:31:56]
raco setup: --- compiling collections ---  [16:31:56]
raco setup: --- parallel build using 8 jobs ---[16:31:56]
raco setup: 7 making: /csse-scheduling/csse-scheduling (CSSE Scheduling 
Support)
raco setup: 7 making: /csse-scheduling/csse-scheduling/progress
raco setup: --- creating launchers --- [16:31:57]
raco setup: --- installing man pages ---   [16:31:57]
raco setup: --- building documentation --- [16:31:57]
raco setup: 2 skipping: /distro-build-doc/distro-build.scrbl
raco setup: rendering: 
/csse-scheduling/csse-scheduling/csse-scheduling.scrbl
WARNING: collected information for key multiple times: '(exporting-libraries 
#f); values: '(canonicalize) '(types)
WARNING: collected information for key multiple times: '(exporting-packages 
#f); values: '() '()
WARNING: collected information for key multiple times: '(exporting-libraries 
#f); values: '(types) '(qtr-math)
WARNING: collected information for key multiple times: '(exporting-packages 
#f); values: '() '()
raco setup: --- installing collections --- [16:32:02]
raco setup: --- post-installing collections ---[16:32:02]
# calling it using the symlink doesn’t work:
hardy:/tmp/moss clements> nuraco setup csse-scheduling
open-input-file: cannot open input file
  path: /tmp/moss/csse-scheduling
  system error: No such file or directory; errno=2
  context...:
   /Applications/Racket v7.4.0.902/collects/setup/unpack.rkt:262:2: unpack7
   /Applications/Racket v7.4.0.902/collects/setup/setup-core.rkt:287:13: 
for-loop
   /Applications/Racket v7.4.0.902/collects/setup/setup-core.rkt:72:0: 
setup-core
   "/Applications/Racket v7.4.0.902/collects/setup/main.rkt": [running body]
   temp37_0
   for-loop
   run-module-instance!125
   "/Applications/Racket v7.4.0.902/collects/raco/main.rkt": [running body]
   temp37_0
   for-loop
   run-module-instance!125
   perform-require!78
hardy:/tmp/moss clements> 
```

-- 
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/81830d2b-c734-481e-8caa-657c7f89eac9%40mtasv.net.


Re: [racket-users] Confirming receipt

2019-08-23 Thread 'John Clements' via users-redirect
Confirming publicly (so you don’t get a torrent of off-list responses).

John Clements

> On Aug 23, 2019, at 09:10, Sage Gerard  wrote:
> 
> Hello,
> 
> My last few emails to the user mailing list have gone without responses, and 
> I suspect that my emails were sent to spam or silently discarded since I 
> cannot find them in the mirrors.
> 
> I sent another just last night, but I wanted to confirm if subscribing to the 
> Google Group fixes the problem. Could one person please confirm that they see 
> this message?
> 
> ~slg
> 
> 
> 
> -- 
> 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/aHcDzEczkoXo4QuakIaKWgTtE3PbxwCSLe1cVY-OcbI4jzpRIF7y384p7CDm9DZDl5rAGYwXtBYKkNMq3yAulWM3Mj88aqKogLN9-rR0ptw%3D%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/a68493e5-79f4-4f0c-8f53-7757daae5b43%40mtasv.net.


Re: [racket-users] racket url connection problem solved by reboot?

2019-08-19 Thread 'John Clements' via users-redirect
Oh! both excellent thoughts. Okay, I’ll try to remember this for the next time 
this happens. 

Many thanks!

John


> On Aug 19, 2019, at 11:10, Bogdan Popa  wrote:
> 
> The server doesn't seem to handle `Expect:' headers properly so, for
> example, curl has a couple seconds' delay when you run the following
> from the command line:
> 
>$ curl -v -F'request=1234' brinckerhoff.org:8025
> 
>* Rebuilt URL to: brinckerhoff.org:8025/
>*   Trying 45.79.98.233...
>* TCP_NODELAY set
>* Connected to brinckerhoff.org (45.79.98.233) port 8025 (#0)
>> POST / HTTP/1.1
>> Host: brinckerhoff.org:8025
>> User-Agent: curl/7.54.0
>> Accept: */*
>> Content-Length: 146
>> Expect: 100-continue
>> Content-Type: multipart/form-data; 
>> boundary=94d1720a98a20d42
>> 
>* Done waiting for 100-continue
>< HTTP/1.1 200 Okay
>...
> 
> Here's the output when you disable the Expect header:
> 
>$ curl -H'Expect:' -v -F'request=1234' brinckerhoff.org:8025
> 
>* Rebuilt URL to: brinckerhoff.org:8025/
>*   Trying 45.79.98.233...
>* TCP_NODELAY set
>* Connected to brinckerhoff.org (45.79.98.233) port 8025 (#0)
>> POST / HTTP/1.1
>> Host: brinckerhoff.org:8025
>> User-Agent: curl/7.54.0
>> Accept: */*
>> Content-Length: 146
>> Content-Type: multipart/form-data; 
>> boundary=f6089861efe4775a
>> 
>< HTTP/1.1 200 Okay
> 
> (no delay before the response is returned)
> 
> Maybe `post-impure-port' sends an `Expect' header on POST and tries to
> handle the exchange correctly?  IIRC, web browsers don't send `Expect'
> headers.
> 
> The other explanation could be related to DNS resolution.  Do you run
> `dnsmasq' or something like it locally?  I've run into slow DNS
> resolution issues myself on macOS when my resolvers were misconfigured.
> These tend to lead to heisenbugs when the slow resolution eventually
> resolves and gets cached so all subsequent calls are fast.



-- 
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/9a5c273b-6adf-4004-aeaa-462fa806137d%40mtasv.net.


[racket-users] racket url connection problem solved by reboot?

2019-08-19 Thread 'John Clements' via users-redirect
This may be an OS question, but it manifested as a curious racket problem, so I 
thought I’d ask. Consider the following program:

#lang racket

(require net/url)

(post-impure-port
(string->url "http://brinckerhoff.org:8025/;)
#"request=1234"
'("Content-Type: application/x-www-form-urlencoded”))

Basically, just open a connection to a web server. The observed and 
reproducible behavior when running in DrRacket 7.4.0.1 was that there was a 
77-second delay, and then the port was opened just fine. Looking at the back 
end (this was a connection to a racket web server, perhaps unfortunately), 
there was no evidence of a connection until the 77 seconds was up.

Contacting the given URL (http://brinckerhoff.org:8025/) with a web browser 
(Firefox), though, produced a near-instantaneous response—about 2 seconds.

I saw the same delay when running the program using ‘racket’ at the 
command-line.

I then rebooted my machine (MacOS Mojave 10.14.6). The problem went away.

In retrospect, I regret rebooting before doing more experimentation; does this 
apply to other versions of Racket? Other ways of connecting?

So, it looks like both DrRacket and Racket were experiencing some kind of 
persistent OS-related network block. All the (mumble)s were taken? But then, 
why did the web browser go through? Perhaps the web browser has some deeper 
knowledge of the OS that allows it to detect and work around this problem.

Can anyone shed any light on whether this is 
a) a known issue with the operating system,
b) a misunderstanding on my part, or
b) a bug/problem with Racket?

Many 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/838316e3-8897-40e1-a8a3-bc7b65d7fb84%40mtasv.net.


[racket-users] Racket v7.4

2019-08-08 Thread 'John Clements' via users-redirect
Racket version 7.4 is now available from

https://racket-lang.org/

With this 7.4 release, we are making Racket CS available, a beta version
of the Racket on Chez Scheme implementation.  Racket CS is "beta"
quality for the v7.4 release. It works well enough to be worth trying,
but there are likely too many lingering problems for a project to switch
to Racket CS for production use at this time. We encourage you to kick
the tires of the new CS releases, and to help push this project forward
by reporting any problems that you find.

- Racket CS is available as a download option. To download Racket CS,
  select "CS" instead of "regular" from the "Variant" popup menu.

- Single-precision floating-point literals, a.k.a. single-flonums, are
  no longer supported by default.

  This is a backward-incompatible change, but the use of single-flonums
  appears to be rare. Since Racket CS does not support single-flonums,
  disabling single-flonums by default smooths the transition from regular
  Racket and Racket CS.

  The `read-single-flonum` parameter can be set to #t to enable reading
  single-flonum literals, but a better strategy in most cases is to use
  `real->single-flonum` when `single-flonum-available?` reports #t or
  when `single-flonum?` reports #t for a value (which implies that
  single-flonums must be supported). Where single-flonums are supported,
  Racket's compiler will fold a call of `real->single-flonum` on a
  literal number to a constant single-flonum value.

- New compilation flags including --disable-generations and --enable-ubsan
  provide better support for alternative
  architectures.

- The 2htdp/universe teachpack supports an event log window for big-bang. 
  With this option, students can inspect the events that big-bang handled,
  plus their payload. The event log includes messages from external
  sources.

The following people contributed to this release: Alex Knauth, Alexander
B. McLin, Alexis King, Andreas Düring, Asumu Takikawa, Atharva Raykar,
Ben Greenman, Benjamin Yeung, Dmitry Moskowski, Fred Fu, Gustavo
Massaccesi, Ilnar Salimzianov, Jason Hemann, Jay McCarthy, Jesse A. Tov,
Jesse Alama, John Clements, Leif Andersen, Lukas Lazarek, Matthew Flatt,
Matthias Felleisen, Mike Sperber, Morgan Lemmer-Webber, Noah W M, Paulo
Matos, Philip McGrath, Robby Findler, Rodrigo, Roman Klochkov, Ryan
Culpepper, Sam Tobin-Hochstadt, Simon 'Sze' L. Schlee, Sorawee
Porncharoenwase, Spencer Florence, Stephan Renatus, Stephen Chang,
Stephen De Gabrielle, Thomas Dickerson, Vincent St-Amour, and yjqww6

Feedback Welcome



-- 
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/e6f4bc0f-bc9a-4f6c-908e-6087bc5e6d50%40mtasv.net.


Re: [racket-users] 7 GUIs

2019-06-03 Thread 'John Clements' via users-redirect
Would it make sense to post the early ones to the 7GUIs site? They might be the 
easiest ones for others to understand.

John

> On Jun 1, 2019, at 4:47 PM, Matthias Felleisen  wrote:
> 
> 
> Someone recently mentioned the “7 GUIs” task. I spent a couple of days to 
> write up minimal solutions: 
> 
>  https://github.com/mfelleisen/7GUI/blob/master/task-7.rkt 
> 
> In my spare time, I will develop this repo in more depth (types, units, etc) 
> because it looks like a reasonably educational task. 
> 
> 
> 
> -- 
> 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/9A5BBCC3-C65A-4BFD-8C37-F7F35BCF39E7%40felleisen.org.
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/8d3d750e-6df3-41dd-84fd-1e43a2f261c1%40mtasv.net.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Help narrow down problem using plt-web-server:

2019-01-10 Thread 'John Clements' via users-redirect
Apologies if this is obvious, but have you checked to see whether some other 
process is already listening on port 443? On a Linux server, it looks to me 
like you should be able to see what processes are listening on what ports by 
running

sudo netstat -tulpn

Also, you don’t mention what the result of running on port 8000 is.

Best,

John


> On Jan 10, 2019, at 12:50, Don Green  wrote:
> 
> I could use some help narrowing down this problem using plt-web-server:
> Context:
> I can successfully run all code described in: Continue: Web Applications in 
> Racket, Chapters 1 through 17.
> However, 'Chapter 18: Using HTTPS' where I run plt-web-server is giving me a 
> problem. 
> (I am using OS:Linux/Ubuntu 16.04).
>   
> I suspect that I:
> (a) may be misusing plt-web-server; or 
> (b) have not actually installed my server-cert.pem properly even though 
> the verification operation indicates a successful installation:
> openssl verify -CApath /etc/ssl/certs server-cert.pem
> returns:
> server-cert.pem: OK
> ;or
> (c) may have some other problem. 
> -
> From: .../collects/DG/programs/processorX/URL/proc/proc-url/proc-url.ss
> When I run plt-web-server from a terminal, at a $ prompt, in my application 
> directory:
> $ plt-web-server --ssl
> 
> I get the message:
> 
> tcp-listen: listen failed
>   port number: 443
>   system error: Address already in use; errno=98
>   context...:
>.../more-scheme.rkt:261:28
>/usr/share/racket/pkgs/compatibility-lib/mzlib/kw.rkt:468:41: run-server
> 
> Or
> When I run plt-web-server from a terminal, at a # prompt, in my application 
> directory:
> # plt-web-server --ssl
> 
> I get no feedback, and eventually close the terminal.
> -
> Q. I believe the port: 443 is a root level port, therefor I suspect I am 
> expected to run plt-web-server as root.
>That is the only reason I am trying to run it from a # prompt. 
>I have also tried running: $plt-web-server -p 8000 --ssl
>because I believe the 8000 port is not a root level port.
>Comments?
> 
> Q. Can I run 'plt-web-server --ssl' from a terminal opened to any directory 
> because it will, by default, refer to 
> .../default-web-root/configuration-table.rkt?  
> configuration-table.rkt contains line: (default-indices "index.html" 
> "index.htm"), so I'll be happy to see that file displayed in my firefox 
> browser.
> 
> Q. Do I have to make a firefox-specific configuration regarding the 
> server-cert.pem file?
> 
> Q. I understand how to run my application as a servlet using racket -t 
> .
>When I get one of these running properly:
>$plt-web-server --ssl
>or
>$plt-web-server [-f  -p  -a  --ssl]
>where do I specify ?  ...that I used when calling servlet 
> with 'racket -t '.
>Seems that plt-web-server only runs either the default 
> configuration-table.rkt or another configuration-table.rkt from
>another location if I specify it in the -f  argument.
> 
> Thanks
> Don.
> 
> 
> -- 
> 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] t-test (student's, welch's)

2018-12-18 Thread 'John Clements' via users-redirect
I often find myself wanting to use a t-test. Wikipedia suggests that really, I 
should probably be using Welch’s t-test, because it works well when variances 
and sample sizes are different, and about as well as student’s t-test when 
variances and sample sizes are the same. 

My vague recollection is that wanting these things makes me a frequentist, and 
a Bad Person. And that this is related to the reason that it’s not already 
present in the math/statistics package, whose feet I am (seriously!) not fit to 
wash. Not in a statistical sense, any way.

Are there good reasons not to implement a simple package containing welch’s 
t-test? And maybe student’s t-test, just for the heck of it?

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.


[racket-users] pkgd.racket-lang.org sign-in link down

2018-03-04 Thread 'John Clements' via users-redirect
The “sign in” link on pkgs.racket-lang.org appears to time out. It looks to me 
like that’s because it’s a link to pkgd.racket-lang.org (not pkgs….). I believe 
these are … supposed to be synonyms? When I go to pkgd.racket-lang.org I get a 
directory listing… looks like a misconfigured web server.

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.


[racket-users] disappearance of cursor & ability to move cursor

2018-03-03 Thread 'John Clements' via users-redirect
I had a funny thing happen to me today in (racket7) DrRacket; the cursor 
disappeared. I was able to type, but only in one location; the arrow keys 
didn’t move the (invisible) insertion point. I restarted DrR, and the problem 
went away. Strange. Nothing like a bug report, but something to be on the 
lookout for.

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.


[racket-users] TR can't generate contracts for prefab structs?

2017-12-09 Thread 'John Clements' via users-redirect
It looks to me like TR can’t generate contracts for prefab structs in a way 
that I would expect it to. Specifically, here’s a TR file and a Racket file 
that uses a TR-defined prefab structure:

makes-foo.rkt:

#lang typed/racket

(provide (struct-out Foo)
 get-a-foo)

(struct Foo ([a : String]) #:prefab)

(define (get-a-foo)
  (Foo "oeuth”))


uses-foo.rkt:

#lang racket

(require "makes-foo.rkt")

(define a (get-a-foo))


This doesn’t typecheck (at least not in version  6.11.0.2--2017-11-05, tell me 
if I should just upgrade), with the message:

Type Checker: could not convert type to a contract;
 contract generation not supported for this type
  identifier: get-a-foo
  type: (-> Foo) in: (get-a-foo)

My first thought was that this was related to mutability, but the docs and my 
experiments suggest that prefab structures are default-immutable, and that this 
is reflected in a way that should be visible to the type-checker. Am I missing 
something, or is this just something that we haven’t yet had time to implement?


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.


[racket-users] pragmatics of exhaustiveness checking in TR

2017-12-09 Thread 'John Clements' via users-redirect
TR doesn’t really do exhaustiveness checking, really, … except sorta. I’m 
mostly just writing this to summarize my thinking and to see if there’s 
something obvious I’m missing.

I spent some time this morning debugging code that looked something like this:

#lang typed/racket

(define-type Format (U 'fmt-a 'fmt-b 'fmt-c))

(define (process-num [a : Number] [f : Format]) : Number
  (match f
['fmt-a (+ a 1)]
['fnt-b (* a 2)]
[_ (+ a 1234)]))

(process-num 2431 'fmt-b)


The problem is that the call winds up in the third case rather than the second, 
because I’ve misspelled ‘fmt-b’ in the second clause of the match.

I figured out the bug, of course, but then I had a moment of mild panic, 
because that bug lived in the bin in my brain labeled “don’t worry, TR will 
catch this kind of problem.” And, of course, that’s not true; TR is perfectly 
happy to allow equality checks between elements of type Format and Symbol, 
because *Racket* is perfectly happy to allow these comparisons, and that’s kind 
of the whole point of TR.

My thought process:

1) I looked for a “dead code” indication in TR, and the closest I could get was 
hovering over the dead code for a tooltip.  Currently, it appears that the 
tooltip for dead code is… well, there is no tooltip.  Maybe it would be a good 
idea for the tooltip for dead code to signal “unreachable code” somehow? 

2) I looked for a “dead code” indication in the Optimization 
coach…unfortunately, I couldn’t figure out how to get the Optimization Coach to 
signal dead code. Is it in there? I couldn’t find it.

So then I started trying to figure out if I could code differently in order to 
get around this.

3) Clearly the wildcard match is a problem; if I want TR to tell me something 
about not being able to match, I’ve got to let TR know that falling off the end 
is possible. So I can change the third pattern to ‘fmt-c’. Unfortunately, I now 
discover that the very thing I *like* about match—namely, the fact that it 
signals an error for no match—is going to kill the TR checking of this, because 
of course errors don’t return, so the presence of the error *helps* the code to 
type-check. 

4) Instead, I can use a conditional, or a case. This is fragile, because I’ll 
only get a type error if Void isn’t in the stated return type. My recollection 
is that there’s an expression which has the type “Nothing”, but I can’t 
remember what it is… and I can't seem to find it in the docs.  


So, at the end of the day, if I want to get exhaustiveness checking for things 
like this, it looks like my best practice is: a) use a case expression, and b) 
mentally check that ‘void’ is not in the return type.  Does this sound right?

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.


Re: [racket-users] DrRackGit & LibGit2

2017-12-07 Thread 'John Clements' via users-redirect


> On Dec 7, 2017, at 2:34 PM, Stephen De Gabrielle  
> wrote:
> 
> I should be clear, I ran the libgit2 tests by hard coding the location of the 
> library and running them manually. I don’t really know what I’m doing so that 
> was the best I could muddle through.

That doesn’t sound ideal. Probably it’s better to deliver the library with the 
package on macos & windows, & ask user to install using package manager on 
linux. Sounds like entertaining work, and I’ve been meaning to take a look at 
this for quite a while now, but I definitely don’t have any time before next 
Tuesday.

John

> S.
> 
> On Thu, 7 Dec 2017 at 22:28, Stephen De Gabrielle  
> wrote:
> Only on macOS, but most tests passed.
> S.
> On Thu, 7 Dec 2017 at 22:15, John Clements  wrote:
> Bradley was a student of mine, so I’m interested generally. Have you checked 
> to see whether adding the libgit2 dependency allows the tests to pass?
> 
> John
> 
> > On Dec 7, 2017, at 10:27 AM, Stephen De Gabrielle  
> > wrote:
> >
> >
> > Hi,
> > https://pkgs.racket-lang.org/package/Drrackgit
> > https://github.com/bbusching/drrackgit
> > https://pkgs.racket-lang.org/package/libgit2
> > https://github.com/bbusching/libgit2
> > https://libgit2.github.com/
> >
> > I was very excited when I found the DrRackGit tool in the Racket packages, 
> > but saddened to find it is currently failing.
> >
> > Bradley, the original developer was kind enough to diagnose the issue ( it 
> > is missing the dependency on the libgit2 library.) and add a compatible 
> > licence, but isn’t able to maintain it at the moment.
> >
> > Is anyone interested in fixing the libgit2 package?
> >
> > Kind regards,
> >
> > Stephen
> >
> > PS I have built the lib2git library on macOS, but I lack the required 
> > experience in FFI and I can’t currently build for Linux or windows.
> >
> >
> >
> >
> >
> >
> > --
> > Kind regards,
> > Stephen
> > --
> > Ealing (London), UK
> >
> > --
> > 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.
> 
> 
> 
> -- 
> Kind regards,
> Stephen
> --
> Ealing (London), UK
> -- 
> Kind regards,
> Stephen
> --
> Ealing (London), UK



-- 
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] DrRackGit & LibGit2

2017-12-07 Thread 'John Clements' via users-redirect
Bradley was a student of mine, so I’m interested generally. Have you checked to 
see whether adding the libgit2 dependency allows the tests to pass?

John

> On Dec 7, 2017, at 10:27 AM, Stephen De Gabrielle  
> wrote:
> 
> 
> Hi, 
> https://pkgs.racket-lang.org/package/Drrackgit
> https://github.com/bbusching/drrackgit  
> https://pkgs.racket-lang.org/package/libgit2
> https://github.com/bbusching/libgit2
> https://libgit2.github.com/
> 
> I was very excited when I found the DrRackGit tool in the Racket packages, 
> but saddened to find it is currently failing.
> 
> Bradley, the original developer was kind enough to diagnose the issue ( it is 
> missing the dependency on the libgit2 library.) and add a compatible licence, 
> but isn’t able to maintain it at the moment.
> 
> Is anyone interested in fixing the libgit2 package? 
> 
> Kind regards,
> 
> Stephen
> 
> PS I have built the lib2git library on macOS, but I lack the required 
> experience in FFI and I can’t currently build for Linux or windows.
> 
> 
> 
> 
> 
> 
> -- 
> Kind regards,
> Stephen
> --
> Ealing (London), UK
> 
> -- 
> 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] desired behavior on error-during expected for check-expect?

2017-10-19 Thread 'John Clements' via users-redirect
I was debugging some student code today, and I was momentarily thrown by a 
message that said “both tests passed!” when most of the code was not getting 
run. It turned out that there was an error being signalled during the 
evaluation of the expected value. To see this, try this code in beginner:

(check-expect (+ 1 2) 3)
(check-expect (+ 3 4) 7)
(check-expect (+ 4 4) (/ 1 0))
(check-expect (+ 4 5) (/ 1 0))

(+ 4 129387)

You’ll see a message indicating “both tests passed!”, which is pretty 
misleading. Is this the desired behavior? Is this a known bug that’s waiting 
for the return of Kathy Gray?

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.


[racket-users] okay for the stepper to blanket disarm all syntax?

2017-10-16 Thread 'John Clements' via users-redirect
I’m in the process of trying to update the stepper to handle check-random, and 
I’m somewhat baffled by the amount of difficulty I’m running into in and around 
‘syntax-disarm’.

It occurs to me that it would probably be simpler just to walk over the 
expanded syntax tree and reformulate it by disarming all syntax and rebuilding 
the tree using 

(datum->syntax (syntax-disarm old-stx inspector) rebuilt) new-stx old-stx 
old-stx)

.. at every syntax wrapper, with recursive calls for every compound form. This 
seems like an awfully big hammer, though; is it likely to bite me, or have 
unexpected consequences? I would be sad if the stepper created security 
vulnerabilities.

Many thanks for any advice.

John “bitten by my own hammer” Clements

-- 
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] Fwd: Racket Con

2017-10-05 Thread 'John Clements' via users-redirect
Forwarded without comment… :)

> Begin forwarded message:
> 
> From: Jasmine Harihar Patel 
> Subject: Racket Con
> Date: October 5, 2017 at 11:54:02 AM PDT
> To: "John B. Clements" 
> 
> Dear Professor Clements,
> 
> My name is Jasmine and I am a 2nd year CSC student. I heard that you were 
> going to Racket Con tomorrow and was wondering if there is any way I could 
> get one of those cool heat sensitive mugs (only if it is no trouble). 
> 
> Thanks,
> Jasmine Patel

-- 
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] existing predicate for membership in TR Sexp type?

2017-09-25 Thread 'John Clements' via users-redirect

> On Sep 25, 2017, at 5:52 AM, Matthias Felleisen <matth...@ccs.neu.edu> wrote:
> 
> 
>> On Sep 24, 2017, at 9:32 PM, 'John Clements' via users-redirect 
>> <us...@plt-scheme.org> wrote:
>> 
>> Now that I know how much faster ‘assert’ can be than ‘cast’, I’m eager to 
>> replace uses of ‘assert' all over the place.
>> 
>> Specifically, in my PL class, I’m hoping to get rid of uses of (cast … Sexp) 
>> that wind up principally in RHSes of match clauses.
>> 
>> In order to do this, I need a predicate of type (-> Any Boolean : Sexp). 
>> 
>> Well, strictly speaking, all I really need is the positive half, which I can 
>> construct like this:
>> 
>> (: sexp? (-> Any Boolean : #:+ Sexp))
>> (define (sexp? s)
>> (or (number? s)
>> (symbol? s)
>> (string? s)
>> (and (pair? s) (sexp? (car s)) (sexp? (cdr s)))
>> (null? s)))
>> 
>> This works fine, and I can use it in an assert. 
>> 
>> Should I just drop this on my students, or is there an existing s-expression 
>> checking predicate that I can use?
>> 
>> Apologies if I’m just not looking hard enough! 
> 
> 
> The definition of S-expression tends to be parameterized over the leafs 
> (atoms). I’d be surprised if your particular version existed. [I assume you 
> understand that you’re handing them a parser and that the use of this 
> predicate may slow down the function (in terms of O-class).] — Matthias

For this class, it’s all about ‘match’; last year, TR’s treatment of `match` 
wasn’t clever enough in many instances to deduce that a particular pattern 
variable’s value inhabits, say, Sexp, requiring either a cast or an assert. It 
may be that this year, TR is sufficiently sophisticated in its handling of 
`match` to obviate this need. If not, though, I’ll need either a cast or an 
assert. (If I’m thinking about this problem correctly, then *either* a cast or 
an assert is going to boost the asymptotic running time; even if TR can perform 
deduplication of casts to the same type, I think this still incurs the same 
asymptotic penalty.)

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.


[racket-users] tooltip "im" message

2017-09-24 Thread 'John Clements' via users-redirect
I have a file on which I’m getting this DrRacket internal error:

interval-map-cons*!: start is not strictly less than end
  im: (make-interval-map '(((390 . 410) #(struct:tooltip-info #(str...
  start: 3201
  end: 3201
  obj: (tooltip-info (object:...ivate/get-extend.rkt:134:12 ...) 320...
  context...:
   
/Users/clements/racket/racket/share/pkgs/data-lib/data/interval-map.rkt:74:0: 
interval-map-cons*!
   
/Users/clements/racket/racket/share/pkgs/drracket/drracket/private/syncheck/gui.rkt:2076:10:
 loop
   
/Users/clements/racket/racket/share/pkgs/drracket/drracket/private/module-language.rkt:2299:6:
 for-loop
   
/Users/clements/racket/racket/share/pkgs/drracket/drracket/private/module-language.rkt:2234:24
   
/Users/clements/racket/racket/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:454:6
   
/Users/clements/racket/racket/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:505:32
   
/Users/clements/racket/racket/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:653:3

I’m guessing it won’t be helpful to have the file… but you never know. Here’s 
the file on which it’s occurring.

-- 
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.


run-grading.rkt
Description: Binary data


[racket-users] existing predicate for membership in TR Sexp type?

2017-09-24 Thread 'John Clements' via users-redirect
Now that I know how much faster ‘assert’ can be than ‘cast’, I’m eager to 
replace uses of ‘assert' all over the place.

Specifically, in my PL class, I’m hoping to get rid of uses of (cast … Sexp) 
that wind up principally in RHSes of match clauses.

In order to do this, I need a predicate of type (-> Any Boolean : Sexp). 

Well, strictly speaking, all I really need is the positive half, which I can 
construct like this:

(: sexp? (-> Any Boolean : #:+ Sexp))
(define (sexp? s)
  (or (number? s)
  (symbol? s)
  (string? s)
  (and (pair? s) (sexp? (car s)) (sexp? (cdr s)))
  (null? s)))

This works fine, and I can use it in an assert. 

Should I just drop this on my students, or is there an existing s-expression 
checking predicate that I can use?

Apologies if I’m just not looking hard enough! 

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.


[racket-users] interesting reproducible DrR core dump

2017-09-24 Thread 'John Clements' via users-redirect
I haven’t finished (or really even started) minimizing this yet, but I’m 
getting a reproducible core dump in DrRacket when running one of my grading 
scripts. It seems to be related to the top level; specifically, to trigger the 
crash, I have to run in DrRacket and then call a particular top-level function. 
Putting the call to the function inside the module doesn’t trigger the crash. 
Also, the crash log suggests that it’s crashing in a call to "cwd_check + 82 
(file.c:4963)”.

Anyhow, this is strictly preliminary; the problem currently involves a tangled 
web of dozens of files, so I’m just posting this (and the attached crash log) 
in case something jumps right out. I’ll try to narrow this down today or 
tomorrow.

Best,

John Clements



-- 
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.


crash-log
Description: Binary data


Re: [racket-users] tabular text display

2017-09-23 Thread 'John Clements' via users-redirect

> On Sep 23, 2017, at 12:24, 'John Clements' via users-redirect 
> <us...@plt-scheme.org> wrote:
> 
>> 
>> On Sep 23, 2017, at 12:02, Laurent <laurent.ors...@gmail.com> wrote:
>> 
>> Okay, I made a stand-alone package called 'text-table', uploaded on the pkg 
>> server.
>> 
>> Readme here: https://github.com/Metaxal/text-table/blob/master/README.md
>> 
>> Needs more doc, but it should be rather self-explanatory, in particular if 
>> you try 'racket -l text-table' to see the output of the main example.
> 
> Awesome! You’ve saved me hours.

One simple thing: could you add the tags “tabular” and maybe also “format” or 
“text”? I’m afraid that in its current form, I wouldn’t have found this package 
when searching for it.

John

> 
> (Translation: Darn! Now I have to get real work done rather than yak-shaving 
> on this sub-project…)
> 
> Thanks again!
> 
> John
> 
>> 
>> On Fri, Sep 22, 2017 at 9:50 AM, Laurent <laurent.ors...@gmail.com> wrote:
>> There's something like that buried in my bazaar package, maybe it's 
>> sufficient for your needs:
>> https://github.com/Metaxal/bazaar/blob/master/text-table.rkt
>> 
>> The main submodule prints the examples.
>> 
>> It provides two ways to output tables. The first one 'table->string' is the 
>> simplest one and the example outputs:
>> 
>>  a │   b │c │  d │ e │  f │  g │h
>> ——
>> 123 │ 456 │   77 │ 54 │ 1 │ 5646547987 │ 41 │1
>> ——
>> 111 │  22 │  │ 44 │ 5 │  6 │  7 │ 
>> 
>> The second one is more tweakable but more complicated and the example 
>> produces:
>> ╔╦╦╦╗
>> ║i   ║║f1  ║f2  ║
>> ╠╬╬╬╣
>> ╠════╬╬════╬╣
>> ║a   ║║b   ║c   ║
>> ╠╬╬╬╣
>> ║x   ║║y   ║z   ║
>> ╚╩╩╩╝
>> 
>> If I had time I would merge the two and make it both simple and tweakable...
>> 
>> On Fri, Sep 22, 2017 at 7:07 AM, 'John Clements' via users-redirect 
>> <us...@plt-scheme.org> wrote:
>> 
>>> On Sep 21, 2017, at 16:10, Jay McCarthy <jay.mccar...@gmail.com> wrote:
>>> 
>>> `raco pkg show` implements something very close that you could turn
>>> into a library
>>> 
>>> https://github.com/racket/racket/blob/master/racket/collects/pkg/private/show.rkt#L102
>> 
>> Ah! Nice!
>> 
>> John
>> 
>>> 
>>> On Thu, Sep 21, 2017 at 5:03 PM, 'John Clements' via users-redirect
>>> <us...@plt-scheme.org> wrote:
>>>> Before I go re-inventing the wheel, I want to ask you folks: has anyone 
>>>> written a library that prints out tabular data in a textual format?
>>>> 
>>>> E.G: given
>>>> 
>>>> ‘((“a” “bcd” “ef”) (“gh” “hhu.thnt” “t”)
>>>> 
>>>> returns
>>>> 
>>>> "
>>>> --
>>>> | a  | bcd  | ef |
>>>> | gh | hhu.thnt | t  |
>>>> ———
>>>> “
>>>> 
>>>> (sorry about the horrible damage that Apple Mail inflicts upon this 
>>>> message.)
>>>> 
>>>> … in the style of postgresql and similar display engines?
>>>> 
>>>> It’s easy to write one of these, but if someone else has done it, it will 
>>>> probably have nice bells and whistles that mine won’t.
>>>> 
>>>> 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.
>>> 
>>> 
>>> 
>>> --
>>> -=[ Jay McCarthy   http://jeapostrophe.github.io]=-
>>> -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
>>> -=[ Moses 1:33: And worlds without number have I created; ]=-
>>> 
>>> --
>>> 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.
>> 
>> 
> 
> 
> 
> -- 
> 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] tabular text display

2017-09-23 Thread 'John Clements' via users-redirect

> On Sep 23, 2017, at 12:02, Laurent <laurent.ors...@gmail.com> wrote:
> 
> Okay, I made a stand-alone package called 'text-table', uploaded on the pkg 
> server.
> 
> Readme here: https://github.com/Metaxal/text-table/blob/master/README.md
> 
> Needs more doc, but it should be rather self-explanatory, in particular if 
> you try 'racket -l text-table' to see the output of the main example.

Awesome! You’ve saved me hours.

(Translation: Darn! Now I have to get real work done rather than yak-shaving on 
this sub-project…)

Thanks again!

John

> 
> On Fri, Sep 22, 2017 at 9:50 AM, Laurent <laurent.ors...@gmail.com> wrote:
> There's something like that buried in my bazaar package, maybe it's 
> sufficient for your needs:
> https://github.com/Metaxal/bazaar/blob/master/text-table.rkt
> 
> The main submodule prints the examples.
> 
> It provides two ways to output tables. The first one 'table->string' is the 
> simplest one and the example outputs:
> 
>   a │   b │c │  d │ e │  f │  g │h
> ——
> 123 │ 456 │   77 │ 54 │ 1 │ 5646547987 │ 41 │1
> ——
> 111 │  22 │  │ 44 │ 5 │  6 │  7 │ 
> 
> The second one is more tweakable but more complicated and the example 
> produces:
> ╔╦╦╦╗
> ║i   ║║f1  ║f2  ║
> ╠╬╬╬╣
> ╠╬╬╬╣
> ║a   ║║b   ║c   ║
> ╠╬╬╬╣
> ║x   ║║y   ║z   ║
> ╚╩╩╩╝
> 
> If I had time I would merge the two and make it both simple and tweakable...
> 
> On Fri, Sep 22, 2017 at 7:07 AM, 'John Clements' via users-redirect 
> <us...@plt-scheme.org> wrote:
> 
> > On Sep 21, 2017, at 16:10, Jay McCarthy <jay.mccar...@gmail.com> wrote:
> >
> > `raco pkg show` implements something very close that you could turn
> > into a library
> >
> > https://github.com/racket/racket/blob/master/racket/collects/pkg/private/show.rkt#L102
> 
> Ah! Nice!
> 
> John
> 
> >
> > On Thu, Sep 21, 2017 at 5:03 PM, 'John Clements' via users-redirect
> > <us...@plt-scheme.org> wrote:
> >> Before I go re-inventing the wheel, I want to ask you folks: has anyone 
> >> written a library that prints out tabular data in a textual format?
> >>
> >> E.G: given
> >>
> >> ‘((“a” “bcd” “ef”) (“gh” “hhu.thnt” “t”)
> >>
> >> returns
> >>
> >> "
> >> --
> >> | a  | bcd  | ef |
> >> | gh | hhu.thnt | t  |
> >> ———
> >> “
> >>
> >> (sorry about the horrible damage that Apple Mail inflicts upon this 
> >> message.)
> >>
> >> … in the style of postgresql and similar display engines?
> >>
> >> It’s easy to write one of these, but if someone else has done it, it will 
> >> probably have nice bells and whistles that mine won’t.
> >>
> >> 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.
> >
> >
> >
> > --
> > -=[ Jay McCarthy   http://jeapostrophe.github.io]=-
> > -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
> > -=[ Moses 1:33: And worlds without number have I created; ]=-
> >
> > --
> > 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.
> 
> 



-- 
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] tabular text display

2017-09-22 Thread 'John Clements' via users-redirect

> On Sep 21, 2017, at 16:10, Jay McCarthy <jay.mccar...@gmail.com> wrote:
> 
> `raco pkg show` implements something very close that you could turn
> into a library
> 
> https://github.com/racket/racket/blob/master/racket/collects/pkg/private/show.rkt#L102

Ah! Nice!

John

> 
> On Thu, Sep 21, 2017 at 5:03 PM, 'John Clements' via users-redirect
> <us...@plt-scheme.org> wrote:
>> Before I go re-inventing the wheel, I want to ask you folks: has anyone 
>> written a library that prints out tabular data in a textual format?
>> 
>> E.G: given
>> 
>> ‘((“a” “bcd” “ef”) (“gh” “hhu.thnt” “t”)
>> 
>> returns
>> 
>> "
>> --
>> | a  | bcd  | ef |
>> | gh | hhu.thnt | t  |
>> ———
>> “
>> 
>> (sorry about the horrible damage that Apple Mail inflicts upon this message.)
>> 
>> … in the style of postgresql and similar display engines?
>> 
>> It’s easy to write one of these, but if someone else has done it, it will 
>> probably have nice bells and whistles that mine won’t.
>> 
>> 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.
> 
> 
> 
> -- 
> -=[ Jay McCarthy   http://jeapostrophe.github.io]=-
> -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
> -=[ Moses 1:33: And worlds without number have I created; ]=-
> 
> -- 
> 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] tabular text display

2017-09-21 Thread 'John Clements' via users-redirect
Before I go re-inventing the wheel, I want to ask you folks: has anyone written 
a library that prints out tabular data in a textual format?

E.G: given 

‘((“a” “bcd” “ef”) (“gh” “hhu.thnt” “t”)

returns

"
--
| a  | bcd  | ef |
| gh | hhu.thnt | t  |
———
“

(sorry about the horrible damage that Apple Mail inflicts upon this message.)

… in the style of postgresql and similar display engines?

It’s easy to write one of these, but if someone else has done it, it will 
probably have nice bells and whistles that mine won’t.

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.


Re: [racket-users] TR for fast manipulation of C data

2017-09-18 Thread 'John Clements' via users-redirect

> On Sep 18, 2017, at 4:52 AM, Sam Tobin-Hochstadt <sa...@cs.indiana.edu> wrote:
> 
> Just so you know, typed/racket/no-check is not a typed language -- everything 
> is turned off except the syntax.

Right; I wanted to try disabling contract checking per Robby’s suggestion, and 
I figured that no-check would accomplish that; I realize that it’s a 
"what’s-the-upper-limit-on-this" measure, not a long-term solution.

John

> 
> Sam
> 
> On Sep 18, 2017 1:38 AM, "'John Clements' via users-redirect" 
> <us...@plt-scheme.org> wrote:
> Thanks to all of you; with casts changed to asserts, the use of unsafe-vector 
> primitives, and changing the language to /no-check (which, if I’m 
> understanding correctly, will disable contract checking as Robby suggests), 
> resampling 15 seconds of audio goes from 1.2 seconds at the command line to 
> 0.24 seconds, about 5x faster. That means about 1 second per minute, which 
> essentially changes the time from “why is my computer taking forever to load 
> this song” down to “oh, that’s not as snappy as it could be,” which is a vast 
> improvement.
> 
> Also, thinking about it harder, there’s no type in TR that corresponds to a 
> signed 16-bit integer, so the type system isn’t going to have the tools to 
> eliminate the range check anyhow; I have to go for the unsafe one if I want 
> to avoid that check.
> 
> Finally, *many* thanks for the clarification on the difference between cast 
> and assert. Like Phil, I’m surprised that the cast can’t be optimized to the 
> assert in the common case of the flat types, but I’ve discovered many times 
> with TR that there are corner cases that I’m not thinking of.
> 
> Best,
> 
> John Clements
> 
> 
> > On Sep 17, 2017, at 21:16, Phil Nguyen <philnguyen0...@gmail.com> wrote:
> >
> > Each call in the program shrinked from ~20s to ~0.4s on my computer if I 
> > replaced all the casts with asserts. Given there's a correspondence between 
> > the two for base types, I wonder if existing gradually typed programs would 
> > benefit just from a more optimized expansion of `cast`.
> >
> > On Sun, Sep 17, 2017 at 9:39 PM, Sam Tobin-Hochstadt <sa...@cs.indiana.edu> 
> > wrote:
> > `cast` uses the contract system, which is harder for the compiler to 
> > optimize than `assert` which is just an if. At least that's my initial 
> > impression.
> >
> > Sam
> >
> > On Sep 17, 2017 9:27 PM, "Phil Nguyen" <philnguyen0...@gmail.com> wrote:
> > (and (cast _ Positive-Fixnum) into (assert (assert _ fIxnum?) positive?)). 
> > Somehow these make a huge difference.)
> >
> > On Sun, Sep 17, 2017 at 9:19 PM, Phil Nguyen <philnguyen0...@gmail.com> 
> > wrote:
> > Simply changing all the casts (cast _ Natural) into (assert _ 
> > exact-nonnegative-integer?), and (cast _ Positive-Flonum) into (assert 
> > (assert _ flonum?) positive?) speeds up significantly for me.
> >
> > On Sun, Sep 17, 2017 at 9:11 PM, Robby Findler 
> > <ro...@eecs.northwestern.edu> wrote:
> > Maybe a first step is to just (unsafely) disable the contract checking
> > in order to see what the upper-limit of the improvement is.
> >
> > Robby
> >
> >
> > On Sun, Sep 17, 2017 at 8:07 PM, 'John Clements' via users-redirect
> > <us...@plt-scheme.org> wrote:
> > > I’m currently unhappy with the speed of rsound’s resampling. This is a 
> > > pretty straightforward interpolation operation; if you’re not already 
> > > familiar, imagine mapping an old vector ‘o' of size M onto a new vector 
> > > ’n’ of size N where each point ‘i’ in the new vector is obtained by 
> > > linearly interpolating the two points of the old vector nearest to 
> > > i*(M/N).
> > >
> > > Currently, it takes about 10 seconds to resample 60 seconds of audio, 
> > > which I believe could be much much better. I bet that TR would help a lot 
> > > here, but I’ve been poking around, and I don’t see any typed access to 
> > > s16vectors or cpointers. I’m guessing that importing the ffi/unsafe 
> > > functions with wrappers would be considerably slower...
> > >
> > > … well, I shouldn’t guess. I should try.
> > >
> > > AAGH! Yep, I was right. it goes 7x slower after naive conversion to TR. I 
> > > could probably do better by working with the optimization coach, but I’m 
> > > guessing that interposing the contract boundary on every read and write 
> > > to the s16vector is a big slowdown that could easily be avoided. So: is 
> > > there a good way to use TR for access to cp

Re: [racket-users] TR for fast manipulation of C data

2017-09-17 Thread 'John Clements' via users-redirect
Thanks to all of you; with casts changed to asserts, the use of unsafe-vector 
primitives, and changing the language to /no-check (which, if I’m understanding 
correctly, will disable contract checking as Robby suggests), resampling 15 
seconds of audio goes from 1.2 seconds at the command line to 0.24 seconds, 
about 5x faster. That means about 1 second per minute, which essentially 
changes the time from “why is my computer taking forever to load this song” 
down to “oh, that’s not as snappy as it could be,” which is a vast improvement.

Also, thinking about it harder, there’s no type in TR that corresponds to a 
signed 16-bit integer, so the type system isn’t going to have the tools to 
eliminate the range check anyhow; I have to go for the unsafe one if I want to 
avoid that check.

Finally, *many* thanks for the clarification on the difference between cast and 
assert. Like Phil, I’m surprised that the cast can’t be optimized to the assert 
in the common case of the flat types, but I’ve discovered many times with TR 
that there are corner cases that I’m not thinking of.

Best,

John Clements


> On Sep 17, 2017, at 21:16, Phil Nguyen <philnguyen0...@gmail.com> wrote:
> 
> Each call in the program shrinked from ~20s to ~0.4s on my computer if I 
> replaced all the casts with asserts. Given there's a correspondence between 
> the two for base types, I wonder if existing gradually typed programs would 
> benefit just from a more optimized expansion of `cast`.
> 
> On Sun, Sep 17, 2017 at 9:39 PM, Sam Tobin-Hochstadt <sa...@cs.indiana.edu> 
> wrote:
> `cast` uses the contract system, which is harder for the compiler to optimize 
> than `assert` which is just an if. At least that's my initial impression.
> 
> Sam
> 
> On Sep 17, 2017 9:27 PM, "Phil Nguyen" <philnguyen0...@gmail.com> wrote:
> (and (cast _ Positive-Fixnum) into (assert (assert _ fIxnum?) positive?)). 
> Somehow these make a huge difference.)
> 
> On Sun, Sep 17, 2017 at 9:19 PM, Phil Nguyen <philnguyen0...@gmail.com> wrote:
> Simply changing all the casts (cast _ Natural) into (assert _ 
> exact-nonnegative-integer?), and (cast _ Positive-Flonum) into (assert 
> (assert _ flonum?) positive?) speeds up significantly for me.
> 
> On Sun, Sep 17, 2017 at 9:11 PM, Robby Findler <ro...@eecs.northwestern.edu> 
> wrote:
> Maybe a first step is to just (unsafely) disable the contract checking
> in order to see what the upper-limit of the improvement is.
> 
> Robby
> 
> 
> On Sun, Sep 17, 2017 at 8:07 PM, 'John Clements' via users-redirect
> <us...@plt-scheme.org> wrote:
> > I’m currently unhappy with the speed of rsound’s resampling. This is a 
> > pretty straightforward interpolation operation; if you’re not already 
> > familiar, imagine mapping an old vector ‘o' of size M onto a new vector ’n’ 
> > of size N where each point ‘i’ in the new vector is obtained by linearly 
> > interpolating the two points of the old vector nearest to i*(M/N).
> >
> > Currently, it takes about 10 seconds to resample 60 seconds of audio, which 
> > I believe could be much much better. I bet that TR would help a lot here, 
> > but I’ve been poking around, and I don’t see any typed access to s16vectors 
> > or cpointers. I’m guessing that importing the ffi/unsafe functions with 
> > wrappers would be considerably slower...
> >
> > … well, I shouldn’t guess. I should try.
> >
> > AAGH! Yep, I was right. it goes 7x slower after naive conversion to TR. I 
> > could probably do better by working with the optimization coach, but I’m 
> > guessing that interposing the contract boundary on every read and write to 
> > the s16vector is a big slowdown that could easily be avoided. So: is there 
> > a good way to use TR for access to cpointers?
> >
> > I’ve attached the code in case anyone wants to see it; I don’t really care 
> > about the first call to (time …); it’s appallingly slow (20x slower in TR), 
> > but that’s not the part I’m trying to speed up. It’s the second call to 
> > (time…), around
> > the resample call.
> >
> > 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.
> 
> --
> 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

[racket-users] TR for fast manipulation of C data

2017-09-17 Thread 'John Clements' via users-redirect
I’m currently unhappy with the speed of rsound’s resampling. This is a pretty 
straightforward interpolation operation; if you’re not already familiar, 
imagine mapping an old vector ‘o' of size M onto a new vector ’n’ of size N 
where each point ‘i’ in the new vector is obtained by linearly interpolating 
the two points of the old vector nearest to i*(M/N).

Currently, it takes about 10 seconds to resample 60 seconds of audio, which I 
believe could be much much better. I bet that TR would help a lot here, but 
I’ve been poking around, and I don’t see any typed access to s16vectors or 
cpointers. I’m guessing that importing the ffi/unsafe functions with wrappers 
would be considerably slower...

… well, I shouldn’t guess. I should try.

AAGH! Yep, I was right. it goes 7x slower after naive conversion to TR. I could 
probably do better by working with the optimization coach, but I’m guessing 
that interposing the contract boundary on every read and write to the s16vector 
is a big slowdown that could easily be avoided. So: is there a good way to use 
TR for access to cpointers?

I’ve attached the code in case anyone wants to see it; I don’t really care 
about the first call to (time …); it’s appallingly slow (20x slower in TR), but 
that’s not the part I’m trying to speed up. It’s the second call to (time…), 
around
the resample call.

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.


check-resample-speed.rkt
Description: Binary data


Re: [racket-users] Testing #langs

2017-06-29 Thread 'John Clements' via users-redirect

> On Jun 29, 2017, at 09:08, Sam Waxman <samwax...@gmail.com> wrote:
> 
> On Thursday, June 29, 2017 at 11:49:49 AM UTC-4, 'John Clements' via 
> users-redirect wrote:
>> Oops forgot to cc: list
>> 
>>> On Jun 29, 2017, at 08:49, John Clements <cleme...@brinckerhoff.org> wrote:
>>> 
>>>> 
>>>> On Jun 29, 2017, at 08:30, Sam Waxman <samwax...@gmail.com> wrote:
>>>> 
>>>> Hey all,
>>>> 
>>>> I've been running into a lot of major roadblocks when it comes to writing 
>>>> good tests for some #langs that I've made, for a number of reasons.
>>>> 
>>>> Ideally, I want a function called
>>>> (check-eq-program? "program1" "program2")
>>>> That will run each program in a fresh module of my #lang, check what gets 
>>>> printed out, and compare them for equality.
>>>> 
>>>> I'm not quite sure how to write a function that creates and runs code in a 
>>>> fresh module though.
>>>> 
>>>> The fresh module is necessary for a number of reasons: If all of the 
>>>> programs worked in the same module, they would occasionally interfere with 
>>>> each other, as the #%module-begin's some of my #langs have initialize some 
>>>> "global variables" that need to be fresh/reinitialized every time a new 
>>>> program runs.
>>>> 
>>>> Some languages also work with continuations, and if they all ran in one 
>>>> module, would alter control flow so that only one program could ever run 
>>>> (they have aborts in odd places).
>>>> 
>>>> Ideally, the tests could be run in #lang racket instead of my own 
>>>> languages, so that the tests wouldn't be part of my language, so it 
>>>> probably makes sense that check-eq-program would have to take in a third 
>>>> argument for the language to use
>>>> 
>>>> (check-eq-program prog1 prog2 lang) Rackunit sadly does not seem to have 
>>>> anything good for these kinds of tests.
>>>> 
>>>> Can anyone offer some guidance on how to write a function like this, or if 
>>>> there's an easier way to go about this?
>>> 
>>> I think this may be a great deal easier than you think… or maybe impossible.
>>> 
>>> Specifically: the basic idea behind racket’s #lang mechanism is that a 
>>> program is known to be in a particular language when it’s written. For this 
>>> reason, your `check-eq-program` form doesn’t make sense, because the 
>>> programs you’re testing will already be written in a fixed language.
>>> 
>>> I’m a bit confused by your terminology when you say “if all of the programs 
>>> worked in the same module"; specifically, a #lang declaration expands into 
>>> a module, so it’s more or less impossible to write a function in a 
>>> different #lang that isn’t in its own module.
>>> 
>>> The easy case: if your two programs are written as modules, and each one 
>>> has an entry point—a (main) function, perhaps—it sounds like it would be 
>>> sufficient simply to parameterize (current-output-port) to capture the 
>>> output and then call the corresponding function. If not, then you could 
>>> potentially use some combination of (make-namespace-anchor) and (eval)… but 
>>> my humble opinion is that in this case … it would be easier simply to 
>>> create a (main) function as a wrapper. 
>>> 
>>> Apologies if what I’m saying doesn’t make sense; I would also encourage you 
>>> to create a small example, to clarify what you’re asking. 
>>> 
>>> John
> 
> Hey, thanks for the response. To clear up what I'm saying a bit,
> 
> Let's say that one of my languages has a global variable called 
> "NumberFuncsDefined", and every time I define a function in my language, it 
> increments by one. I want to check if the two programs
> 
> "(define (f) 1)
> NumberFuncsDefined"
> 
> and
> "(define (g) 2)
> NumberFuncsDefined"
> 
> result in the same thing, so I write
> 
> (check-eq-program 
>[(define (f) 1) NumberFuncsDefined)]
>[(define (g) 2) NumberFuncsDefined)])
> 
> I want this to return true, because both programs defined one function, so 
> both programs should return 1 in my language. If they're working in the same 
> module though (instead of two fresh copies of the module), the first program 
> will increment NumberFuncsDefined, then the second program will be in t

Re: [racket-users] Testing #langs

2017-06-29 Thread 'John Clements' via users-redirect
Oops forgot to cc: list

> On Jun 29, 2017, at 08:49, John Clements  wrote:
> 
>> 
>> On Jun 29, 2017, at 08:30, Sam Waxman  wrote:
>> 
>> Hey all,
>> 
>> I've been running into a lot of major roadblocks when it comes to writing 
>> good tests for some #langs that I've made, for a number of reasons.
>> 
>> Ideally, I want a function called
>> (check-eq-program? "program1" "program2")
>> That will run each program in a fresh module of my #lang, check what gets 
>> printed out, and compare them for equality.
>> 
>> I'm not quite sure how to write a function that creates and runs code in a 
>> fresh module though.
>> 
>> The fresh module is necessary for a number of reasons: If all of the 
>> programs worked in the same module, they would occasionally interfere with 
>> each other, as the #%module-begin's some of my #langs have initialize some 
>> "global variables" that need to be fresh/reinitialized every time a new 
>> program runs.
>> 
>> Some languages also work with continuations, and if they all ran in one 
>> module, would alter control flow so that only one program could ever run 
>> (they have aborts in odd places).
>> 
>> Ideally, the tests could be run in #lang racket instead of my own languages, 
>> so that the tests wouldn't be part of my language, so it probably makes 
>> sense that check-eq-program would have to take in a third argument for the 
>> language to use
>> 
>> (check-eq-program prog1 prog2 lang) Rackunit sadly does not seem to have 
>> anything good for these kinds of tests.
>> 
>> Can anyone offer some guidance on how to write a function like this, or if 
>> there's an easier way to go about this?
> 
> I think this may be a great deal easier than you think… or maybe impossible.
> 
> Specifically: the basic idea behind racket’s #lang mechanism is that a 
> program is known to be in a particular language when it’s written. For this 
> reason, your `check-eq-program` form doesn’t make sense, because the programs 
> you’re testing will already be written in a fixed language.
> 
> I’m a bit confused by your terminology when you say “if all of the programs 
> worked in the same module"; specifically, a #lang declaration expands into a 
> module, so it’s more or less impossible to write a function in a different 
> #lang that isn’t in its own module.
> 
> The easy case: if your two programs are written as modules, and each one has 
> an entry point—a (main) function, perhaps—it sounds like it would be 
> sufficient simply to parameterize (current-output-port) to capture the output 
> and then call the corresponding function. If not, then you could potentially 
> use some combination of (make-namespace-anchor) and (eval)… but my humble 
> opinion is that in this case … it would be easier simply to create a (main) 
> function as a wrapper. 
> 
> Apologies if what I’m saying doesn’t make sense; I would also encourage you 
> to create a small example, to clarify what you’re asking. 
> 
> 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.


Re: [racket-users] GLPK: how many chickens to invite to your picnic?

2017-06-23 Thread 'John Clements' via users-redirect

> On Jun 23, 2017, at 10:25, Robby Findler <ro...@eecs.northwestern.edu> wrote:
> 
> Docs link with examples? :)

But of course!

http://docs.racket-lang.org/glpk/index.html

John

> 
> On Fri, Jun 23, 2017 at 1:13 PM 'John Clements' via users-redirect 
> <us...@plt-scheme.org> wrote:
> Doing some operations research in Racket? Frustrated by the lack of linear 
> programming libraries? Well, be frustrated no more!
> 
> Actually, this is just a package announcement: I built a nice clean 
> one-function interface to GLPK, the Gnu Linear Programming Kit, allowing 
> primal simplex to do optimization on linear functions subject to linear 
> constraints on variables with arbitrary bounds. Hope it’s useful!
> 
> John Clements
> 
> 
> 
> --
> 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] GLPK: how many chickens to invite to your picnic?

2017-06-23 Thread 'John Clements' via users-redirect
Doing some operations research in Racket? Frustrated by the lack of linear 
programming libraries? Well, be frustrated no more!

Actually, this is just a package announcement: I built a nice clean 
one-function interface to GLPK, the Gnu Linear Programming Kit, allowing primal 
simplex to do optimization on linear functions subject to linear constraints on 
variables with arbitrary bounds. Hope it’s useful!

John Clements



-- 
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] immutable hash table references?

2017-05-24 Thread 'John Clements' via users-redirect
I’m introducing hash tables to students in a first-year class. Is there a handy 
reference for the implementation of immutable hash tables? Is this in Okasaki?

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.


Re: [racket-users] Given any list, group n number of sublists into a single list

2017-05-19 Thread 'John Clements' via users-redirect
Sugar looks great; I just reimplemented your ‘filter-split’ for about the 
seventeenth time yesterday while breaking a text file into paragraphs.

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.


Re: [racket-users] ->i applies contract projections multiple times?

2016-12-15 Thread 'John Clements' via users-redirect

> On Dec 14, 2016, at 3:56 PM, Scott Moore  wrote:
> 
> Robby beat me to it. For a longer discussion, see Christos, Robby, Cormac and 
> Matthias’ paper: http://www.ccs.neu.edu/racket/pubs/popl11-dfff.pdf on the 
> difference between dependent (->d) and indy-dependent contracts (->i).
> 
> A contrived example of why this is better is:
> (define/contract (foo x y)
>   (->d ([x (λ (x) (y ‘evil) #t)]
> [y (-> integer? integer?)])
>[result any/c])
>   void)
> 
> (foo 0 (λ (x) (+ x 1)))
> 
> > +: contract violation   !!! Whoops, but I promised to only call y with 
> > integers!
>   expected: number?
>   given: 'evil
>   argument position: 1st
>   other arguments…:
> vs:
> 
> (define/contract (foo x y)
>   (->i ([x (y) (λ (x) (y 'evil) #t)]
> [y (-> integer? integer?)])
>[result any/c])
>   void)
> 
> (foo 0 (λ (x) (+ x 1)))
> 
> foo: broke its own contract  !!! Much better :)
>   promised: integer?
>   produced: 'evil
>   in: the 1st argument of
>   the y argument of
>   (->i
>((x (y) (λ (x) (y 'evil) #t))
> (y (-> integer? integer?)))
>(result any/c))
>   contract from: anonymous-module
>   blaming: anonymous-module
>(assuming the contract is correct)
>   at: unsaved-editor:3.18

Nice example. Just the right size to read and understand. Many 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.


Re: [racket-users] DSL to C code generation with symbolic computations en route

2016-04-19 Thread 'John Clements' via users-redirect

> On Apr 19, 2016, at 3:18 PM, Hendrik Boom  wrote:
> 
> On Mon, Apr 18, 2016 at 08:04:32PM +0200, Jerzy Karczmarczuk wrote:
>> Dmitry Pavlov wants "adult" numerics in Racket, and he adds:
>> 
>>> - I need to take derivatives of equations that I wrote in my DSL,
>>> symbolically, and have them converted to C too.
>> 
>> And then, people (Robby Findler and John Clements) mentioned Siskind. Good.
>> 
>> However, you should know that Jeffrey worked NOT on /symbolic/
>> derivatives, but mainly on the "automatic differentiation" stuff;
>> this is numeric, but fast and exact (in the sense: no differential
>> quotient approximations). There is plenty of valuable papers written
>> by Jeffrey and Barak Pearlmutter... (But some are quite difficult).
> 
> I am baffled how you can do differentiation numerically and get it exact.

I think that calling it “numeric” may call to mind something that is not exact 
(e.g., choose a small dx, take two nearby values, divide the difference by dx). 
This is definitely not exact.  Automatic differentiation—and be forewarned, I’m 
going to biff some important detail or other—is instead an algorithm that 
computes the same answer as symbolic differentiation without having to take the 
extra step of actually constructing the formula. I think, however, that it is 
“morally equivalent” to symbolic differentiation.

So, for instance, suppose you’re computing 3x^2+x. This might involve 
multiplying 3 by x by x and adding x. Suppose further that x=4. Automatic 
differentiation associates with each term computation a side computation that 
represents the derivative of that term, using an inductive computation. In this 
example, we start by multiplying 3 by x. If we know that the derivative of 3 is 
0 and the derivative of x is 1 (we’re using the inductive hypothesis here), 
then for not much more than the cost of multiplying 3 by x we can also have (3 
* 1)+(0 * 4), so we now know that the value of this term is 12 and that the 
derivative of this term is 3, and we’re ready for the next inductive step.

Can I now just say “et cetera” ?

I believe these are the basic ideas behind automatic differentiation.

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


Re: [racket-users] DSL to C code generation with symbolic computations en route

2016-04-18 Thread 'John Clements' via users-redirect

> On Apr 18, 2016, at 10:29 AM, Robby Findler  
> wrote:
> 
> I'm not sure if there is anything in Racketdom that will serve your
> needs, but if you do end up with the "implement it" plan, do be sure
> to check out Jeff Siskin's work on program analysis for the purposes
> of differentiation. He makes some whole-program assumptions (that
> sound reasonable for you too) and gets great mileage out it.

Only because it might matter for search results: ITYM “Jeff Siskind". The 
Stalin guy, right?

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.


Re: [racket-users] mode-lambda example doesn't work?

2016-04-06 Thread 'John Clements' via users-redirect

> On Apr 6, 2016, at 2:43 AM, Jay McCarthy  wrote:
> 
> Hi John,
> 
> I'd like to debug the glClear error with you. I'll have to look up the error 
> to figure out where to go on it though, so I'll get back to you.
> 
> However, the screen you see is expected. The demo has a few modes and the 
> default is the text display mode and it is showing that it can display 
> unicode characters overlay'd on each other. Your characters look different 
> than mine, but I assume that is because you do not have the default font, 
> which is Matthew Butterick's Triplicate T4c (the only font I use on my 
> system). If you press various keys, the mode will change:
> 
> r - display a set of random sprites at random spins/etc with half in static 
> positions (optimized) and half moving dynamically
> g - display a small set of sprites in a uniform grid
> b - display a visually pleasing example involving little blocks
> t - display a single sprite inside of a tiled layer (the screen looks like it 
> has many sprites, but really it is just one)
> w - display a few sprites that are wrapped around the edges of a torus-like 
> layer (each color sprite is actually there once but is wrapped around the 
> edges)
> x - display characters (default)
> 
> The most interesting mode is b and while it is active you can press 's' to 
> induce vomiting mode where the mode-7 effect is enabled.

Ah! okay, these all worked fine. maybe a comment at the top?

FWIW, I also notice exactly the same problem that I reported earlier when using 
2htdp; on a long-running DrR process, swirling the mouse while the program is 
running reduces the frame rate.

In particular, in this case, it reduces it… to zero. In fact, the FPS 
computation in the title bar also disappears. As soon as the mouse stops 
moving, the motion begins again. As with the other report, the problem doesn’t 
appear to exist at the command-line—but then, running at the command-line is 
pretty much guaranteed not to give rise to a long-running process. As with the 
other problem I reported, restarting DrRacket makes the problem go away.

Hmm…

John

> 
> So please go through the various modes to see if they all work and if you 
> just want to see something vaguely pretty, check out b then s.
> 
> Jay
> 
> 
> On Wed, Apr 6, 2016 at 12:01 AM, John Clements  
> wrote:
> I want a sprite library, and it looks like mode-lambda is the obvious choice. 
> However, when I try to run the “one.rkt” example that’s a part of 
> mode-lambda, I get a screen with no motion that looks a bit like garbage 
> (though with live frame rate figures), and this text in the definitions 
> window:
> 
> Welcome to DrRacket, version 6.4.0.15--2016-03-29(-/f) [3m].
> Language: racket/base, with debugging; memory limit: 512 MB.
> You are using OpenGL (4 1)
> '#(#(416.0 234.0) #(1.0 1.0) #(416.0 234.0) #(416.0 234.0) #(800.0 578.0))
> . . ../backend/gl.rkt:281:9: OpenGL error in procedure glClear: Error code 
> 1286.
> 
> Any idea what’s going on? I’m assuming this isn’t the intended behavior. This 
> is on a "MacBook Pro (Retina, 13-inch, Early 2015)", running OS X 10.11.4 
> with a "Intel Iris Graphics 6100 1536 MB” card.
> 
> John
> 
> Here’s a screenshot of what I see in the opened window:
> 
> 
> 
> 
> 
> -- 
> 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.



-- 
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 not W^X?

2016-04-04 Thread 'John Clements' via users-redirect

> On Apr 2, 2016, at 1:40 PM, Jos Koot  wrote:
> 
> A compiler produces code (in this phase data) that can be executed.
> Babbage started with a machine that made distinction between program and
> data.
> In a Von Neuman machine there is no distinction between data and programs.
> In lambda calculus neither.
> Say you have a program that allows the user to answer questions
> and assume the program behaves differently depending on the answers.
> Are the answers just data or do they form a program?
> Executable code can be data and reversely.
> What do you want your computer to do when ordering it to copy a program?
> What should DrRacket do when you ask it to prepare an executable file?
> Although in general it is wise to make a distinction between program and
> data,
> ultimately enforcing this distinction would prohibit avanced programs.
> My 2 (or may be only 1) cents.
> Jos

FWIW, it appears that the restriction here is much simpler; specifically, pages 
can’t be writable and executable *simultaneously.* Moreover, a comment by 
Matthew on the github bug suggests that this might … have a relatively 
straightforward fix?

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.


Re: [racket-users] reaching connection pool limit on connection pool with +inf.0 limit?

2016-01-26 Thread 'John Clements' via users-redirect

> On Jan 25, 2016, at 5:51 PM, Greg Williams <gwilliam...@gmail.com> wrote:
> 
> On Saturday, April 25, 2015 at 3:12:20 PM UTC-7, 'John Clements' via 
> users-redirect wrote:
>> I have a long-running racket server that’s connecting to a MySQL back end. 
>> It has a connection pool wrapped in a virtual connection, created like this:
>> 
>> ;; create a connection to the database
>> (define conn 
>>  (virtual-connection
>>   (connection-pool
>>(lambda ()
>>  (mysql-connect #:database "sodec2"
>> #:user "clements"
>> #:password “redacted"
>> #:socket mysql-socket)
>> 
>> When this server is running, it periodically produces errors of this form:
>> 
>> connection-pool-lease: connection-pool-limit reached
>> 
>> My reading of the documentation is that the “default” connection pool limit 
>> is +inf.0, which suggests that I shouldn’t be getting this error. 
>> 
>> Is this a bug?
>> 
>> 
>> 
>> Ah, what the heck, lemme ask about my other problem. I’m running this 
>> process with everything at or above ‘warning’ level redirected to syslog, 
>> and I’m a whole lot of these:
>> 
>> System Events
>> =-=-=-=-=-=-=
>> Apr 25 09:02:45 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:02:45 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:02:45 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:02:45 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:02:46 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:02:46 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:03:45 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:03:45 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:03:50 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:03:50 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:03:50 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:03:50 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:03:50 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:04:49 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:04:50 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:04:50 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:04:50 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:04:50 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:04:50 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:05:50 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:05:50 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:05:50 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:05:50 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:05:50 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:05:50 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:06:50 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:06:54 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:06:54 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:06:54 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:06:54 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> Apr 25 09:06:54 linode racket: epoll error at remove: Bad file descriptor; 
>> errno=9
>> ….
>> 
>> This continues for sometimes hours at a time. I just spent five minutes 
>> reading the epoll documentation, and it sounds like … maybe a select() on a 
>> fd that’s already closed? 
>> 
>> John
> 
> Did you ever figure out the "Bad file descriptor" issue? I'm seeing this 
> issue now and haven't been able to figure out what's causing it.


Nope, never did. Just put up with it. I’d love to know, though….

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.


Re: [racket-users] Evaluating whatever expression halfway a debugging session

2015-11-04 Thread 'John Clements' via users-redirect
First, apologies for bouncing this back to the list, hope that’s okay…
=
> On Nov 4, 2015, at 2:20 AM, Marco Faustinelli  
> wrote:
> 
> 
> What I definitely AM missing (I can't see why you contradict my personal 
> statement at the same time you are actually taking it into consideration :-) 
> is the educational value of being able to "see" the code contained in a 
> continuation, which is the core problem of whoever approaches call/cc.
> 
> myCont = (lambda(_) ...)
> 
> As the stepper is there for educational purposes, this is something that 
> would be spot-on with its core business; I am ready to believe that a text 
> dump of the code contained in the continuation is not easy to achieve (I 
> assume that the code has been interpreted on the fly into a tree or 
> something).

Forgive me; I didn’t mean to suggest that it wouldn’t be educational. It would.

> 
> But I see that the stepper is very good at substituting readable expressions. 
> That's the heart of its effectiveness, so there must be a way…

Yep. There’s definitely a way, and if anyone was going to do it, it would 
probably be me :). 

Okay, I just thought about it for five minutes, and here’s what I think:

1) At a very basic level, the stepper is not currently enabled for any of the 
languages that include call/cc. IIRC, the first language that includes call/cc 
is advanced, which also includes mutation. Doing mutation right is kind of a 
bear. You should be able to enable half-baked stepper support in any language 
by setting the “PLTSTEPPERUNSAFE” environment variable.
1a) Okay, I just tried it, and it turns out that call/cc isn’t in Advanced, 
either. This means that you need to try this in full #lang racket, which is 
really not a language where the stepper is going to be too good at rendering.
1b) Hmm, interesting. I got a bit conservative in the 6.3 release, and 
currently PLTSTEPPERUNSAFE works for advanced but not for full #lang racket. 
I’ve just made a change that should allow this, but it DEFINITELY WON’T be a 
part of the 6.3 release.
2) You mention that “the stepper is very good at substituting.” In fact, for 
the most part, the stepper doesn’t know anything about substitution; it simply 
observes the computation as it proceeds. This actually turns out to be a big 
win for watching call/cc run; while the existing stepper has no idea how to 
render a continuation, as soon as you step *into* the continuation, the context 
should be correctly displayed. In my opinion, this is about three quarters of 
the way to
understanding call/cc. Maybe I’m looking at the glass as more full than it is 
:).
3) The remaining piece would be to capture the current marks and associate them 
with the continuation. To do this, the stepper would have to know when a 
continuation was being captured. Not impossible, but interesting.
4) Rendering the continuation: this could be horrible, or easy. If you decide 
to try to render the continuation as a legal term in the language, it would be 
a good deal of the work. BUT… if you just deployed the existing mark-rendering 
machinery to render the set of marks as a context, and then put a special 
“kont-box” around it—that is, “this isn’t a legal term in the language, it’s a 
special context term that will replace the existing context if called”—it 
wouldn’t be too hard.
5) This is the unpleasant bullet. I’m at a teaching school, and I’ve got a 
whole bunch of exams to grade.  This isn’t at the top of my list right now, and 
I’m not sure when it will be, especially given that call/cc doesn’t appear in 
Advanced; even if it worked as I suggest, using the stepper for call/cc would 
be like a trip to the jungle: “we’re going in here, to catch a glimpse of the 
jaguar. Whew! Done! Now, let’s retreat back to civilization.”

Best,

John Clements

-- 
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] Evaluating whatever expression halfway a debugging session

2015-11-04 Thread 'John Clements' via users-redirect
Following up on this, here’s a simple test case, written in the stepper’s test 
case language. One amusing UI note: what should be highlighted as the “before” 
of the invocation-of-continuation step? The application of the continuation, or 
the whole program?

;; this is just a sketch...
(t 'call/cc m:mz
   (+ 3 (call/cc (λ (k) (+ 1 (k 2)
   :: (+ 3 {(call/cc (λ (k) (+ 1 (k 2})
   ;; not sure what KONT-REP should be...
   -> (+ 3 (+ 1 ({KONT-REP} 2)))
   ;; interesting how the highlight falls apart... what should be highlighted?
   :: {(+ 1 (KONT-REP 2))}
   -> {(+ 3 2)}
   -> 5)

John

> On Nov 4, 2015, at 9:02 AM, 'John Clements' via users-redirect 
> <us...@plt-scheme.org> wrote:
> 
> First, apologies for bouncing this back to the list, hope that’s okay…
> =
>> On Nov 4, 2015, at 2:20 AM, Marco Faustinelli <marco.faustine...@onebip.com> 
>> wrote:
>> 
>> 
>> What I definitely AM missing (I can't see why you contradict my personal 
>> statement at the same time you are actually taking it into consideration :-) 
>> is the educational value of being able to "see" the code contained in a 
>> continuation, which is the core problem of whoever approaches call/cc.
>> 
>> myCont = (lambda(_) ...)
>> 
>> As the stepper is there for educational purposes, this is something that 
>> would be spot-on with its core business; I am ready to believe that a text 
>> dump of the code contained in the continuation is not easy to achieve (I 
>> assume that the code has been interpreted on the fly into a tree or 
>> something).
> 
> Forgive me; I didn’t mean to suggest that it wouldn’t be educational. It 
> would.
> 
>> 
>> But I see that the stepper is very good at substituting readable 
>> expressions. That's the heart of its effectiveness, so there must be a way…
> 
> Yep. There’s definitely a way, and if anyone was going to do it, it would 
> probably be me :). 
> 
> Okay, I just thought about it for five minutes, and here’s what I think:
> 
> 1) At a very basic level, the stepper is not currently enabled for any of the 
> languages that include call/cc. IIRC, the first language that includes 
> call/cc is advanced, which also includes mutation. Doing mutation right is 
> kind of a bear. You should be able to enable half-baked stepper support in 
> any language by setting the “PLTSTEPPERUNSAFE” environment variable.
> 1a) Okay, I just tried it, and it turns out that call/cc isn’t in Advanced, 
> either. This means that you need to try this in full #lang racket, which is 
> really not a language where the stepper is going to be too good at rendering.
> 1b) Hmm, interesting. I got a bit conservative in the 6.3 release, and 
> currently PLTSTEPPERUNSAFE works for advanced but not for full #lang racket. 
> I’ve just made a change that should allow this, but it DEFINITELY WON’T be a 
> part of the 6.3 release.
> 2) You mention that “the stepper is very good at substituting.” In fact, for 
> the most part, the stepper doesn’t know anything about substitution; it 
> simply observes the computation as it proceeds. This actually turns out to be 
> a big win for watching call/cc run; while the existing stepper has no idea 
> how to render a continuation, as soon as you step *into* the continuation, 
> the context should be correctly displayed. In my opinion, this is about three 
> quarters of the way to
> understanding call/cc. Maybe I’m looking at the glass as more full than it is 
> :).
> 3) The remaining piece would be to capture the current marks and associate 
> them with the continuation. To do this, the stepper would have to know when a 
> continuation was being captured. Not impossible, but interesting.
> 4) Rendering the continuation: this could be horrible, or easy. If you decide 
> to try to render the continuation as a legal term in the language, it would 
> be a good deal of the work. BUT… if you just deployed the existing 
> mark-rendering machinery to render the set of marks as a context, and then 
> put a special “kont-box” around it—that is, “this isn’t a legal term in the 
> language, it’s a special context term that will replace the existing context 
> if called”—it wouldn’t be too hard.
> 5) This is the unpleasant bullet. I’m at a teaching school, and I’ve got a 
> whole bunch of exams to grade.  This isn’t at the top of my list right now, 
> and I’m not sure when it will be, especially given that call/cc doesn’t 
> appear in Advanced; even if it worked as I suggest, using the stepper for 
> call/cc would be like a trip to the jungle: “we’re going in here, to catch a 
> glimpse of the jaguar. Whew! Done! Now, let’s retreat back to civilization.”
> 
> Best,
> 
> John Clements
> 
>

[racket-users] must manually delete compiled file for tests/racket/package.rkt ?

2015-07-26 Thread 'John Clements' via users-redirect
I updated my tree today and ran make, and ran into this error:

raco pkg update: packages conflict
  package: compatibility-test
  package: racket-test
  module path: tests/racket/package


I did a little investigating, and sure enough, I can see that while this file 
used to be a part of the racket-test package, it’s now a part of 
compatibility-test. I went into the compiled subdirectory, and manually deleted 
package*.zo, and it looks like things are going fine now, but it seems to me 
that this shouldn’t have happened… should it?

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.


[racket-users] new dependency on scheme-lib for build of rsound?

2015-07-14 Thread 'John Clements' via users-redirect
This is in the “very unimportant” category, but I see that as of today, running 
setup-plt … er … raco setup informs me that

raco setup: undeclared dependency detected
raco setup:   for package: rsound
raco setup:   on package for build:
raco setup:scheme-lib”

It’s perfectly easy to add “scheme-lib” to the build-deps (I’ve already done 
so), but I’m curious—is there an easy way to ferret out the file that’s causing 
this dependency? I did a quick git grep for ‘scheme’, and the only thing I came 
up with was a mention in a shared library I created to 
“scheme_initialize_internal”. This doesn’t seem a likely cause, especially for 
a build-time dependency. Any obvious way to track this down aside from messing 
around with compile-omit-files until the warning goes away?

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.


Re: [racket-users] help please on git/github pull request

2015-07-03 Thread 'John Clements' via users-redirect

 On Jul 3, 2015, at 2:00 AM, Tim Brown tim.br...@cityc.co.uk wrote:
 
 Thanks for the help folks!
 
 I'll take a long hard look at rebasing before I do anything.
 It sounds like something my mother would have advised against.
 
 On 03/07/15 03:52, Alexander D. Knauth wrote:
 On Jul 2, 2015, at 1:53 PM, John Clements cleme...@brinckerhoff.org wrote:
 On Jul 2, 2015, at 7:31 AM, Alexander D. Knauth alexan...@knauth.org 
 wrote:
 After you resolve them you will (I think) need to `git add` the files that 
 you resolved conflicts for, then
 `git rebase --continue`, and then when the rebase is finished, `git push 
 -f origin topic-branch`.
 
 Also, I think you eventually want to get things back onto the
 master branch, right? After rebasing, you should be able to check
 out masteragain, then do a
 
 git merge —ff-only topic-branch
 
 at which point you should be able to push cleanly.
 
 Um, I'm going by Greg Hendershott's advice in his guide for
 infrequent contributors to Racket, but
 wouldn't you not want to do that, because that would mess up the
 master branch and make it a dirty fork?
 
 http://www.greghendershott.com/2013/04/a-guide-for-infrequent-contributors-to-racket.html#waiting-is-the-hardest-part
 
 I'm trying to follow that. I think it's not designed for someone who
 makes a tweak, is sent down the pit for a month and THEN tries to merge
 back into a later master.

As long as other people aren’t changing the code you changed, rebasing should 
be pretty painless; basically, it just applies the changes that you made to the 
updated tree. Conflicts only arise when your (automatically constructed) patch 
don’t apply cleanly.

With that said: yes, git’s model is large and complex.

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.


Re: [racket-users] help please on git/github pull request

2015-07-02 Thread 'John Clements' via users-redirect

 On Jul 2, 2015, at 7:52 PM, Alexander D. Knauth alexan...@knauth.org wrote:
 
 
 On Jul 2, 2015, at 1:53 PM, John Clements cleme...@brinckerhoff.org wrote:
 
 
 On Jul 2, 2015, at 7:31 AM, Alexander D. Knauth alexan...@knauth.org 
 wrote:
 
 After you resolve them you will (I think) need to `git add` the files that 
 you resolved conflicts for, then
 `git rebase --continue`, and then when the rebase is finished, `git push -f 
 origin topic-branch`.
 
 Also, I think you eventually want to get things back onto the master branch, 
 right? After rebasing, you should be able to check out master again, then do 
 a 
 
 git merge —ff-only topic-branch
 
 at which point you should be able to push cleanly.
 
 Um, I'm going by Greg Hendershott's advice in his guide for infrequent 
 contributors to Racket, but
 wouldn't you not want to do that, because that would mess up the master 
 branch and make it a dirty fork?
 
 http://www.greghendershott.com/2013/04/a-guide-for-infrequent-contributors-to-racket.html#waiting-is-the-hardest-part
 
 In the meantime, you might be tempted to merge your topic branch into your 
 own master. Don’t!
 
 If you were to do that, your master would cease being a nice clean mirror of 
 the upstream master. Remember how no one likes a dirty fork, so we’re 
 diligently using git pull --ff-only upstream master?

That’s a reasonable way to operate. I generally just let my changes float at 
the top of master, and branch only when it’s time to make a pull request. 
Managing multiple branches is a lot of work, and it’s easy to lose track if 
you’re constantly rebasing multiple orthogonal branches. 

Please note: I only use rebase, not merge. I can see that if you are in the 
habit of just merging, things could get nasty quite fast.

TL;DR. Greg’s instructions are really nice. Use them.

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.


Re: [racket-users] help please on git/github pull request

2015-07-02 Thread 'John Clements' via users-redirect

 On Jul 2, 2015, at 7:31 AM, Alexander D. Knauth alexan...@knauth.org wrote:
 
 
 On Jul 2, 2015, at 6:34 AM, Tim Brown tim.br...@cityc.co.uk wrote:
 
 Folks,
 
 I have two pull requests related to my separation of net/url-string
 from net/url.
 
 plt/racket #948  implementation of the separation
 racket/net #4test and documentation of the above
 
 My problem is that I have been working on other things, and these are
 now not able to be merged into the master. (I've tried get pull
 --ff-only... as per Greg Hendershott's crib sheet)
 
 Did you try `git pull --ff-only` from your topic branch, or from the master 
 branch?
 
 How do I resolve this?
 
 You probably need to checkout the master branch, then do git pull --ff-only 
 upstream master,
 then checkout your topic branch, and then `git rebase -i master`, find the 
 conflicts, and resolve them.

I agree with this … except that I don’t think you want to use ‘-i’. 

Git rebasing is a skill, though. Keep in mind that your goal in fixing every 
conflict should be to understand the change that *you* made, and see how it 
applies to the new, changed code. Also, remember that you can read 

.git/rebase-apply/patch

to see what the heck the change you originally made was.

 
 After you resolve them you will (I think) need to `git add` the files that 
 you resolved conflicts for, then
 `git rebase --continue`, and then when the rebase is finished, `git push -f 
 origin topic-branch`.

Also, I think you eventually want to get things back onto the master branch, 
right? After rebasing, you should be able to check out master again, then do a 

git merge —ff-only topic-branch

at which point you should be able to push cleanly.

John Clements



-- 
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] Very urgent requirement || OpenShift (PaaS) Consultant @ Phoenix, AZ

2015-06-24 Thread 'John Clements' via users-redirect

 On Jun 24, 2015, at 1:12 PM, Vasanth Kumar vasanth.ai...@gmail.com wrote:
 
 Hi,

*plonk*


-- 
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] Molis Hai -- passwords generated from Dickens

2015-06-22 Thread 'John Clements' via users-redirect
About six months ago, I had an idea on how to generate passwords from English 
text while still maintaining entropy. I wrote it up quickly on ArXiv, and 
published a web page where you can try it:

http://www.brinckerhoff.org/molis-hai/

I’ve now released it as a raco command-line tool, too. You can install it with

raco pkg install molis-hai

...and run it with

raco molis-hai

Unlike the online version, the command-line tool allows you to specify your own 
corpus, order, and number of passwords generated. On the command-line, it uses 
bits from /dev/urandom.

Give it a try!

John Clements

-- 
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] no plot zooming on local build--update procedure wrong?

2015-06-16 Thread 'John Clements' via users-redirect
I notice that currently, plot snips are not zoomable in my local build. The 
release candidate doesn’t seem to have this problem. I believe I’ve had this 
problem since before the release candidate was built. This suggests to me that 
the problem is not that there’s a bug in the code, but rather that my 
installation is messed up somehow. 

I’m up to date on the git.racket-lang.org repo, and I just ran ‘make’, and I’m 
still seeing the problem.

I’m guessing that I could fix this by discarding my tree and building again 
from scratch, but if my update procedure is wrong (git fetch then ‘make’), I’ll 
keep having this problem again and again.

Any ideas?

Many 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.


Re: [racket-users] iso-recursive types not allowed in TR?

2015-06-15 Thread 'John Clements' via users-redirect

 On Jun 13, 2015, at 7:37 AM, Alexander D. Knauth alexan...@knauth.org wrote:
 
 
 On Jun 13, 2015, at 12:18 AM, 'John Clements' via users-redirect 
 us...@plt-scheme.org wrote:
 
 Okay, I shouldn’t change topics, but while I’ve got you (guys): it looks 
 like (module+ test …) now works in TR, but not when there are imported 
 bindings… suppose I have foo.rkt:
 
 I’ve run into similar problems with module+ before as you did below, but I 
 found that something like this has worked so far:
 (module* test racket/base
  (require (submod “..”) rackunit)
  … tests here …
  )

Ah! Makes perfect sense. The submodule isn’t in typed racket by default. 

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.


Re: [racket-users] iso-recursive types not allowed in TR?

2015-06-12 Thread 'John Clements' via users-redirect

 On Jun 12, 2015, at 6:07 PM, Asumu Takikawa as...@ccs.neu.edu wrote:
 
 On 2015-06-12 17:30:42 -0700, 'John Clements' via users-redirect wrote:
 (define-type (HuffJsexpr T)
  (U T (HashTable Symbol HuffJsexpr)))
 
 The variant that Alex mentioned should work.

Interesting… there *is* a problem, though; If I try to write a function with 
the type, say,

(All (T) ((HuffJsexpr T) - number))

I get into trouble quickly trying to distinguish between the two variants, 
because of course the type T might be something confusing like (HashTable 
Symbol Symbol), so no test can distinguish between the two variants. 

Anyhow, no big deal, I can just make them dynamic checks.

Okay, I shouldn’t change topics, but while I’ve got you (guys): it looks like 
(module+ test …) now works in TR, but not when there are imported bindings… 
suppose I have foo.rkt:

#lang typed/racket

(provide [struct-out Z])

(define-struct Z ([a : Number]))

… and then try to import it in a test+:

#lang typed/racket

(require foo.rkt)

(Z 3)

(module+ test
  (Z 3))

this leads to this error message:

Type Checker: missing type for identifier;
 consider using `require/typed' to import it
  identifier: make-Z
  from module: (submod foo.rkt #%contract-defs-reference .. #%contract-defs) 
in: make-Z

I tried various require/typed combinations, but only managed to get an error on 
`make-Z1`, which doesn’t sound like forward progress.

John

 
 I think the only restrictions on recursive types that TR enforces are that it
 has to be (A) productive, in that there's a real type constructor in the
 recursive body, and (B) it can't be polymorphic recursive.
 
 (A) implies something like (Rec X (U Integer X)) isn't allowed. U doesn't
 count as a type constructor for this purpose.
 
 (B) implies you can't have a type definition like:
 
  (define-type (MyType T) (U Integer (MyType (Listof T
 
 where the instantiated type changes.
 
 Cheers,
 Asumu

-- 
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] iso-recursive types not allowed in TR?

2015-06-12 Thread 'John Clements' via users-redirect
Here’s the type I want to write:

(define-type (HuffJsexpr T)
  (U T (HashTable Symbol HuffJsexpr)))

… for use in converting a tree to a jsexpr. My memory was that this wasn’t 
possible in TR because TR would get caught in a loop trying to figure out how 
many times to “unfold” the type in order to make type-checking work. IIUC the 
best solution is just … not to try to do this in TR.  Is that right?

Many 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.


Re: [racket-users] iso-recursive types not allowed in TR?

2015-06-12 Thread 'John Clements' via users-redirect

 On Jun 12, 2015, at 5:52 PM, Alexander D. Knauth alexan...@knauth.org wrote:
 
 
 On Jun 12, 2015, at 8:30 PM, 'John Clements' via users-redirect 
 us...@plt-scheme.org wrote:
 
 Here’s the type I want to write:
 
 (define-type (HuffJsexpr T)
 (U T (HashTable Symbol HuffJsexpr)))
 
 
 Do you mean this?
 (define-type (HuffJsexpr T)
  (U T (HashTable Symbol (HuffJsexpr T

D’oh! Can’t believe I missed that.

Actually, I also can’t believe that TR allowed me to use a type constructor 
without an argument like that.

Thanks!


John

 
 #lang typed/racket
 (define-type (HuffJsexpr T)
  (U T (HashTable Symbol (HuffJsexpr T
 (: x : (HuffJsexpr String))
 (define x
  #hash([a . a string]
[b . #hash([c . #hash()]
   [d . another string])]
[e . #hash([f . and another])]))
 

-- 
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] right abstraction for this?

2015-06-11 Thread 'John Clements' via users-redirect
I write this kind of code all the darn time:

;; take (listof (list a b)) into (hashof a (listof b))
(define (gather l)
  (for/fold ([ht (make-hash)])
([pr l])
(hash-set ht (first pr) (cons (second pr)
  (hash-ref ht (first pr) empty)

;; gather the responses into a table:
(define rating-table (gather responses2))

;; compute the mean rating for each student
(for/list ([(student ratings) (in-hash rating-table)])
  (list student (mean ratings)))

… that is: given an association list, gather them together, then compute (say) 
the mean of the values. In this case, I’m trying to compute the mean rating for 
a bunch of students. Very simple.

So… why does it take so much code? I feel like these should be built-in 
abstractions. There are (at least) two possibilities:

1) There’s an obvious, built-in way to do this, and I’m just missing it.
2) There’s an abstraction that we’re missing, and I feel like Clojure might 
have it. Or am I just making this up? Getting clojure running is such a pain….

Thanks for any advice!

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.


Re: [racket-users] right abstraction for this?

2015-06-11 Thread 'John Clements' via users-redirect

 On Jun 11, 2015, at 10:19 AM, Stephen Chang stch...@ccs.neu.edu wrote:
 
 Would any of the functions in unstable/list help? For example,

Ah, ‘group-by’ is very nice, yes. Looks like that was Vincent’s? Many thanks, 
Vincent!

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.


[racket-users] ...aaand, too late to register for Strange Loop.

2015-06-11 Thread 'John Clements' via users-redirect
Golly, that was fast. So much for RacketCon this year.

My fault, I know.

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.


[racket-users] can't quite reproduce this contract error involving an exported function

2015-06-01 Thread 'John Clements' via users-redirect
I just got an interesting and very scary contract error. I tried to reproduce 
it, but I can’t quite do it. I think I can see (part of) what’s going on, 
though.

Suppose I have a file called bad1.rkt that is in Typed Racket (I’m guessing 
this is significant) and exports a structure called ClassInfo using struct-out, 
along with a constant, e.g. K1, with value “text.rkt”.

I also have a file bad2.rkt that requires bad1, and exports a function called 
‘gather-grades’ with contract (- ClassInfo? boolean?)

Finally, bad3.rkt requires both of the above, constructs a ClassInfo, and 
passes it to gather-grades. 

All good so far.

Now, I made a very small change to bad1.rkt; specifically, I deleted a few 
characters from a regular expression. Then, I ran bad3.rkt. I then got a 
totally frightening contract error, that said (paraphrased from memory, sadly):

Contract error: expected “text.rkt”, got #ClassInfo
from contract on gather-grades, with contract (“text.rkt” - boolean?)

… In other words, the “ClassInfo?” predicate had mysteriously been replaced by 
one that checked for the value “text.rkt”, another value exported by the 
original TR module.

I made a trivial change to bad2.rkt to force recompilation, and as expected, 
the error went away. I then spent 15 minutes trying to recreate the error, but 
all I’m getting now is this:

link: bad variable linkage;
 reference to a variable that is uninitialized
  reference phase level: 0
  variable module: (submod 
/Users/clements/git-clements/clements/pkgs/jbc-utils/shelly/bad1.rkt 
#%contract-defs)
  variable phase: 0
  reference in module: 
/Users/clements/git-clements/clements/pkgs/jbc-utils/shelly/bad2.rkt in: 
idX10.94
 

… which I’m guessing is the “correct” error, in that it’s telling me to 
recompile. Although… perhaps this is another manifestation of the same problem.

I think the trigger here is that I’m using the exported function “ClassInfo?” 
as part of a 'contract-out’ form in bad2.rkt, and that this use isn’t properly 
forcing recompilation.

Also, I initially assumed that TR had something to do with this, but I may be 
mistaken.

Apologies for not copying the original error message before re-running…

Let me know if this is enough information to submit a bug report.


John Clements

-- 
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] can't quite reproduce this contract error involving an exported function

2015-06-01 Thread 'John Clements' via users-redirect

 On Jun 1, 2015, at 1:46 PM, Robby Findler ro...@eecs.northwestern.edu wrote:
 
 I think that if you don't have up to date .zo files, arbitrary badness
 can ensue.

Just to check my development model; generally, when I’m working on multiple 
interdependent libraries in a collection, my experience has been that if I make 
a change to one, DrR will recompile all of the ones that depend on it… right?

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.


Re: [racket-users] racket-explorer now deals with cyclic/mutable data

2015-05-24 Thread 'John Clements' via users-redirect

 On May 22, 2015, at 1:52 PM, Tony Garnock-Jones to...@ccs.neu.edu wrote:
 
 Hi all,
 
 I've updated racket-explorer (https://github.com/tonyg/racket-explorer)
 to handle cyclic (and mutable) data by lazily (and repeatedly) unfolding
 children only when the triangle next to an item is opened (and every
 time it is opened).
 
 If you've tried it before and been discouraged at its handling of large,
 mutable, or infinite structures, please have another go and file bug
 reports using GH issues!
 (https://github.com/tonyg/racket-explorer/issues/new)

I think I’ve been waiting for this for a long time.

Many *extra* thanks for putting a screenshot in the github README; that’s often 
the make-or-break point in whether I’m going to try something out.

John Clements

-- 
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] slideshow keyboard callbacks?

2015-05-19 Thread 'John Clements' via users-redirect
I’m creating a simple slideshow, and I’d like to be able to jump to a given 
slide instantly, ideally by pressing a particular key. Basically, I’d like to 
be able to write this:

#lang slideshow

(extend-keyboard-handler
 (lambda (key default-handler)
   (match key
 [1 (jump-to-slide some-slide)]
 [2 (jump-to-slide some-other-slide)]
 [a (play my-sound)]
 [other (default-handler key)])))

I’ve just been through the slideshow docs, and I don’t see anything like 
this—at least, not documented. Is something like this easy, or hard?

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.


[racket-users] munger package

2015-05-18 Thread 'John Clements' via users-redirect
I’m interested in your munger package for data analysis, but … it looks like 
there are no docs or examples? Any plans to work on this?

Thanks!

John Clements

-- 
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] pkg-build report for the v6.2 release candidate

2015-05-15 Thread 'John Clements' via users-redirect

 On May 14, 2015, at 4:08 PM, Matthew Flatt mfl...@cs.utah.edu wrote:
 
 Here are the results of a package build using the v6.2 release
 candidate:
 
 http://release-pkg-build.racket-lang.org.s3-website-us-west-2.amazonaws.com/
 
 Compare to v6.1.1:
 
 http://pkg-build.racket-lang.org/

I believe I’ve fixed these. Is there a plan to re-run these tests in a day or 
two?

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.


[racket-users] keystroke logger for DrRacket editor?

2015-05-12 Thread 'John Clements' via users-redirect
I’m interested in analyzing my own programming patterns in DrRacket. Has anyone 
already written a keystroke logger / editor-change-logger for DrRacket?  I’m 
imagining that it would capture a session record starting with a known 
snapshot, then a sequence of keystrokes/edit actions, in such a way that I 
could reconstruct the sequence of keystrokes and the state of the editor at 
each step.

Has someone already written this thing?

Thanks!

John Clements

-- 
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] writing a dual typed / untyped library

2015-05-07 Thread 'John Clements' via users-redirect

 On May 6, 2015, at 7:16 PM, Matthew Butterick m...@mbtype.com wrote:
 
 A few notes about what I learned when converting my `sugar` library to a dual 
 Typed Racket / Racket library (in part because of performance considerations).
 
 http://unitscale.com/mb/technique/dual-typed-untyped-library.html
 
 (Factual corrections welcome.)

Excellent post. Nice high-level description, and suitable for forwarding to an 
upper-level undergraduate class. Many thanks.

John Clements

-- 
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] reaching connection pool limit on connection pool with +inf.0 limit?

2015-04-25 Thread 'John Clements' via users-redirect
I have a long-running racket server that’s connecting to a MySQL back end. It 
has a connection pool wrapped in a virtual connection, created like this:

;; create a connection to the database
(define conn 
  (virtual-connection
   (connection-pool
(lambda ()
  (mysql-connect #:database sodec2
 #:user clements
 #:password “redacted
 #:socket mysql-socket)

When this server is running, it periodically produces errors of this form:

connection-pool-lease: connection-pool-limit reached

My reading of the documentation is that the “default” connection pool limit is 
+inf.0, which suggests that I shouldn’t be getting this error. 

Is this a bug?



Ah, what the heck, lemme ask about my other problem. I’m running this process 
with everything at or above ‘warning’ level redirected to syslog, and I’m a 
whole lot of these:

System Events
=-=-=-=-=-=-=
Apr 25 09:02:45 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:02:45 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:02:45 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:02:45 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:02:46 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:02:46 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:03:45 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:03:45 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:03:50 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:03:50 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:03:50 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:03:50 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:03:50 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:04:49 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:04:50 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:04:50 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:04:50 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:04:50 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:04:50 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:05:50 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:05:50 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:05:50 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:05:50 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:05:50 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:05:50 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:06:50 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:06:54 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:06:54 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:06:54 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:06:54 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
Apr 25 09:06:54 linode racket: epoll error at remove: Bad file descriptor; 
errno=9
….

This continues for sometimes hours at a time. I just spent five minutes reading 
the epoll documentation, and it sounds like … maybe a select() on a fd that’s 
already closed? 

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.


Re: [racket-users] Organizing tests

2015-04-16 Thread 'John Clements' via users-redirect

On Apr 16, 2015, at 3:17 AM, Konrad Hinsen konrad.hin...@fastmail.net wrote:

 I am looking for an approach that lets me run either all tests in my
 collection, or convenient subsets (e.g. one module), ideally using a
 single tool such as raco test. Any suggestions? You get bonus points
 for solutions that integrate well with racket-mode in Emacs.

Your wish is granted!

(If I understand you correctly.)

The ‘raco test’ tool can be applied to a collection, using the “—collection” 
(or simply “-c”) flag. You can see a full list of the available flags by 
running 

raco help test

Hope I understood you correctly,

John Clements

-- 
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] DrRacket plugin to remove trailing whitespace on save?

2015-04-13 Thread 'John Clements' via users-redirect

On Apr 13, 2015, at 10:26 AM, Robby Findler ro...@eecs.northwestern.edu wrote:

 You could just make delete-trailing-whitespace a keyboard shortcut instead.
 
 Another approach would be to add a mode that colors trailing
 whitespace in that ugly greeny/yellowy color that DrRacket uses for
 the your code is more than 102 columns warning.

+1 to this. I think I’d definitely like this independent of a mechanism to trim 
on save.

John

 
 Robby
 
 On Mon, Apr 13, 2015 at 12:06 PM, 'John Clements' via users-redirect
 us...@plt-scheme.org wrote:
 
 On Apr 13, 2015, at 2:29 AM, Jon Zeppieri zeppi...@gmail.com wrote:
 
 Robby,
 
 This is my first crack at a DrRacket tool (not to mention an uncommon
 foray into Racket's class system), so what I'm doing may not be...
 sane. But if you're willing to take a look:
 [https://github.com/97jaz/drwhitespace]. At any rate, it isn't a lot
 of code. I based the general structure on Asumu Takikawa's
 drracket-vim-tool.
 
 It's supposed to have the same effect as emacs's 
 `delete-trailing-whitespace`.
 I still need to add a preference setting to turn it on or off. (Maybe
 that should be based on the editor's mode?)
 
 I’d really like to use this tool.
 
 Here’s one problem that I see: there’s a hidden invariant in DrRacket (and 
 all editors) that when a buffer is unchanged, saving it won’t change the 
 file on disk. Actually, I think you can state this in a bunch of different 
 ways. I forsee hard-to-understand errors arising from a silent 
 change-on-save (unless I’m misreading your code?). Personally, I think I’d 
 be more likely to use a tool that requests permission to scrub trailing 
 whitespace when saving a file.  I also think that this should probably be 
 limited to racket and scribble files, and I’m guessing that the easiest way 
 to distinguish these would be to use the filename extension.
 
 Please don’t let me stop you from doing this, though, this is something I’ve 
 wanted for quite a while!
 
 Many thanks,
 
 John
 
 
 -Jon
 
 
 On Sun, Apr 12, 2015 at 6:14 PM, Robby Findler
 ro...@eecs.northwestern.edu wrote:
 No but Max changed the way return works so there should be less whitespace
 added going forward.
 
 Writing a script to trim whitespace from line-endings would work well if it
 were to use text% IMO. Use load-file to get a file and then the paragraph
 methods to find line endings and then delete stuff and ace the file again.
 
 Robby
 
 On Sunday, April 12, 2015, Jon Zeppieri zeppi...@gmail.com wrote:
 
 Does such a think already exist?
 
 -Jon
 
 --
 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.
 
 --
 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] DrRacket plugin to remove trailing whitespace on save?

2015-04-13 Thread 'John Clements' via users-redirect

On Apr 13, 2015, at 2:29 AM, Jon Zeppieri zeppi...@gmail.com wrote:

 Robby,
 
 This is my first crack at a DrRacket tool (not to mention an uncommon
 foray into Racket's class system), so what I'm doing may not be...
 sane. But if you're willing to take a look:
 [https://github.com/97jaz/drwhitespace]. At any rate, it isn't a lot
 of code. I based the general structure on Asumu Takikawa's
 drracket-vim-tool.
 
 It's supposed to have the same effect as emacs's `delete-trailing-whitespace`.
 I still need to add a preference setting to turn it on or off. (Maybe
 that should be based on the editor's mode?)

I’d really like to use this tool.

Here’s one problem that I see: there’s a hidden invariant in DrRacket (and all 
editors) that when a buffer is unchanged, saving it won’t change the file on 
disk. Actually, I think you can state this in a bunch of different ways. I 
forsee hard-to-understand errors arising from a silent change-on-save (unless 
I’m misreading your code?). Personally, I think I’d be more likely to use a 
tool that requests permission to scrub trailing whitespace when saving a file.  
I also think that this should probably be limited to racket and scribble files, 
and I’m guessing that the easiest way to distinguish these would be to use the 
filename extension.

Please don’t let me stop you from doing this, though, this is something I’ve 
wanted for quite a while!

Many thanks,

John
 
 
 -Jon
 
 
 On Sun, Apr 12, 2015 at 6:14 PM, Robby Findler
 ro...@eecs.northwestern.edu wrote:
 No but Max changed the way return works so there should be less whitespace
 added going forward.
 
 Writing a script to trim whitespace from line-endings would work well if it
 were to use text% IMO. Use load-file to get a file and then the paragraph
 methods to find line endings and then delete stuff and ace the file again.
 
 Robby
 
 On Sunday, April 12, 2015, Jon Zeppieri zeppi...@gmail.com wrote:
 
 Does such a think already exist?
 
 -Jon
 
 --
 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.

-- 
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] pict3d

2015-04-12 Thread 'John Clements' via users-redirect
1) pict3d is Totally magnificent. Think I said this before.
2) New OS X mouse controls are excellent.
3) Doc bug (I think). You write

Shapes: visible 2D surfaces in 3D space. Surfaces are visible on only one 
side.”

I believe the first word and the first word of the second sentence should be 
the same, e.g.:

Shapes: visible 2D surfaces in 3D space. Shapes are visible on only one side.

or

Surfaces: visible 2D surfaces in 3D space. Surfaces are visible on only one 
side.

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.


Re: [racket-users] ANN: glob, for Unix-style globbing

2015-03-31 Thread 'John Clements' via users-redirect

On Mar 30, 2015, at 11:15 PM, Benjamin Greenman bl...@cornell.edu wrote:

 I've pushed a script for globbing to the package server. It exports two 
 functions, `glob` and `in-glob`. I hope that some day functions like these 
 can be in racket/file, but until then, enjoy.

This looks useful. Thanks!

John Clements

-- 
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] abort test but not test suite?

2015-03-30 Thread 'John Clements' via users-redirect
I’m writing a test suite, and I’d like a way to abort a test without aborting a 
test suite.  It looks to me like “fail-check” is supposed to do this. Here’s 
the code I wrote:

#lang racket

(require rackunit)

(define (f x)
  (fail-check foo)
  (/ 1 0))

(check-equal? (f 3) 4)
(check-equal? 9 13)

I would like for the first test to fail with error message “foo”, and the 
second one to fail normally.

However, the ‘fail-check’ aborts the test and all remaining tests. Is this the 
expected behavior?

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.


Re: [racket-users] ANN: Gregor, a date and time library

2015-03-26 Thread 'John Clements' via users-redirect

On Mar 25, 2015, at 6:55 PM, Jon Zeppieri zeppi...@gmail.com wrote:

 I recently uploaded Gregor, a date and time library, to the package server.

Can I use this instead of SRFI 19? That would be wonderful.

John Clements


 
 Features:
 
 - representations for and generic operations on:
  - dates
  - times (as in, time-of-day)
  - datetimes (combined date and time)
  - moments (combined datetime and IANA/Olson timezone)
 - date arithmetic
 - localized formatting and parsing, using CLDR data
 
 As you might expect from the name, Gregor uses a (proleptic) Gregorian 
 calendar.
 
 Documentation: http://pkg-build.racket-lang.org/doc/gregor/index.html
 Source and bug tracking: https://github.com/97jaz/gregor
 
 -Jon
 
 -- 
 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] accumulators vs foldl? was: Fwd: Rsound question

2015-03-25 Thread 'John Clements' via users-redirect
This is a pedagogic question. The discussion below (forwarded with permission) 
is basically about the best way to find the maximum value in a vector of length 
four million, a.k.a. a sound file. Non-tail recursion is problematic; I blow a 
512M-limited evaluator in about 14 seconds without finding the answer, where 
tail-calling gets me the answer in about 2 seconds.

So! Here’s the question. Is it better to give students an “rs-foldl” that 
performs a fold over sound, or to show them accumulator-style programming? I 
was a bit surprised to see that in HtDP 2e, foldl (a.k.a. “Programming to an 
Abstraction”) appears much earlier (section 18.4) than accumulator-style 
(section 35). I suppose this could be because using an abstraction can be 
easier than devising it, although in the case of (say) map, the book takes care 
to ensure that students can implement map-like functions in their sleep before 
showing them the abstraction.

Opinions appreciated!

Many thanks,

John


Begin forwarded message:

 From: John Clements cleme...@brinckerhoff.org
 Subject: Re: Rsound question
 Date: March 25, 2015 at 9:48:09 AM PDT
 To: James Vanderhyde jvanderh...@benedictine.edu
 
 
 On Mar 25, 2015, at 5:54 AM, James Vanderhyde jvanderh...@benedictine.edu 
 wrote:
 
 John,
 
 There are some sound processing tasks I’m not sure how to do with Rsound. 
 For example, to normalize the sound (make it as loud as possible with no 
 clipping), I need to find the maximum absolute sample value, and then 
 multiply everything by 1 over that value. I can use rs-map for the second 
 part, but I don’t know how to find the max in a sound (or do other audio 
 analysis). It seems like I need something like rs-fold. What would you 
 recommend?
 
 I see two ways to solve this. The first is “by the book”.
 
 FIRST:
 
 This problem requires two medium-advanced concepts. First, the notion of 
 recursion over the natural numbers, introduced in section 10.3 of HtDP2e 
 
 http://www.ccs.neu.edu/home/matthias/HtDP2e/part_two.html#%28part._sec~3anats%29
 
 … and, more challenging, the notion of an accumulator:
 
 http://www.ccs.neu.edu/home/matthias/HtDP2e/part_six.html
 
 Here’s the resulting code:
 
 (require rsound)
 
 ;; given a sound, return the maximum value
 ;; of a sample in that sound
 ;; rsound - number
 (define (max-volume rs)
  (max-volume-helper rs 0 0.0))
 
 ;; given a sound, an index, and a maximum-so-far,
 ;; compute the maximum volume of the sound
 (define (max-volume-helper rs idx max-so-far)
  (cond [(= (rs-frames rs) idx) max-so-far]
[else (max-volume-helper rs (add1 idx)
 (max (abs (rs-ith/left rs idx))
  (abs (rs-ith/right rs idx))
  max-so-far))]))
 
 (define test-sound (mono 101 x (* -0.0025 x)))
 
 (check-within (max-volume-helper test-sound 50 0.0) 0.25 1e-4)
 (check-within (max-volume-helper test-sound 50 0.96) 0.96 1e-4)
 (check-within (max-volume test-sound) 0.25 1e-4)
 
 In this case, the accumulator isn’t really necessary, but if you want to run 
 the program on more than a few hundred samples, it’s going to be important.
 
 SECOND:
 
 We could certainly add rs-fold. It would require students to define a more 
 challenging higher-order function, but perhaps that’s simpler than writing it 
 in accumulator style? I’d be interested to hear what you have to say.
 
 P.S.: mind if I forward this question to the racket-users mailing list?
 
 John
 
 
 
 
 James
 --
 Dr. James Vanderhyde
 Math and Computer Science
 Benedictine College
 jvanderh...@benedictine.edu
 http://vanderhyde.us/~james/pro/
 
 
 
 On Mar 18, 2015, at 2:24 PM, John Clements cleme...@brinckerhoff.org 
 wrote:
 
 
 On Mar 18, 2015, at 6:28 AM, James Vanderhyde jvanderh...@benedictine.edu 
 wrote:
 
 Thank you, John. You are so helpful. I’ve really appreciated your quick 
 responses. I don’t really like mono because it introduces additional 
 syntax, and signals introduce additional structures. But either one will 
 give me a much better approach than what I was going to do.
 
 Thanks for the thanks! Also, I’d like to point out that if you use 
 indexed-signal, you certainly don’t need to get into details; you can 
 describe a signal as a box with a function in it.
 
 HOWEVER… after looking at this for a while longer, I see that a 
 ‘build-sound’ function such as the one you describe is probably a good 
 addition to the library. So, I added it. (I also
 added some other documentation, and fixed one long-term documentation 
 niggle).
 
 I’ve pushed this to the github repo, and poked pkgs.racket-lang.org. I’m 
 not sure how long it’ll take for the catalog to reflect the change.
 
 Thanks again,
 
 John Clements
 
 
 
 By the way, rs-map is also undocumented.
 
 James
 --
 Dr. James Vanderhyde
 Math and Computer Science
 Benedictine College
 jvanderh...@benedictine.edu
 http://vanderhyde.us/~james/pro/
 
 
 
 On Mar 18, 2015, at 1:23 AM, John