[racket-users] [ANN] New package: live-free-or-die

2016-09-21 Thread Jay McCarthy
I've just put a new package on the server: live-free-or-die

This package lets you escape from Typed Racket's contracts.

--

Here's a little example:

Suppose that "server.rkt" is:

```
#lang typed/racket

(: f ((Listof Float) -> Float))
(define (f l)
  (cond
[(empty? l)
 0.0]
[else
 (+ (first l)
(f (rest l)))]))

(provide f)
```

And that "client.rkt" is:

```
#lang racket/base
(require live-free-or-die)
(live-free-or-die!)

(require "server.rkt")
(f (vector 1 2 3))
```

Then this is what you get when you run the program:

$ racket "client.rkt"
zsh: segmentation fault  racket "client.rkt"

For your convenience, `live-free-or-die!` is also aliased to
`Doctor-Tobin-Hochstadt:Tear-down-this-wall!`

--

Enjoy!

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


Re: [racket-users] Correcting documentation à la Beautiful Racket

2016-09-21 Thread Matthew Butterick

On Sep 21, 2016, at 12:21 PM, Greg Trzeciak  wrote:

> On the other hand I already shared my suggestion with Matthew Butterick twice 
> on hishttp://beautifulracket.com/ which made me realise how superior the kind 
> of direct interface as in the attached image is. You simply click on the 
> paragraph add suggestion/question/correction and click send.
> 
> I'm curious as to what is the experience of Matthew with this kind of 
> interaction with users, how often he received meaningful messages through 
> this interface?

I get meaningful messages frequently. To be fair, as a work in progress, 
Beautiful Racket is wrong a lot more often than the Racket docs. Also, BR has 
no corresponding mailing list or GitHub issues, as Racket does (and most add-on 
Racket packages also do). Also, the comment form relies on being able to send 
email, which requires cooperation with an SMTP server, which would create a new 
network dependency that docs don't currently have (meaning, you can install 
them on your local machine or use them offline and they work the same way).

-- 
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] RacketCon: thanks!

2016-09-21 Thread 'John Clements' via Racket Users
SO glad I went to RacketCon this year. Great to meet you, great to see you. A 
bunch of community members now have faces in my mind. 

Many thanks for all the hard work from Vincent, Leif, Matthew B., etc. etc. etc.

To see what you missed (and to admire Matthew’s typography):

https://con.racket-lang.org/

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] Re: Help with macros

2016-09-21 Thread Jack Firth
Your `syntax-rules` macro-defined macro uses the name "b", but that name is 
already bound by the `syntax-case` step of `define-primitive`. So your 
expansion looks like this:

(define-primitive (add a b c d) (print (+ a b c d)))

=>

