[racket-users] Importing untyped class into typed racket

2016-09-20 Thread Sourav Datta
Is it possible to import an untyped class into typed Racket? I know how to 
require for functions or structs but there seems to be no documentation about 
classes. Thanks!

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


[racket-users] Has anyone generated Open Office or Google Docs from scribble source?

2016-09-20 Thread Kathi Fisler
We have a bunch of exercise handouts (for Bootstrap) in scribble format, and 
users who want them as editable Google Docs (for distribution within their 
school's LMS).  Does anyone have a backend for scribble docs that produces a 
format that can upload as an editable Gdoc?  It looks like OpenOffice has an 
xml format, for example, which I suspect scribble could target (at least in 
theory).

thanks,
Kathi

-- 
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] Has anyone generated Open Office or Google Docs from scribble source?

2016-09-20 Thread Jens Axel Søgaard
Worth a try: Use the html-backend for Scribble and import it in Google Docs.

/Jens Axel


2016-09-20 12:54 GMT+02:00 Kathi Fisler :

> We have a bunch of exercise handouts (for Bootstrap) in scribble format,
> and users who want them as editable Google Docs (for distribution within
> their school's LMS).  Does anyone have a backend for scribble docs that
> produces a format that can upload as an editable Gdoc?  It looks like
> OpenOffice has an xml format, for example, which I suspect scribble could
> target (at least in theory).
>
> thanks,
> Kathi
>
> --
> 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.
>



-- 
-- 
Jens Axel Søgaard

-- 
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] Is it neccessary to learn how to define new language?

2016-09-20 Thread Lin Lee
thanks for your advice .
 Recently,I want to rewrite a web application ,it's about a survey system. I 
plan to use Racket to do this.

-- 
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 to add undo functionality to text% editor?

2016-09-20 Thread Alex Harsanyi
Consider the following example (this is pretty much the code from 
http://docs.racket-lang.org/gui/editor-overview.html?q=text%25 except I also 
added a text-field%):

#lang racket/gui
(define f (new frame% [label "Simple Edit"]
  [width 200]
  [height 200]))
(define c (new editor-canvas% [parent f]))
(define t (new text%))
(send c set-editor t)

