Re: [racket-users] DrRacket's auto-indentation outside DrRacket?

2016-08-25 Thread David Christiansen
> The code I sent would be influenced by the preferences I believe. But you
> could test that?

I will, when I'm next on a machine with Racket. Is there a way to set
these preferences programmatically, though? I intend to run the code
in a VM that is created from scratch each time the tests are run (on
Travis), so scripting the setting of the preferences is pretty
important.

Thanks again!

/David

-- 
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's auto-indentation outside DrRacket?

2016-08-25 Thread Robby Findler
The code I sent would be influenced by the preferences I believe. But you
could test that?

Robby

On Thursday, August 25, 2016, David Christiansen 
wrote:

> Hi Robby,
>
> Thank you very much for a fast and useful answer!
>
> > I'm not sure about the suitable configuration: that should probably
> > happen via the #lang line and shouldn't be configured "from the
> > outside" (we're not quite there yet, but that's where we should be
> > heading, IMO).
>
> Today, this is done by setting individual preferences in DrRacket. Is
> there a reasonably easy way to set these preferences for the
> racket:text% ?  It's clearly not a general solution, and I agree that
> either the #lang line or the macro definition should be able to affect
> these things, but in my case I've got a project that defines a couple
> of macros, and I am happy to manually configure them in my CI setup. I
> already have Emacs directory variables to set up their indentation for
> racket-mode in Emacs, for instance.
>
> > But for point 2, here's a script. It depends on the GUI library.
> > Removing that dependency is possible, but probably a lot of work.
>
> My test suite already depends on the GUI library, so that's no problem
> at all for me.
>
> Thanks again!
>
> /David
>
> --
> 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's auto-indentation outside DrRacket?

2016-08-25 Thread David Christiansen
>>> The specification has to come with feature and/or the language, not the 
>>> tool. How would Emacs know about it? Or Notepad? Every editor — and every 
>>> tool in the tool chain — must know what indentation means if it may touch 
>>> it.

My goal here is not for Emacs to know how to indent things perfectly,
it is merely to ensure that Emacs or my merge tool have not made a
hash of it. Also, perhaps more importantly, it should ensure that
other contributors' editors haven't made a hash of it! This is a much
easier problem!

> How would a library express indentation rules? Would indentation rules meant 
> for s-expression languages be useful in at-exp or sweet-exp notations?

At least in Elisp, indentation rules are specified by using a
"declare" form in a macro definition [1]. racket-mode for Emacs also
allows a similar customization of indentation by setting properties on
symbol plists, which provides something about as expressive as the
DrRacket configuration dialog. A good indenter for Racket would
probably need to macroexpand the source, but I imagine that something
like a designated submodule could contain indentation specifications
in a similar format.

[1]: 
https://www.gnu.org/software/emacs/manual/html_node/elisp/Indenting-Macros.html#Indenting-Macros

I don't know how to properly indent things from other readers, though.

/David

-- 
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's auto-indentation outside DrRacket?

2016-08-25 Thread David Christiansen
Hi Robby,

Thank you very much for a fast and useful answer!

> I'm not sure about the suitable configuration: that should probably
> happen via the #lang line and shouldn't be configured "from the
> outside" (we're not quite there yet, but that's where we should be
> heading, IMO).

Today, this is done by setting individual preferences in DrRacket. Is
there a reasonably easy way to set these preferences for the
racket:text% ?  It's clearly not a general solution, and I agree that
either the #lang line or the macro definition should be able to affect
these things, but in my case I've got a project that defines a couple
of macros, and I am happy to manually configure them in my CI setup. I
already have Emacs directory variables to set up their indentation for
racket-mode in Emacs, for instance.

> But for point 2, here's a script. It depends on the GUI library.
> Removing that dependency is possible, but probably a lot of work.

My test suite already depends on the GUI library, so that's no problem
at all for me.

Thanks again!

/David