(begin
  (define add-property-table (make-hash))
  (hash-set! add-property-table 'is-prime #t)
  (hash-set! add-property-table 'arg-count (length '(a b c d)))
  (hash-set! add-property-table 'emitter (lambda (a b c d) (print (+ a b c d)))
  (define-syntax add
(syntax-rules ()
  ((add a) (list 'add a))
  ((add a (print (+ a b c d))) (list 'add a (print (+ a b c d)))

Note that `add` macro you create uses `(print (+ a b c d))` instead of `b` in 
the second pattern. You can rectify this by using a different name.

However, here are a couple other notes to consider:

- `syntax-case` is considered somewhat obsolete in the Racket community, 
`syntax-parse` allows for better-specified patterns and error messages. Your 
example with syntax parse would look like (synatx-parse stx [(_ (primitive-name 
arg*:id ...) b:expr ...+) ]). This makes your macro throw a 
syntax error if anything used for `arg*` isn't an identifier, or if 
non-expression syntax (like a keyword) is used for `b`.
- Construction of the "-property-table" identifier can be done much more 
concisely with `format-id`, making your DS/SS/SD shorthands unnecessary
- Avoid mutable data structures unless you know you need mutation. Your 
`hash-set!` code can be easily expressed with a plain call to `hash`:

(define table-name
  (hash 'is-prime #t
'arg-count (length '(a b c d))
'emitter (lambda (a b c d) (print (+ a b c d)

- When a macro defines a macro, the elipses (...) refer to the outer macro 
template. This is why you couldn't use ... in the `syntax-rules` macro you 
attempted to create. You can get around this by using two ellipses grouped 
together, like this:

(define-syntax primitive-name
  (syntax-rules ()
((primitive-name a (... ...)) (list 'primitive-name a (... ...)

- It's considered good Racket style to use brackets for the clauses of 
`syntax-rules` / `syntax-case` / `syntax-parse`, like this:

(syntax-case stx ()
  [(pattern ...) body ...]
  [(pattern ...) body ...]))

- If you (require syntax/parse/define) you can use `define-simple-macro` (badly 
named, we know) in place of `define-syntax-rule`. They function similarly, but 
the former uses `syntax/parse` and thus lets you specify constraints like "this 
should be an identifier".
- The macro you create for each primitive is exactly the same. It may be 
simpler to factor that out into a separate macro:

(define-simple-macro (define-primitive-application-syntax (primitive-name:id 
arg:id ...))
  (define-simple-macro (primitive-name arg-expr:expr (... ...))
(list 'primitive-name arg-expr ...)))

(define-syntax (define-primitive stx)
  (syntax-parse stx ()
[(_ (primitive-name:id arg:id ...) body ...+)
 #:with table-name
(format-id #'primitive-name "~a-property-table" #'primitive-name)
 #'(begin
(define table-name )
(define-primitive-application-syntax (primitive-name arg ...))]))

Hope this helps!

-- 
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] Fixing DPC languages?

2016-09-21 Thread Marco Morazan
Hi All,

Has anyone used the DPC languages in the latest release?

I see that unstable/syntax is deprecated and now use  syntax/transformer
and syntax/location . The class package is installed without reporting
errors. However, when i try to use the class/1 language I get the following
error:

Welcome to DrRacket, version 6.6 [3m].
Language: class/1, with debugging; memory limit: 128 MB.
. ..\..\..\..\..\Program
Files\Racket\collects\racket\private\class-internal.rkt:1867:19: public:
use of a class keyword is not in a class top-level in: public
>

Clicking on the error yields:

Welcome to DrRacket, version 6.6 [3m].
Language: racket/base, with debugging; memory limit: 128 MB.
module: import cycle detected
  module in cycle: #
>

Any insights?

Thanks in advance!

-- 

Cheers,

Marco

Have a´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´ (¸.·´ * wonderful day! :)

-- 
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] Correcting documentation à la Beautiful Racket

2016-09-21 Thread Jay McCarthy
Thanks for noticing the broken links. I fixed them.

I really like the easy comment box idea.

Jay

On Thu, Sep 22, 2016 at 4:21 AM, Greg Trzeciak  wrote:
> I have found some dead links in the documentation I wanted to raise as an 
> issue or if I wouldn't find right repository post it to this mail group when 
> I realised how many times in the past I didn't do anything about the noticed 
> error.
>
> On the other hand I already shared my suggestion with Matthew Butterick twice 
> on his http://beautifulracket.com/ which made me realise how superior the 
> kind of direct interface as in the attached image is. You simply click on the 
> paragraph add suggestion/question/correction and click send.
>
> This made me question if something similar couldn't be adapted to the 
> documentation of Racket - with maybe small change - you would have to click 
> on the flag next to the paragraph as opposed to the paragraph directly in 
> order to open the correction box.
>
> I'm curious as to what is the experience of Matthew with this kind of 
> interaction with users, how often he received meaningful messages through 
> this interface?
>
>
> As to the dead links - they are both Jay's articles on:
> https://docs.racket-lang.org/web-server/stateless.html
> dead links:
> https://faculty.cs.byu.edu/~jay/static/oopsla026-mccarthy.pdf
> https://faculty.cs.byu.edu/~jay/static/icfp065-mccarthy.pdf
> correct links:
> https://jeapostrophe.github.io/home/static/oopsla026-mccarthy.pdf
> https://jeapostrophe.github.io/home/static/icfp065-mccarthy.pdf
>
> Thanks
>
> Greg
>
> --
> 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
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

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

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Correcting documentation à la Beautiful Racket

2016-09-21 Thread Greg Trzeciak
> I'm curious as to what is the experience of Matthew with this kind of 
> interaction with users, how often he received meaningful messages through 
> this interface?

Matthew, my apologies for writing a question to you in third person.

-- 
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] Re: DrRacket 6.5 + OS X El Capitan = slow execution

2016-09-21 Thread An Onlooker
Evaluation is fast after I've changed the language level from Beginner Student 
Language to "#lang racket/base". So the issue is in Beginner Student Language. 
Thanks to EdMaphis.

-- 
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] Correcting documentation à la Beautiful Racket

2016-09-21 Thread Greg Trzeciak
I have found some dead links in the documentation I wanted to raise as an issue 
or if I wouldn't find right repository post it to this mail group when I 
realised how many times in the past I didn't do anything about the noticed 
error. 

On the other hand I already shared my suggestion with Matthew Butterick twice 
on his http://beautifulracket.com/ which made me realise how superior the kind 
of direct interface as in the attached image is. You simply click on the 
paragraph add suggestion/question/correction and click send.

This made me question if something similar couldn't be adapted to the 
documentation of Racket - with maybe small change - you would have to click on 
the flag next to the paragraph as opposed to the paragraph directly in order to 
open the correction box.

I'm curious as to what is the experience of Matthew with this kind of 
interaction with users, how often he received meaningful messages through this 
interface?


As to the dead links - they are both Jay's articles on:
https://docs.racket-lang.org/web-server/stateless.html
dead links:
https://faculty.cs.byu.edu/~jay/static/oopsla026-mccarthy.pdf
https://faculty.cs.byu.edu/~jay/static/icfp065-mccarthy.pdf
correct links:
https://jeapostrophe.github.io/home/static/oopsla026-mccarthy.pdf
https://jeapostrophe.github.io/home/static/icfp065-mccarthy.pdf

Thanks

Greg

-- 
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] PLDI 2017 call for papers

2016-09-21 Thread Tobias Grosser
*Call for Contributions*

2017 ACM Conference on
Programming Language Design and Implementation (PLDI)
June 19-23, 2017 in Barcelona, Spain
http://conf.researchr.org/home/pldi-2017

PLDI is the premier forum in the field of programming languages
and programming systems research,  covering the areas of design
implementation, theory, applications, and performance. PLDI
welcomes outstanding research which clearly advances the field
and has the potential  to make a lasting contribution.

*Important Dates*
===
Research paper submissions due 15 Nov 2016
Author response period 26-28 Jan 2017
Author notification 13 Feb 2017

*Author Instructions*
==
http://conf.researchr.org/track/pldi-2017/pldi-2017-papers

Submission site: https://pldi17.hotcrp.com/

*Organizing Committee*

General Chair: Albert Cohen, INRIA, France
Program Chair:   Martin Vechev, ETH Zurich, Switzerland
Workshops &
Tutorials Chair:   Aaron Smith, University of Edinburgh
Publicity Chairs: Adrian Sampson, Cornell, USA
  Tobias Grosser, ETH Zurich,
  Switzerland

http://conf.researchr.org/committee/pldi-2017/pldi-2017-organizing-committee

--
Tobias Grosser

-- 
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] Help with macros

2016-09-21 Thread C K Kashyap
Hi all,
I am trying to follow the incremental approach to compiler construction at
http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf

I am trying to define a macro that will do the following -

(define-primitive (add a b) 

-> create a hashtable called add-property-table and put in information such
as number of arguments
-> create another macro called add that will expand any occurrence of (add
...) to (list add ...)

As I understand, I would need to define a macro inside the macro. Here's
what I tried -

(define-syntax (define-primitive stx)
  (syntax-case stx ()
((_ (primitive-name arg* ...) b b* ...)
 (let ((DS datum->syntax) (SS string->symbol) (SD syntax->datum))
   (with-syntax ((table-name (DS stx (SS (format "~a-property-table"
(SD #'primitive-name))
 #'(begin
 (define table-name (make-hash))
 (hash-set! table-name 'is-prime #t)
 (hash-set! table-name 'arg-count (length '(arg* ...)))
 (hash-set! table-name 'emitter (lambda (arg* ...) b b* ...))

 (define-syntax primitive-name
   (syntax-rules ()
 ((primitive-name a) (list 'primitive-name a))
 ((primitive-name a b) (list 'primitive-name a b ; I
cant seem to use ... here
 ))

To test this, I defined
(define-primitive (add a b c d) (print (+ a b c d)))

(add 1) works fine an returns '(add 1) . However, (add 1 2) does not work
-> bad syntax.

Could someone please tell me how I could get this to work?

Regards,
Kashyap

-- 
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] Web-server and IDN

2016-09-21 Thread Tobias Gerdin

> 20 sep. 2016 kl. 22:47 skrev Jay McCarthy :
> 
> On Wed, Sep 21, 2016 at 5:39 AM, Tobias Gerdin  wrote:
>> Hello,
>> 
>> Thanks for Racket, it really is great.
>> 
>> Is the web-server of production quality?
> 
> There are commercial sites that are built using it.
> 
>> Does it support IDN[1] hostnames?
> 
> I believe so, as it leaves hostnames uninterpreted and can deliver any
> bytes you tell it to.

Great, thank you!

-Tobias


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

2016-09-21 Thread Kieron Hardy
I've been experimenting with 'shell/pipeline' on windows and post some
tests and example results here in case they are of use to others:
- basic examples demonstrating windows external commands,
- basic examples demonstrating windows internal commands with standard
cmd.shell,
- basic examples demonstrating windows internal commands with 'new'
powershell.cmd shell,
- a more complex example showing a command pipeline using powershell
commands to do sed-like and grep-like operations.

Cheers,

Kieron.



Examples using Windows external commands:

#lang racket/base

; windows-pipeline-1.rkt - basic windows commands with output to stdout and
stderr

(require shell/pipeline)

; run racket, do arithmetic
(run-pipeline '(racket -e "(+ 41 1)") )

; run java, get java version
(run-pipeline '(java -version) )

; run where, find location of windows where.exe on path
(run-pipeline '(where where) )

; run where, find location of windows cmd.exe on path
(run-pipeline '(where cmd) )

Example execution from Windows command prompt:

C:\home\racket\shell>racket windows-pipeline-1.rkt >
windows-pipeline-1.rkt.out 2>&1

C:\home\racket\shell>type windows-pipeline-1.rkt.out
42
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
C:\Windows\System32\where.exe
C:\Windows\System32\cmd.exe
0
0
0
0


Examples using Windows internal commands, i.e. commands built-in to the
cmd.exe shell:


#lang racket/base

; windows-pipeline-2.rkt - basic windows internal (cmd.exe) commands with
output to stdout and stderr

(require shell/pipeline)

; note: run cmd.exe with /c switch to terminate cmd.exe after executing the
given command, i.e. terminate without needing to execute the 'exit' command

; run windows cmd.exe shell, run internal 'dir' command to get directory
listing of the root of C: drive
(run-pipeline '(cmd /c dir C:\\) )

; run windows cmd.exe shell, run internal 'set' command to the get a
complete listing of the environment variables and their values
(run-pipeline '(cmd /c set) )

; run windows cmd.exe shell, run internal 'echo' command to send arguments
to standard out
(run-pipeline '(cmd /c echo hello world) )

; run windows cmd.exe shell, run internal 'path' command to get the value
of the PATH environment variable
(run-pipeline '(cmd /c path) )

; run windows cmd.exe shell, run internal 'echo' command to get the value
of the PATH environment variable
(run-pipeline '(cmd /c echo %PATH%) )


Example execution from Windows command prompt:

C:\home\racket\shell>racket windows-pipeline-2.rkt >
windows-pipeline-2.rkt.out 2>&1

C:\home\racket\shell>type windows-pipeline-2.rkt.out

 Volume in drive C is Windows
 Volume Serial Number is 4A0E-59A3

 Directory of C:\

05/06/2016  10:53 PM  Analytics
07/06/2015  09:57 AM  Brother
09/14/2015  07:49 AM  cygwin64
01/08/2016  05:00 PM  data
11/04/2015  02:18 PM   321,531 DUMP38fa.tmp
09/20/2016  02:51 PM  home
12/22/2014  07:04 PM  Intel
07/02/2015  01:19 PM  OSGeo4W64
07/13/2009  09:20 PM  PerfLogs
08/28/2016  08:48 PM  Program Files
09/20/2016  09:21 AM  Program Files (x86)
09/09/2015  05:50 PM  Python27
11/12/2015  01:16 PM  Python27_64
08/29/2016  02:47 PM  SWSETUP
09/20/2016  09:02 AM  tools
06/19/2015  02:41 PM  Users
08/02/2015  02:12 PM  wamp
09/14/2016  11:48 AM  Windows
09/07/2016  07:35 PM42 windows-version.txt
   2 File(s)321,573 bytes
  17 Dir(s)  366,015,729,664 bytes free
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\Kieron\AppData\Roaming
asl.log=Destination=file
CLASSPATH=.;C:\tools\apple\QuickTime\QTSystem\QTJava.zip
CommonProgramFiles=C:\Program Files (x86)\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=NIETZSCHE

...

hello world
PATH=C:\ProgramData\Oracle\Java\javapath;C:\tools\racket\racket32_6.5\Racket;C:\Program
Files (x86)\...

C:\ProgramData\Oracle\Java\javapath;C:\tools\racket\racket32_6.5\Racket;C:\Program
Files (x86)\...

0
0
0
0
0


Examples using Windows powershell shell:

#lang racket/base

; windows-pipeline-3.rkt - basic windows internal (powershell.exe) commands
with output to stdout and stderr

(require shell/pipeline)

; note: run powershell.exe with /Command switch to terminate powershell.exe
after executing the given command, i.e. terminate without needing to
execute the 'exit' command

; run windows external command 'where.exe', find location of windows
powershell.exe on path
(run-pipeline '(where powershell) )

; run windows powershell.exe shell, run internal 'echo' command to get the
value of the arguments to standard out
(run-pipeline '(powershell /Command "& {echo Hello World}") )

; run windows powershell.exe