(new text-field% [parent f] [label ""] [style '(multiple)])

(define mb (new menu-bar% [parent f]))
(define m-edit (new menu% [label "Edit"] [parent mb]))
(define m-font (new menu% [label "Font"] [parent mb]))
(append-editor-operation-menu-items m-edit #f)
(append-editor-font-menu-items m-font)

(send f show #t)

In the text% editor, normal text operations (select all, cut/copy/paste) work 
fine, but undo does not, the undo menu is grayed out and Ctrl-Z does not work.  
Undo works fine in the text-field% below.

How do I add undo functionality to text%?

Thanks,
Alex.

-- 
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] Importing untyped class into typed racket

2016-09-20 Thread Matthias Felleisen

> On Sep 20, 2016, at 4:23 AM, Sourav Datta  wrote:
> 
> Is it possible to import an untyped class into typed Racket? I know how to 
> require for functions or structs but there seems to be no documentation about 
> classes. Thanks!



That is the break-though of Asumu’s addition. Here is a simple example, because 
I couldn’t find one in the docs: 

#lang racket

(module server racket
  (provide C%)

  (define C%
(class object%
  (init-field world)
  (super-new)
  (define/public (hello)
world

(module client typed/racket
  (require/typed (submod ".." server)
 (C% (Class (init-field (world String)) (hello (-> String)
  (send (new C% [world "good bye"]) hello))

(require 'client)

-- 
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] How to add undo functionality to text% editor?

2016-09-20 Thread Matthew Flatt
Use the `set-max-undo-history` method to enable undo history:

 (send m-edit set-max-undo-history 1000)


At Tue, 20 Sep 2016 06:24:49 -0700 (PDT), Alex Harsanyi wrote:
> Consider the following example (this is pretty much the code from 
> http://docs.racket-lang.org/gui/editor-overview.html?q=text%25 except I also 
> added a text-field%):
> 
> #lang racket/gui
> (define f (new frame% [label "Simple Edit"]
>   [width 200]
>   [height 200]))
> (define c (new editor-canvas% [parent f]))
> (define t (new text%))
> (send c set-editor t)
> 
> (new text-field% [parent f] [label ""] [style '(multiple)])
> 
> (define mb (new menu-bar% [parent f]))
> (define m-edit (new menu% [label "Edit"] [parent mb]))
> (define m-font (new menu% [label "Font"] [parent mb]))
> (append-editor-operation-menu-items m-edit #f)
> (append-editor-font-menu-items m-font)
> 
> (send f show #t)
> 
> In the text% editor, normal text operations (select all, cut/copy/paste) work 
> fine, but undo does not, the undo menu is grayed out and Ctrl-Z does not 
> work.  Undo works fine in the text-field% below.
> 
> How do I add undo functionality to text%?
> 
> Thanks,
> Alex.
> 
> -- 
> 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] note about info.rkt in package conflicts docs?

2016-09-20 Thread Matthew Flatt
Yes, the documentation should be revised to exclude "info.rkt" as a
source of conflicts.

At Mon, 19 Sep 2016 12:29:52 -0400, "'John Clements' via Racket Users" wrote:
> I’m separating a package into -lib and -test packages for the first time, and 
> I’m wondering about the collection-level package files. Specifically, suppose 
> that the packages foo-lib and foo-test both contribute files to the foo 
> collection. Can each package contain its own foo/info.rkt file? Based on the 
> existing htdp libraries and on my experiments, the answer is yes. If this 
> appears in the documentation, I can’t find it. Indeed, I find this text in 
> the 
> section labeled “Package Conflicts”:
> 
> For the purposes of conflicts, a module is a file that ends in ".rkt", ".ss", 
> or ".scrbl”.
> 
> Would it make sense to amend this to
> 
> For the purposes of conflicts, a module is a file that ends in ".rkt", ".ss", 
> or ".scrbl” and is not “info.rkt”.
> 
> ?
> 
> As I write this, though, I find myself wondering about info.rkt files in 
> nested directories, and info.ss files, and differently named files written in 
> the #lang info language. Am I missing some existing documentation?
> 
> 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.
> 
> --
> [application/pgp-signature "signature.asc"] [~/Desktop & open] [~/Temp & open]

-- 
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] Thanks for slideshow, racket/gui, and the rest!

2016-09-20 Thread David Christiansen
Today I delivered a talk at ICFP with slides written in slideshow,
with an embedded Idris interactive editor and REPL. The slides got
good feedback from the audience. I used a similar setup for my PhD
defense in January.

Thanks so much to Matthew, Robby, and the rest of you for all the hard
work on slideshow, pict, and the editor framework that allowed me to
do this!

/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] Importing untyped class into typed racket

2016-09-20 Thread Sourav Datta
On Tuesday, September 20, 2016 at 7:41:23 PM UTC+5:30, Matthias Felleisen wrote:
> > On Sep 20, 2016, at 4:23 AM, Sourav Datta  wrote:
> > 
> > Is it possible to import an untyped class into typed Racket? I know how to 
> > require for functions or structs but there seems to be no documentation 
> > about classes. Thanks!
> 
> 
> 
> That is the break-though of Asumu’s addition. Here is a simple example, 
> because I couldn’t find one in the docs: 
> 
> #lang racket
> 
> (module server racket
>   (provide C%)
> 
>   (define C%
> (class object%
>   (init-field world)
>   (super-new)
>   (define/public (hello)
> world
> 
> (module client typed/racket
>   (require/typed (submod ".." server)
>  (C% (Class (init-field (world String)) (hello (-> String)
>   (send (new C% [world "good bye"]) hello))
> 
> (require 'client)

Awesome, thanks!

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


[racket-users] Re: DrRacket 6.5 + OS X El Capitan = slow execution

2016-09-20 Thread An Onlooker
The same issue. Evaluating

"apple"

takes 4.5 seconds, a middle-size function takes 12 seconds.

user@>pacman -Q racket
racket 6.6-1

Linux 4.6.2-1-ARCH #1 SMP PREEMPT x86_64 GNU/Linux

CPU: Athlon, 2 GHz.

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

2016-09-20 Thread An Onlooker
By a stopwatch.
вторник, 16 августа 2016 г., 11:16:19 UTC+3 пользователь Ivan Kuzmin написал:
> P.S. May be it is just some strange cognitive effect. Is there a way to 
> measure time from run button pressing to printing execution results precisely 
> and objectively somehow?

-- 
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] Why is 3d3 a number?

2016-09-20 Thread Ben Greenman
Just confused, is there any reason that 'd' 'e' 'f' 's' 'l' are all
accepted as exp-mark s?
http://docs.racket-lang.org/reference/reader.html%20numbers#%28part._parse-number%29


Before I came here I asked Wolfram Alpha. It says:
- 3d3 is probably "3 dice with 3 sides each" and prints a histogram of
probabilities
- 3e3 is 3000. (Phew)
- 3f3 is probably "3 degrees farenheit, cubed". No histogram.
- 3s3 is probably "3 seconds cubed". But it also offers to find roots for
"y = 3f3".
- 3l3 is "fruit fly gene".

-- 
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: Why is 3d3 a number?

2016-09-20 Thread Ben Greenman
Oh! Just found that common lisp used these for types:
- s = short
- f = single
- d = double
- l = long

http://www.gigamonkeys.com/book/numbers-characters-and-strings.html

Is this still true for Racket?

On Tue, Sep 20, 2016 at 11:25 AM, Ben Greenman 
wrote:

> Just confused, is there any reason that 'd' 'e' 'f' 's' 'l' are all
> accepted as exp-mark s?
> http://docs.racket-lang.org/reference/reader.html%
> 20numbers#%28part._parse-number%29
>
>
> Before I came here I asked Wolfram Alpha. It says:
> - 3d3 is probably "3 dice with 3 sides each" and prints a histogram of
> probabilities
> - 3e3 is 3000. (Phew)
> - 3f3 is probably "3 degrees farenheit, cubed". No histogram.
> - 3s3 is probably "3 seconds cubed". But it also offers to find roots for
> "y = 3f3".
> - 3l3 is "fruit fly gene".
>
>

-- 
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: Why is 3d3 a number?

2016-09-20 Thread Asumu Takikawa
On 2016-09-20 11:27:07 -0400, Ben Greenman wrote:
>Oh! Just found that common lisp used these for types:
>- s = short
>- f = single
>- d = double
>- l = long

I think it's more specifically an R6RS thing. Quoth the standard:

  In systems with inexact number objects of varying precisions, it may be useful
  to specify the precision of a constant. For this purpose, representations of
  number objects may be written with an exponent marker that indicates the
  desired precision of the inexact representation. The letters s, f, d, and l
  specify the use of short, single, double, and long precision, respectively.
  (When fewer than four internal inexact representations exist, the four size
  specifications are mapped onto those available. For example, an implementation
  with two internal representations may map short and single together and long
  and double together.) In addition, the exponent marker e specifies the default
  precision for the implementation. The default precision has at least as much
  precision as double, but implementations may wish to allow this default to be
  set by the user.

  http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-7.html#node_sec_4.2.8

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.


Re: [racket-users] Re: Why is 3d3 a number?

2016-09-20 Thread Ben Greenman
Whew, fantastic! Thank you.
(Should I tell the Fundamentals I students about R6RS?)


On Tue, Sep 20, 2016 at 11:32 AM, Asumu Takikawa 
wrote:

> On 2016-09-20 11:27:07 -0400, Ben Greenman wrote:
> >Oh! Just found that common lisp used these for types:
> >- s = short
> >- f = single
> >- d = double
> >- l = long
>
> I think it's more specifically an R6RS thing. Quoth the standard:
>
>   In systems with inexact number objects of varying precisions, it may be
> useful
>   to specify the precision of a constant. For this purpose,
> representations of
>   number objects may be written with an exponent marker that indicates the
>   desired precision of the inexact representation. The letters s, f, d,
> and l
>   specify the use of short, single, double, and long precision,
> respectively.
>   (When fewer than four internal inexact representations exist, the four
> size
>   specifications are mapped onto those available. For example, an
> implementation
>   with two internal representations may map short and single together and
> long
>   and double together.) In addition, the exponent marker e specifies the
> default
>   precision for the implementation. The default precision has at least as
> much
>   precision as double, but implementations may wish to allow this default
> to be
>   set by the user.
>
>   http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-7.html#node_sec_4.2.8
>
> 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.


Re: [racket-users] Re: Why is 3d3 a number?

2016-09-20 Thread Asumu Takikawa
On 2016-09-20 11:32:35 -0400, Asumu Takikawa wrote:
>   For example, an implementation with two internal representations may map
>   short and single together and long and double together.

BTW, I think this is what Racket does. It just has single and double.

  > 283403902385293s1
  2.834039f+15
  > 283403902385293f1
  2.834039f+15
  > 283403902385293d1
  2.83403902385293e+15
  > 283403902385293l1
  2.83403902385293e+15

As noted in the Reference:

Inexact real numbers are implemented as either single- or double-precision
  IEEE floating-point numbers—the latter by default, and the former only when a
  computation starts with numerical constants specified as single-precision
  numbers.

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

2016-09-20 Thread Tobias Gerdin
Hello,

Thanks for Racket, it really is great.

Is the web-server of production quality?
Does it support IDN[1] hostnames?

-Tobias

[1]: https://en.wikipedia.org/wiki/Internationalized_domain_name

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

Jay

>
> -Tobias
>
> [1]: https://en.wikipedia.org/wiki/Internationalized_domain_name
>
> --
> 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&C 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] Re: Why is 3d3 a number?

2016-09-20 Thread Robby Findler
Patches to the reader for a more sane number syntax to be used in the
teaching languages are welcome. Note that we already have some of
these in place, as 1.2 reads as a rational in the teaching languages.

Robby


On Tue, Sep 20, 2016 at 10:39 AM, Ben Greenman
 wrote:
> Whew, fantastic! Thank you.
> (Should I tell the Fundamentals I students about R6RS?)
>
>
> On Tue, Sep 20, 2016 at 11:32 AM, Asumu Takikawa 
> wrote:
>>
>> On 2016-09-20 11:27:07 -0400, Ben Greenman wrote:
>> >Oh! Just found that common lisp used these for types:
>> >- s = short
>> >- f = single
>> >- d = double
>> >- l = long
>>
>> I think it's more specifically an R6RS thing. Quoth the standard:
>>
>>   In systems with inexact number objects of varying precisions, it may be
>> useful
>>   to specify the precision of a constant. For this purpose,
>> representations of
>>   number objects may be written with an exponent marker that indicates the
>>   desired precision of the inexact representation. The letters s, f, d,
>> and l
>>   specify the use of short, single, double, and long precision,
>> respectively.
>>   (When fewer than four internal inexact representations exist, the four
>> size
>>   specifications are mapped onto those available. For example, an
>> implementation
>>   with two internal representations may map short and single together and
>> long
>>   and double together.) In addition, the exponent marker e specifies the
>> default
>>   precision for the implementation. The default precision has at least as
>> much
>>   precision as double, but implementations may wish to allow this default
>> to be
>>   set by the user.
>>
>>   http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-7.html#node_sec_4.2.8
>>
>> 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.

-- 
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] Thanks for slideshow, racket/gui, and the rest!

2016-09-20 Thread Robby Findler
I saw the talk and thought it was great!

Robby


On Tue, Sep 20, 2016 at 9:22 AM, David Christiansen
 wrote:
> Today I delivered a talk at ICFP with slides written in slideshow,
> with an embedded Idris interactive editor and REPL. The slides got
> good feedback from the audience. I used a similar setup for my PhD
> defense in January.
>
> Thanks so much to Matthew, Robby, and the rest of you for all the hard
> work on slideshow, pict, and the editor framework that allowed me to
> do this!
>
> /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] Has anyone generated Open Office or Google Docs from scribble source?

2016-09-20 Thread Matt Jadud
Hi Kathi,

PrinceXML makes pretty PDFs of the output Scribble documentation.

I downloaded it, installed it, pointed it at a Scribbled page, and the PDF
was nice; links were preserved, mostly.

prince https://docs.racket-lang.org/scribble/ -o scribble.pdf
I don't know if PDFs will work for your user(s)? I know it's not what you
asked for...

Cheers,
Matt


On Tue, Sep 20, 2016 at 6:54 AM, Kathi Fisler  wrote:

> We have a bunch of exercise handouts (for Bootstrap) in scribble format,
> and users who want them as editable Google Docs (for distribution within
> their school's LMS).  Does anyone have a backend for scribble docs that
> produces a format that can upload as an editable Gdoc?  It looks like
> OpenOffice has an xml format, for example, which I suspect scribble could
> target (at least in theory).
>
> thanks,
> Kathi
>
> --
> 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] How to add undo functionality to text% editor?

2016-09-20 Thread Alex Harsanyi
Thanks for that, it worked.  

Is there a reason why a new text% object has undo disabled? I could not find 
any mention of it in the documentation and 'set-max-undo-history' is not the 
first place one would look :-)

Thanks again,
Alex.

On Tuesday, September 20, 2016 at 10:14:03 PM UTC+8, Matthew Flatt wrote:
> Use the `set-max-undo-history` method to enable undo history:
> 
>  (send m-edit set-max-undo-history 1000)
> 
> 
> At Tue, 20 Sep 2016 06:24:49 -0700 (PDT), Alex Harsanyi wrote:
> > Consider the following example (this is pretty much the code from 
> > http://docs.racket-lang.org/gui/editor-overview.html?q=text%25 except I 
> > also 
> > added a text-field%):
> > 
> > #lang racket/gui
> > (define f (new frame% [label "Simple Edit"]
> >   [width 200]
> >   [height 200]))
> > (define c (new editor-canvas% [parent f]))
> > (define t (new text%))
> > (send c set-editor t)
> > 
> > (new text-field% [parent f] [label ""] [style '(multiple)])
> > 
> > (define mb (new menu-bar% [parent f]))
> > (define m-edit (new menu% [label "Edit"] [parent mb]))
> > (define m-font (new menu% [label "Font"] [parent mb]))
> > (append-editor-operation-menu-items m-edit #f)
> > (append-editor-font-menu-items m-font)
> > 
> > (send f show #t)
> > 
> > In the text% editor, normal text operations (select all, cut/copy/paste) 
> > work 
> > fine, but undo does not, the undo menu is grayed out and Ctrl-Z does not 
> > work.  Undo works fine in the text-field% below.
> > 
> > How do I add undo functionality to text%?
> > 
> > Thanks,
> > Alex.
> > 
> > -- 
> > 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] How to add undo functionality to text% editor?

2016-09-20 Thread Robby Findler
It is a performance issue and the default saves memory when one creates a
lot of little text% objects.

Maybe we should add something to the docs. Where did you look?

Robby

On Wednesday, September 21, 2016, Alex Harsanyi 
wrote:

> Thanks for that, it worked.
>
> Is there a reason why a new text% object has undo disabled? I could not
> find any mention of it in the documentation and 'set-max-undo-history' is
> not the first place one would look :-)
>
> Thanks again,
> Alex.
>
> On Tuesday, September 20, 2016 at 10:14:03 PM UTC+8, Matthew Flatt wrote:
> > Use the `set-max-undo-history` method to enable undo history:
> >
> >  (send m-edit set-max-undo-history 1000)
> >
> >
> > At Tue, 20 Sep 2016 06:24:49 -0700 (PDT), Alex Harsanyi wrote:
> > > Consider the following example (this is pretty much the code from
> > > http://docs.racket-lang.org/gui/editor-overview.html?q=text%25 except
> I also
> > > added a text-field%):
> > >
> > > #lang racket/gui
> > > (define f (new frame% [label "Simple Edit"]
> > >   [width 200]
> > >   [height 200]))
> > > (define c (new editor-canvas% [parent f]))
> > > (define t (new text%))
> > > (send c set-editor t)
> > >
> > > (new text-field% [parent f] [label ""] [style '(multiple)])
> > >
> > > (define mb (new menu-bar% [parent f]))
> > > (define m-edit (new menu% [label "Edit"] [parent mb]))
> > > (define m-font (new menu% [label "Font"] [parent mb]))
> > > (append-editor-operation-menu-items m-edit #f)
> > > (append-editor-font-menu-items m-font)
> > >
> > > (send f show #t)
> > >
> > > In the text% editor, normal text operations (select all,
> cut/copy/paste) work
> > > fine, but undo does not, the undo menu is grayed out and Ctrl-Z does
> not
> > > work.  Undo works fine in the text-field% below.
> > >
> > > How do I add undo functionality to text%?
> > >
> > > Thanks,
> > > Alex.
> > >
> > > --
> > > 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] How to add undo functionality to text% editor?

2016-09-20 Thread Alex Harsanyi
On Wednesday, September 21, 2016 at 10:42:33 AM UTC+8, Robby Findler wrote:
> It is a performance issue and the default saves memory when one creates a lot 
> of little text% objects. 
> 
> 
> Maybe we should add something to the docs. Where did you look?

The overview section for editors could include a paragraph for enabling the 
"undo" functionality, this is where I went when all else failed :-)

http://docs.racket-lang.org/gui/editor-overview.html?q=text%25

When I noticed that undo was not working, I searched the text% documentation 
for the word undo, could not find any mention of enabling it. Also, what 
confused me is that the documentation for the "add-undo" method 
mentions:

The system automatically installs undo records to undo built-in editor
operations, such as inserts, deletes, and font changes. Install an 
undoer only when it is necessary to maintain state or handle operations 
that are not built-in.

I took that to mean that everything should work if I just manipulate the text
and don't add my own snips.  Perhaps this paragraph could mention that the undo
limit is 0 by default and it should be set to a non-zero value using 
`set-max-undo-history`.

Best Regards,
Alex.

-- 
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-20 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 shell