Re: [racket-users] keystroke logger for DrRacket editor?

2015-05-12 Thread Tomi Pieviläinen
On Tue, May 12, 2015 at 11:31:01AM -0700, 'John Clements' via users-redirect 
wrote:
 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?

I never did check the details, but Shriram Krishnamurthi's group did
research on DrRacket users' reactions to error messages. They had some
way to record how the students changed their programs, but don't
remember if it recorded every keypress or only the source code when
the run button was pressed.

Perhaps that's a way to start, at least.

-- 
Tomi Pieviläinen, +358 400 487 504
A: Because it disrupts the natural way of thinking.
Q: Why is top posting frowned upon?

-- 
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] Getting a sandboxed evaluator to work with a custom #lang's reader

2015-05-12 Thread Alexander D. Knauth
I managed to put this together:
https://github.com/AlexKnauth/scribble-code-examples

On May 12, 2015, at 7:10 AM, Alexis King lexi.lam...@gmail.com wrote:

 Continuing my attempts to make a working meta-language, I'm now working on 
 improving the documentation. I'd like to be able to use “interaction” from 
 scribble/eval with a custom evaluator, but I'm having trouble getting a 
 custom evaluator to work with my language.
 
 I've tried using (make-module-evaluator #lang curly-fn racket/base), but 
 that only enables the curly-fn reader for reading the initial program, not 
 the additional input passed to the evaluator.
 
 I have managed to do this sort of thing to get it working.
 
 (parameterize ([sandbox-output 'string]
   [sandbox-error-output 'string]
   [sandbox-reader
(λ (in)
  (parameterize ([current-readtable (make-curly-fn-readtable)])
(reverse
 (let loop ([acc null])
   (define r (read-syntax in (current-input-port)))
   (if (eof-object? r) acc (loop (cons r acc)))])
  (make-module-evaluator #lang curly-fn racket/base))
 
 That works, but I'm wondering if there's a better 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.


Re: [racket-users] Getting a sandboxed evaluator to work with a custom #lang's reader

2015-05-12 Thread Alexander D. Knauth
Is there a way to show examples in scribble docs that uses code?
If there’s not, would something like this be good:
@code-examples[#:lang “at-exp racket”]|{
(+ 1 2)
@+[1 2]
}|

Renders as:
Examples:
   (+ 1 2)
  3
   @+[1 2]
  3
?

On May 12, 2015, at 7:10 AM, Alexis King lexi.lam...@gmail.com wrote:

 Continuing my attempts to make a working meta-language, I'm now working on 
 improving the documentation. I'd like to be able to use “interaction” from 
 scribble/eval with a custom evaluator, but I'm having trouble getting a 
 custom evaluator to work with my language.
 
 I've tried using (make-module-evaluator #lang curly-fn racket/base), but 
 that only enables the curly-fn reader for reading the initial program, not 
 the additional input passed to the evaluator.
 
 I have managed to do this sort of thing to get it working.
 
 (parameterize ([sandbox-output 'string]
   [sandbox-error-output 'string]
   [sandbox-reader
(λ (in)
  (parameterize ([current-readtable (make-curly-fn-readtable)])
(reverse
 (let loop ([acc null])
   (define r (read-syntax in (current-input-port)))
   (if (eof-object? r) acc (loop (cons r acc)))])
  (make-module-evaluator #lang curly-fn racket/base))
 
 That works, but I'm wondering if there's a better 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.

-- 
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] Getting a sandboxed evaluator to work with a custom #lang's reader

2015-05-12 Thread Alexis King
Continuing my attempts to make a working meta-language, I'm now working on 
improving the documentation. I'd like to be able to use “interaction” from 
scribble/eval with a custom evaluator, but I'm having trouble getting a custom 
evaluator to work with my language.

I've tried using (make-module-evaluator #lang curly-fn racket/base), but that 
only enables the curly-fn reader for reading the initial program, not the 
additional input passed to the evaluator.

I have managed to do this sort of thing to get it working.

(parameterize ([sandbox-output 'string]
   [sandbox-error-output 'string]
   [sandbox-reader
(λ (in)
  (parameterize ([current-readtable (make-curly-fn-readtable)])
(reverse
 (let loop ([acc null])
   (define r (read-syntax in (current-input-port)))
   (if (eof-object? r) acc (loop (cons r acc)))])
  (make-module-evaluator #lang curly-fn racket/base))

That works, but I'm wondering if there's a better 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.


Re: [racket-users] Re: Use Parsack to parse a #language?

2015-05-12 Thread Greg Hendershott
 On Mon, May 11, 2015 at 9:40 PM, Daniel Prager
 daniel.a.pra...@gmail.com wrote:

I don't see Daniel's post yet.  Is it just me, or is Google Groups
delaying quite a few messages lately?


 Greg Hendershott can probably fill you in on more unpleasantries, as
 his markdown parser is the biggest client (that I currently know of)

So, my experience with parsing languages -- and parsing generally --
is very thin.

All I know is that I found Parsack delightful to use for parsing markdown.

The fact that Parsack can handle something as weird as markdown,
doesn't necessarily mean that it's inappropriate for something like a
sane language grammar.  Instead I think that, with a sane grammar, you
have additional plausible choices like parser-tools and ragg, and they
might parse faster (?).

-- 
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: Use Parsack to parse a #language?

2015-05-12 Thread Stephen Chang
 Once I get my head around what's needed to connect up a custom
 reader

Matthew's example from his talk at the first RacketCon (and other
conferences) might be a good place to start:
https://github.com/mflatt/scratchy/blob/master/scratchy/reader.rkt
https://github.com/mflatt/scratchy/blob/master/scratchy/parser.rkt

 I seem to recall that Racket used to come with a combinator parser
library. It's been removed but I don't remember why

(Replying to myself) I found the old library. Looks like it was
discontinued for lack of a maintainer.
http://planet.racket-lang.org/package-source/plt/combinator-parser.plt/1/0/planet-docs/combinator-parser/index.html

-- 
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: Use Parsack to parse a #language?

2015-05-12 Thread Asumu Takikawa
On 2015-05-12 00:15:45 -0400, Stephen Chang wrote:
 I seem to recall that Racket used to come with a combinator parser
 library. It's been removed but I don't remember why but maybe that
 could be an indication that it's not a good idea?

It was removed due to bitrot and to reduce the size of the Racket distribution.
It's still available in a minimally-maintained state[1], but there's probably
no reason to use it over parsack.

[1]: https://github.com/takikawa/combinator-parser

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] Use Parsack to parse a #language?

2015-05-12 Thread Daniel Prager
I've been having a great time playing with Stephen Chang's Parsack
http://stchang.github.io/parsack/parsack.html (parsec-style parsing for
Racket) and enjoying the straightforward learning curve and usability.
Thanks Stephen!

Has anyone used Parsack to do the parsing for a little language and then
plugged it into the main Racket infrastructure?

Good idea? Mismatched tool? What does it / would it take?


Thanks

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.


[racket-users] incantation for library module to access a data file in the same directory?

2015-05-12 Thread thomas.lynch
I created a collection, then used raco to install it.

Ran into a problem where a test function within module X in the collection 
accesses a file in the same directory as the source code:

  (define (fun-timed-test-2)
(define ip (open-input-file realtime-test-data.rkt))
(match-define (list completed result) (fun-timed 2 (λ(e#) (read-line ip
(close-input-port ip)
(and completed (string=? result #|))
  )
 
Now when this is run:

  pkgs/liquid-lib/liquid/realtime (fun-timed-test-2)
  ; open-input-file: cannot open input file
  ;   path: /home/deep/liquid-lib/examples/keyword-ap/realtime-test-data.rkt
  ;   system error: No such file or directory; errno=2
  ; [,bt for context]

The test data file is there in the same directory with the module (in 
../realtime/), but racket is looking for the file in the directory the function 
is being invoked from (../examples/keyword-ap/).

I've gone through the documentation, and the collects path doesn't help, 
because this was a directory install, so the catalog is pointing to the 
original source directory.  There is a function (get-module-path)  but I'm not 
sure that is doing what I want, or at least I don't know the correct 
incantation to make it go at it isn't giving me the path back from 
(get-module-path X).

Will someone please share the incantation for getting the path to the data 
file, or otherwise opening it?

-- 
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: Use Parsack to parse a #language?

2015-05-12 Thread Daniel Prager
Hi Stephen

Thanks for the encouragement, and the tips: I was wondering especially
about item 3. Once I get my head around what's needed to connect up a
custom reader, I should be in a position to have a shot ... and ask further
questions.

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.


[racket-users] accessing a directory local file to a module

2015-05-12 Thread thomas.lynch
I apologize if this posted before, but given a day I don't see it here..

I have a function with a companion data file (data file is part of the 
collection).  When I invoke it with a relative path name (just the file name), 
racket looks for it in the directory the function is invoked from, not the 
directory the module is in.

This was ok during development, but now that the module is installed it is a 
problem.  The collects path does not help, as directory install does not move 
the collection.  I think maybe (get-module-path)  but I haven't been able to 
get it work.  

Any tips appreciated!

-- 
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] accessing a directory local file to a module

2015-05-12 Thread Marc Burns
Check out define-runtime-path in the docs

 On May 11, 2015, at 10:19 PM, thomas.lynch 
 thomas.ly...@reasoningtechnology.com wrote:
 
 I apologize if this posted before, but given a day I don't see it here..
 
 I have a function with a companion data file (data file is part of the 
 collection).  When I invoke it with a relative path name (just the file 
 name), racket looks for it in the directory the function is invoked from, not 
 the directory the module is in.
 
 This was ok during development, but now that the module is installed it is a 
 problem.  The collects path does not help, as directory install does not move 
 the collection.  I think maybe (get-module-path)  but I haven't been able to 
 get it work.  
 
 Any tips appreciated!
 
 -- 
 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] incantation for library module to access a data file in the same directory?

2015-05-12 Thread Sam Tobin-Hochstadt
You probably want to use `define-runtime-path`, like this:

```
(require racket/runtime-path)
(define-runtime-path rtd realtime-test-data.rkt)
(define (fun-timed-test-2)
  (define ip (open-input-file rtd))
  ... rest of function ...)
```

Sam

On Tue, May 12, 2015 at 11:42 AM thomas.lynch 
thomas.ly...@reasoningtechnology.com wrote:

 I created a collection, then used raco to install it.

 Ran into a problem where a test function within module X in the collection
 accesses a file in the same directory as the source code:

   (define (fun-timed-test-2)
 (define ip (open-input-file realtime-test-data.rkt))
 (match-define (list completed result) (fun-timed 2 (λ(e#) (read-line
 ip
 (close-input-port ip)
 (and completed (string=? result #|))
   )

 Now when this is run:

   pkgs/liquid-lib/liquid/realtime (fun-timed-test-2)
   ; open-input-file: cannot open input file
   ;   path:
 /home/deep/liquid-lib/examples/keyword-ap/realtime-test-data.rkt
   ;   system error: No such file or directory; errno=2
   ; [,bt for context]

 The test data file is there in the same directory with the module (in
 ../realtime/), but racket is looking for the file in the directory the
 function is being invoked from (../examples/keyword-ap/).

 I've gone through the documentation, and the collects path doesn't help,
 because this was a directory install, so the catalog is pointing to the
 original source directory.  There is a function (get-module-path)  but I'm
 not sure that is doing what I want, or at least I don't know the correct
 incantation to make it go at it isn't giving me the path back from
 (get-module-path X).

 Will someone please share the incantation for getting the path to the data
 file, or otherwise opening it?

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