-- 
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-08-25 Thread Eli Barzilay
On Mon, Aug 22, 2016 at 12:59 AM, William G Hatch  wrote:
> I've looked over the scsh docs at various times, though I've never
> actually used it -- it's never been pre-packaged for distros I've
> used, and every time I've tried to build it I've run into errors.
> Perhaps I should try again.  As far as the process syntax goes, a
> little bit of macros over my pipeline library should be able to get
> you something pretty close.  I'll probably do that later.

There were some problematic points with the scsh macro -- something
around the implicit backquoting that made things not compose nicely.
I think that this was what Mike Sperber told me at some point.

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

-- 
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] How would a library express indentation rules? [was: DrRacket's auto-indentation outside DrRacket?]

2016-08-25 Thread Dupéron Georges
I'm starting a new discussion topic, so as not to crowd
https://groups.google.com/forum/#!topic/racket-users/4SnwpX6gYqk .

2016-08-26 0:32 GMT+02:00 Alex Knauth :
> How would a library express indentation rules? Would indentation rules
meant for s-expression languages be useful in at-exp or sweet-exp notations?

Below are some ideas, but I'm definitely sure something better can be
achieved.
TL;DR: we could specify the indentation of each s-expression with respect
to another preceding s-expression (but not necessarily the one just
before), and indicating if it should be indented by 0, 2 or 4 spaces.



>From what I've seen, lisps and schemes have a few indentation styles for a
given line:

Indent a bit, with respect to the beginning of the enclosing s-expression:

(define ;; indent = 0
  a ;; indent += small
  1)

Indent a a lot (twice as much?), with respect to the beginning of the
enclosing s-expression.

(λ ;; indent = 0
(args) ;; indent += big
  body);; indent += small, with respect to line 1

Indent the as much as the first argument of the enclosing form.

(displayln datum
   output-port)

Indent as much as the first s-expression on the previous line (this is
basically just `begin` specifying a +small indentation for all of
sub-expressions):

(begin
  (define x 1) (define y 2) ;; indent = 2
  (displayln (+ x y)))  ;; indent += 0

Has anyone seen another kind of indentation? Reader extensions like #' and
dotted pairs may need some extra thought.

I think the cases above can be generalized to: “Indent this s-expression so
that it aligns with that other preceding s-expression (exactly | plus a
small indent of 2 spaces | plus a large indent of 4 spaces)“. It allows
some less common indentation styles:

The code
(some-macro #:kw #:kw-one-arg arg1 #:kw-trhee-args argA argB argC)
may specify the following indentation styles:
#:kw => +small, w.r.t some-macro
#:kw-one-arg => exactly, w.r.t #:kw
arg1 => +small, w.r.t #:kw-one-arg
#:kw-three-args => exactly, w.r.t #:kw (or w.r.t #:kw-one-arg)
argA => +small, w.r.t #:kw-three-args
argB => exactly, w.r.t argA
argC => exactly, w.r.t argA
which gives the following indentations, depending on where the newlines are:
(some-macro #:kw #:kw-one-arg arg1 #:kw-three-args argA argB argC)
(some-macro #:kw
#:kw-one-arg arg1
#:kw-three-args argA argB argC)
(some-macro #:kw
#:kw-one-arg
  arg1
#:kw-three-args
  argA argB
  argC)
(some-macro
  #:kw
  #:kw-one-arg
arg1
  #:kw-three-args argA argB
  argC)

Given a caml-style let-in macro, the code
(let (x . y) z = (values (cons 1 2) 3) t = 4 in body)
may specify the following indentation styles:
(x . y) => +big, w.r.t let
z => exactly, w.r.t (x . y)
= => exactly w.r.t (x . y)
t =>  exactly w.r.t (x . y)
=  => exactly w.r.t (x . y)
4 =>  exactly w.r.t (x . y)
in => exactly w.r.t let
body => +small w.r.t let
which gives the following indentations, depending on where the newlines are:
(let (x . y) z = (values (cons 1 2) 3) t = 4 in body)
(let
(x . y) z = (values (cons 1 2) 3)
t = 4
 in
   body)
(let
(x . y) z = (values (cons 1 2) 3)
t = 4 in
   body)
(let (x . y) z = (values (cons 1 2) 3)
 t = 4
 in body)
(let (x . y) z = (values (cons 1 2) 3) t = 4 in
  body)

I'm not used to sweet-exp, so I cannot say much about it, but the rules
above seem to translate naturally to at-exp in most cases, but not all:
@some-macro[#:kw #:kw-one-arg arg1 #:kw-three-args argA argB argC]
@some-macro[#:kw
#:kw-one-arg arg1
#:kw-three-args argA argB argC]
@some-macro[#:kw
#:kw-one-arg
  arg1
#:kw-three-args
  argA argB
  argC]
@some-macro[
  #:kw
  #:kw-one-arg
arg1
  #:kw-three-args argA argB
  argC]
bonus: if the [ appears first on its line, it uses the indentation of the
following token, and shifts everyting until ] by 1 space:
@some-macro
  [#:kw
   #:kw-one-arg
 arg1
   #:kw-three-args argA argB]
things are do not look so good when using {} for the last argument:
@some-macro
  [#:kw
   #:kw-one-arg
 arg1
   #:kw-three-args argA argB]{
   argC}

@let[(x . y) z = (values (cons 1 2) 3) t = 4 in body]
@let[
(x . y) z = (values (cons 1 2) 3)
t = 4
 in
   body]
This one looks a bit weird too (because the "[" bracket is opened on the
second line):
@let
[(x . y) z = (values (cons 1 2) 3)
 t = 4 in
   body]
Where should the closing brace "}" be positioned ?

Re: [racket-users] DrRacket's auto-indentation outside DrRacket?

2016-08-25 Thread Alex Knauth

> On Aug 25, 2016, at 6:17 PM, Dupéron Georges  
> wrote:
> 
> Le vendredi 26 août 2016 00:02:13 UTC+2, Matthias Felleisen a écrit :
>> The specification has to come with feature and/or the language, not the 
>> tool. How would Emacs know about it? Or Notepad? Every editor — and every 
>> tool in the tool chain — must know what indentation means if it may touch 
>> it. 
> 
> I agree, it is unfortunate that for a language's get-info to respond to the 
> `'drracket:indentation` it has to manipulate racket:text<%> among other 
> things.
> 
> This could however be achieved ...

That wouldn't be enough, because even DrRacket's indentation working properly 
with a `racket:text<%>` and a language's get-info function isn't enough. 

One thing we would still need would be a general way for libraries to specify 
indentation for functions and macros, so that when this library is required, 
any language and editor can look at the library's specification, even if 
neither the language nor the editor have any rules about this library.

How would a library express indentation rules? Would indentation rules meant 
for s-expression languages be useful in at-exp or sweet-exp notations?


-- 
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] Re: DrRacket's auto-indentation outside DrRacket?

2016-08-25 Thread Dupéron Georges
Le vendredi 26 août 2016 00:02:13 UTC+2, Matthias Felleisen a écrit :
> The specification has to come with feature and/or the language, not the tool. 
> How would Emacs know about it? Or Notepad? Every editor — and every tool in 
> the tool chain — must know what indentation means if it may touch it. 

I agree, it is unfortunate that for a language's get-info to respond to the 
`'drracket:indentation` it has to manipulate racket:text<%> among other things.

This could however be achieved (without popping a GUI) by an emacs mode 
communicating with Racket. If macros were allowed to specify how they are 
indented, the editor would need to run some racket code at some point, anyway 
(to expand the macro). It is already necessary to run some racket code to parse 
the surface syntax of the file, and know what parts are strings, what parts are 
identifiers etc. (the same file with #lang scribble and #lang racket won't 
indent in the same way, obviously).

I'm not sure if using racket:text<%> is that much of a concern in the end, 
though: any editor plugin could spawn a racket process, create an instance of 
racket:text<%> and communicate with it to get the indentation of any line it 
wants. The overhead does not seem that high, and it does not require a 
full-blown gui (the GTK libraries might be needed, but not a suitable display).

-- 
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] Re: DrRacket's auto-indentation outside DrRacket?

2016-08-25 Thread Matthias Felleisen

The specification has to come with feature and/or the language, not the tool. 
How would Emacs know about it? Or Notepad? Every editor — and every tool in the 
tool chain — must know what indentation means if it may touch it. 




> On Aug 25, 2016, at 6:00 PM, Dupéron Georges  
> wrote:
> 
> Le jeudi 25 août 2016 23:47:21 UTC+2, Matthias Felleisen a écrit :
>> If Travis re-indented my benchmarks/samples every time I commit one, I would 
>> be rather unhappy. 
> 
> I think that's what David meant by "A way to represent indentation 
> specifications for new syntactic forms": the idea would be to include in the 
> repository a list of define-style, lambda-style, begin-style and 
> for/fold-style keywords, so that the build knows how to indent 
> project-specific and library-specific identifiers.
> 
>> I would like us to wait until languages can choose an indentation style per 
>> construct. 
> 
> If I understood well, I think this can already be done with 
> 'drracket:indentation to override drracket's indentation function (and with a 
> bit of luck, Robby's script already takes that into account).
> 
> I didn't know this had been used in practice, but surprisingly (for me) 
> github's search for `drracket:indentation` turned up several repositories:
> * https://github.com/mbutterick/beautiful-racket
> * scribble seems to use it
> * a few other random repos

-- 
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] Re: DrRacket's auto-indentation outside DrRacket?

2016-08-25 Thread Dupéron Georges
Le jeudi 25 août 2016 23:47:21 UTC+2, Matthias Felleisen a écrit :
> If Travis re-indented my benchmarks/samples every time I commit one, I would 
> be rather unhappy. 

I think that's what David meant by "A way to represent indentation 
specifications for new syntactic forms": the idea would be to include in the 
repository a list of define-style, lambda-style, begin-style and for/fold-style 
keywords, so that the build knows how to indent project-specific and 
library-specific identifiers.

> I would like us to wait until languages can choose an indentation style per 
> construct. 

If I understood well, I think this can already be done with 
'drracket:indentation to override drracket's indentation function (and with a 
bit of luck, Robby's script already takes that into account).

I didn't know this had been used in practice, but surprisingly (for me) 
github's search for `drracket:indentation` turned up several repositories:
* https://github.com/mbutterick/beautiful-racket
* scribble seems to use it
* a few other random repos

-- 
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] Re: DrRacket's auto-indentation outside DrRacket?

2016-08-25 Thread Matthias Felleisen

I am skeptical of this and I would like us to not jump the gun. 

Just today I adjusted my personal indentation style for universe. (It had 
somehow gotten lost.) It now indents properly the way its creator intended it 
to: 

 (universe the-small-thing 
   [on-new . . . ]
   [on-msg . . . ])

before it indented it wrong. 

If Travis re-indented my benchmarks/samples every time I commit one, I would be 
rather unhappy. 

I would like us to wait until languages can choose an indentation style per 
construct. 
   





> On Aug 25, 2016, at 5:41 PM, Dupéron Georges  
> wrote:
> 
> I'll add a few relevant and less relevant references:
> 
> This discussion [1] is about extending drracket's built-in indenter, using 
> `drracket:indentation` [2]. The #lang's get-info function should accept that 
> symbol as a key, and return an indentation function.
> 
> To access the default indentation by drracket, it seems you could call 
> `compute-racket-amount-to-indent` [3]. It accepts an optional argument 
> `get-head-sexp-type` which should be a function mapping identifiers to one of 
> #f 'lambda 'define 'begin 'for/fold 'other, where #f means that it will use 
> the built-in list.
> 
> There was some discussion in [1] and in this mailing-list discussion [4] 
> about the future possibility of using syntax properties or a similar 
> mechanism to allow macros and other identifiers to specify their indentation.
> 
> [1] https://github.com/racket/drracket/issues/60
> [2] 
> http://docs.racket-lang.org/tools/adding-languages.html#%28idx._%28gentag._17._%28lib._scribblings%2Ftools%2Ftools..scrbl%29%29%29
> [3] 
> http://docs.racket-lang.org/framework/Racket.html#%28meth._%28%28%28lib._framework%2Fmain..rkt%29._racket~3atext~3c~25~3e%29._compute-racket-amount-to-indent%29%29
> [4] 
> https://groups.google.com/forum/#!msg/racket-users/mTXshH6eal0/u-OySmuuCwAJ
> 
> -- 
> 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] Re: DrRacket's auto-indentation outside DrRacket?

2016-08-25 Thread Dupéron Georges
I'll add a few relevant and less relevant references:

This discussion [1] is about extending drracket's built-in indenter, using 
`drracket:indentation` [2]. The #lang's get-info function should accept that 
symbol as a key, and return an indentation function.

To access the default indentation by drracket, it seems you could call 
`compute-racket-amount-to-indent` [3]. It accepts an optional argument 
`get-head-sexp-type` which should be a function mapping identifiers to one of 
#f 'lambda 'define 'begin 'for/fold 'other, where #f means that it will use the 
built-in list.

There was some discussion in [1] and in this mailing-list discussion [4] about 
the future possibility of using syntax properties or a similar mechanism to 
allow macros and other identifiers to specify their indentation.

 [1] https://github.com/racket/drracket/issues/60
 [2] 
http://docs.racket-lang.org/tools/adding-languages.html#%28idx._%28gentag._17._%28lib._scribblings%2Ftools%2Ftools..scrbl%29%29%29
 [3] 
http://docs.racket-lang.org/framework/Racket.html#%28meth._%28%28%28lib._framework%2Fmain..rkt%29._racket~3atext~3c~25~3e%29._compute-racket-amount-to-indent%29%29
 [4] https://groups.google.com/forum/#!msg/racket-users/mTXshH6eal0/u-OySmuuCwAJ

-- 
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's auto-indentation outside DrRacket?

2016-08-25 Thread Robby Findler
Oh, actually comparing characters is just fine, since tabify changes
only characters, not snips.

Robby


On Thu, Aug 25, 2016 at 4:24 PM, Robby Findler
 wrote:
> I'm not sure about the suitable configuration: that should probably
> happen via the #lang line and shouldn't be configured "from the
> outside" (we're not quite there yet, but that's where we should be
> heading, IMO).
>
> But for point 2, here's a script. It depends on the GUI library.
> Removing that dependency is possible, but probably a lot of work.
>
> Robby
>
>
> #lang racket/base
> (require racket/gui/base
>  racket/port
>  racket/class
>  framework)
>
> (define (indented-properly? port)
>   (define-values (out1 in1) (make-pipe))
>   (define-values (out2 in2) (make-pipe))
>   (thread (λ ()
> (copy-port port in1 in2)
> (close-output-port in1)
> (close-output-port in2)))
>   (define (insert-it port chan)
> (thread
>  (λ ()
>(define t (new racket:text%))
>(send t insert-port port)
>(channel-put chan t
>   (define c1 (make-channel))
>   (define c2 (make-channel))
>   (insert-it out1 c1)
>   (insert-it out2 c2)
>   (define t1 (channel-get c1))
>   (define t2 (channel-get c2))
>
>   ;; this is the important line
>   (send t1 tabify-all)
>
>   ;; this should really compare snips, not characters
>   (and (= (send t1 last-position)
>   (send t2 last-position))
>   (for/and ([x (in-range (send t1 last-position))])
> (equal? (send t1 get-character x)
> (send t2 get-character x)
>
> (define illindented-candidate
>   (string-append
>"#lang racket\n"
>"(define (f x)\n"
>"x)"))
> (define well-indented-candidate
>   (string-append
>"#lang racket\n"
>"(define (f x)\n"
>"  x)"))
> (indented-properly? (open-input-string illindented-candidate))
> (indented-properly? (open-input-string well-indented-candidate))
>
>
>
> On Thu, Aug 25, 2016 at 3:52 PM, David Christiansen
>  wrote:
>> Hi all,
>>
>> As far as I know, the standard for indentation in Racket is "Do like
>> DrRacket", after DrRacket has been suitably configured for new syntax
>> introduced by the application in question.
>>
>> I'd like to arrange for this to be enforced by Travis. As far as I can
>> see, my building blocks for this are the following:
>>
>> 1. A way to represent indentation specifications for new syntactic forms
>>
>> 2. A way to invoke automatic indentation on a file without running a
>> GUI, using these specifications in addition to the default rules
>>
>> Is there a canonical way to achieve these things?
>>
>> Thanks!
>>
>> /David
>>
>> --
>> 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's auto-indentation outside DrRacket?

2016-08-25 Thread Robby Findler
I'm not sure about the suitable configuration: that should probably
happen via the #lang line and shouldn't be configured "from the
outside" (we're not quite there yet, but that's where we should be
heading, IMO).

But for point 2, here's a script. It depends on the GUI library.
Removing that dependency is possible, but probably a lot of work.

Robby


#lang racket/base
(require racket/gui/base
 racket/port
 racket/class
 framework)

(define (indented-properly? port)
  (define-values (out1 in1) (make-pipe))
  (define-values (out2 in2) (make-pipe))
  (thread (λ ()
(copy-port port in1 in2)
(close-output-port in1)
(close-output-port in2)))
  (define (insert-it port chan)
(thread
 (λ ()
   (define t (new racket:text%))
   (send t insert-port port)
   (channel-put chan t
  (define c1 (make-channel))
  (define c2 (make-channel))
  (insert-it out1 c1)
  (insert-it out2 c2)
  (define t1 (channel-get c1))
  (define t2 (channel-get c2))

  ;; this is the important line
  (send t1 tabify-all)

  ;; this should really compare snips, not characters
  (and (= (send t1 last-position)
  (send t2 last-position))
  (for/and ([x (in-range (send t1 last-position))])
(equal? (send t1 get-character x)
(send t2 get-character x)

(define illindented-candidate
  (string-append
   "#lang racket\n"
   "(define (f x)\n"
   "x)"))
(define well-indented-candidate
  (string-append
   "#lang racket\n"
   "(define (f x)\n"
   "  x)"))
(indented-properly? (open-input-string illindented-candidate))
(indented-properly? (open-input-string well-indented-candidate))



On Thu, Aug 25, 2016 at 3:52 PM, David Christiansen
 wrote:
> Hi all,
>
> As far as I know, the standard for indentation in Racket is "Do like
> DrRacket", after DrRacket has been suitably configured for new syntax
> introduced by the application in question.
>
> I'd like to arrange for this to be enforced by Travis. As far as I can
> see, my building blocks for this are the following:
>
> 1. A way to represent indentation specifications for new syntactic forms
>
> 2. A way to invoke automatic indentation on a file without running a
> GUI, using these specifications in addition to the default rules
>
> Is there a canonical way to achieve these things?
>
> Thanks!
>
> /David
>
> --
> 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] DrRacket's auto-indentation outside DrRacket?

2016-08-25 Thread David Christiansen
Hi all,

As far as I know, the standard for indentation in Racket is "Do like
DrRacket", after DrRacket has been suitably configured for new syntax
introduced by the application in question.

I'd like to arrange for this to be enforced by Travis. As far as I can
see, my building blocks for this are the following:

1. A way to represent indentation specifications for new syntactic forms

2. A way to invoke automatic indentation on a file without running a
GUI, using these specifications in addition to the default rules

Is there a canonical way to achieve these things?

Thanks!

/David

-- 
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] fivethirtyeight indexes reddit

2016-08-25 Thread Daniel Prager
On Fri, Aug 26, 2016 at 2:27 AM, Norman Gray  wrote:

> What this looks consistent with -- given that the vertical axis is a
> fraction not absolute -- is that these terms have stayed roughly constant
> in popularity, but the rest of Reddit has grown exponentially, talking
> about stuff _other than_ programming languages (exotic though such a
> conversation would be).  Is that plausible? (I'm not a Reddit habitué).
>
>
Looks about right to me. Try the terms Clinton and Trump.

Dan

-- 
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] Whalesong instead of Clojurescript

2016-08-25 Thread Daniel Prager
There's also the lighter-weight Urlang: https://github.com/soegaard/urlang

-- 
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] fivethirtyeight indexes reddit

2016-08-25 Thread Andreas Perstinger

On 2016-08-25 18:27, Norman Gray wrote:

What this looks consistent with -- given that the vertical axis is a
fraction not absolute -- is that these terms have stayed roughly
constant in popularity, but the rest of Reddit has grown exponentially,
talking about stuff _other than_ programming languages (exotic though
such a conversation would be).  Is that plausible? (I'm not a Reddit
habitué).


Yes, Reddit just grew up and broadened its topics.


If so, that means that the growth in 'racket', and more so with the more
predictable growth in 'swift', is all the more impressive.


Well there is also a singer named Taylor Swift which IMHO would explain 
this growth. :-)

http://projects.fivethirtyeight.com/reddit-ngram/?keyword=swift.taylor=20071015=20150831=9

And as much as I like Racket (the programming language), I'm pretty sure 
there is a similar explanation for the word "racket" (e.g. the sport 
equipment, the fraudulent scheme, ...)


Bye, Andreas

--
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] fivethirtyeight indexes reddit

2016-08-25 Thread Norman Gray


Greetings.

On 25 Aug 2016, at 17:10, 'John Clements' via Racket Users wrote:


http://projects.fivethirtyeight.com/reddit-ngram/?keyword=racket=20071014=20150831=10

(It’s also a bit sobering to see what happened to Haskell)


That's interesting, but what's happened to Haskell in that graph might 
be deceptive.  I tried looking at the terms racket, haskell, ocaml, 
perl, swift and python, and _all_ of them except 'racket' and 'swift' go 
down in a roughly exponential way.  That's curious for 'haskell' and 
'ocaml', reassuring for 'perl' (die, Perl, die!), but not really 
believable for 'python', which I added as a language that I would expect 
to be fairly level in popularity in those years.


What this looks consistent with -- given that the vertical axis is a 
fraction not absolute -- is that these terms have stayed roughly 
constant in popularity, but the rest of Reddit has grown exponentially, 
talking about stuff _other than_ programming languages (exotic though 
such a conversation would be).  Is that plausible? (I'm not a Reddit 
habitué).


If so, that means that the growth in 'racket', and more so with the more 
predictable growth in 'swift', is all the more impressive.


All the best,

Norman


--
Norman Gray  :  https://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, 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] fivethirtyeight indexes reddit

2016-08-25 Thread Robby Findler
Not just Haskell, apparently?

http://projects.fivethirtyeight.com/reddit-ngram/?keyword=c++.python.ruby.javascript.java.programming=20071015=20150831=22

On Thu, Aug 25, 2016 at 11:10 AM, 'John Clements' via Racket Users
 wrote:
> Apologies to everyone that’s seen this; much like google search trends, but 
> on reddit.
>
> http://projects.fivethirtyeight.com/reddit-ngram/?keyword=racket=20071014=20150831=10
>
> (It’s also a bit sobering to see what happened to Haskell)
>
> 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.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] fivethirtyeight indexes reddit

2016-08-25 Thread 'John Clements' via Racket Users
Apologies to everyone that’s seen this; much like google search trends, but on 
reddit.

http://projects.fivethirtyeight.com/reddit-ngram/?keyword=racket=20071014=20150831=10

(It’s also a bit sobering to see what happened to Haskell)

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] Whalesong instead of Clojurescript

2016-08-25 Thread Matthias Felleisen

The Bootstrap outreach program still uses it for its first course. 


> On Aug 25, 2016, at 9:53 AM, tbrooke  wrote:
> 
> I briefly looked at Whalesong and I was wondering if anyone is using it and 
> if it is mature and ready to use. I use Clojurescript and it seems to me that 
> Whalesong should be equivalent with the advantage of allowing me to work in 
> Racket.
> 
> -- 
> 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] Whalesong instead of Clojurescript

2016-08-25 Thread tbrooke
I briefly looked at Whalesong and I was wondering if anyone is using it and if 
it is mature and ready to use. I use Clojurescript and it seems to me that 
Whalesong should be equivalent with the advantage of allowing me to work in 
Racket.

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