[racket-users] Re: Package Providing results from another package

2017-01-26 Thread Jack Firth
Usually when this situation arises, the collection is divided as you suggest 
into a `foo/base` module that has minimal dependencies and a small "kernel" 
API, while various `foo/X` modules provide things that either are logically not 
necessary in the base API or may trigger large dependencies. For users that 
don't really care about the dependencies and just want a convenient entrypoint, 
the `foo` collection (implemented by the `foo/main` module) re-provides 
everything from the various `foo/*` modules. However, other libraries like 
`bar` wouldn't be re-provided.

If you're writing a module like `foo/main` that just requires and provides 
other libraries, you can use the `reprovide` package to minimize how much work 
that takes. In your case, a `simple-polynomial/main.rkt` module would be:

#lang reprovide
"base.rkt"
"spline.rkt"

-- 
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] class copy constructors

2017-01-26 Thread Steve Byan's Lists
Never mind, I got it:

(define baz%
  (class object%
(init (foo 0))
(define bar foo)
(super-new)
(define/public (get-bar)
  bar)
(define/public (copy-baz)
  (new baz% [foo (+ (get-bar) 2)]

> (define a (new baz%))
> (send a get-bar)
0
> (define b (send a copy-baz))
> (send b get-bar)
2

In hind-sight, I don't know why it wasn't obvious to me at the time.

Best regards,
-Steve

--  
Steve Byan
steveb...@me.com
Littleton, MA



-- 
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] class copy constructors

2017-01-26 Thread Steve Byan's Lists
I'm trying to make some simple use of Racket's class and object system, but I'm 
having trouble using the documentation to figure out how to accomplish 
something.

I want to create both a no-argument default constructor and a copy-constructor. 
I don't see how to accomplish that. If I declare an initialization variable for 
the copy constructor, I don't see how to provide a default value for that 
initialization variable that would be compatible with field initialization 
expressions that use an "other-object" initialization variable. Further, I 
would really like to provide different field initialization expressions for the 
default constructor and the copy-constructor (the copy-constructor would be a 
recurrence relation and the default constructor would provide the initial 
conditions). 

I could use a Smalltalk-like approach with a default field initialization 
expression and an imperative "copy constructor" that updates the default values 
using set!, but I'd rather take a more functional approach. Could someone 
provide an example of how to accomplish this functionally?


Best regards,
-Steve

--  
Steve Byan
steveb...@me.com
Littleton, MA



-- 
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] Package Providing results from another package

2017-01-26 Thread Deren Dohoda
I have a collection based on polynomial code I wrote which I intend to
release at some time in the near future for some simple data processing
routines. The somewhat optimized underlying data structure for random
access use of one of my procedures would be a tree, but the somewhat
optimized structure for plotting would not be a tree but a simple list of
renderers from the plot package. So I intend to offer a separate procedure
for plotting purposes.

In general, this package would only require racket/base, but this one
particular procedure would require plot. What is the right way to handle
this? Should I only include plot in this particular module and expect the
user to also require plot, or include plot and re-provide all-from-out?
Should it be a separate module for just this procedure to avoid unnecessary
loading of the plot library if it isn't used?

Example collection:
simple-polynomial/base
simple-polynomial/spline (may require plot for one procedure)
etc..

Thanks,
Deren

-- 
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] Thread and filesystem watching

2017-01-26 Thread David Storrs
Thanks for the help, everyone.  This works great.  I especially like
handle-evt -- I had seen it in the Reference when I was reading about
events but didn't understand what it did.  It really makes this easy.



On Wed, Jan 25, 2017 at 8:17 PM, Jon Zeppieri  wrote:

> On Wed, Jan 25, 2017 at 8:03 PM, Matthew Flatt  wrote:
> >
> > The `handle-evt` constructor does that.
> >
> > For example, this loop will print "one" or "two" pseudorandomly,
> depending on whether the first or second semaphore is chosen:
> >
> >  (let loop ()
> >(define e1
> > (handle-evt (make-semaphore 1)
> > (lambda (v)
> >   (printf "one\n")
> >   (loop
> >(define e2
> > (handle-evt (make-semaphore 1)
> > (lambda (v)
> >   (printf "two\n")
> >   (loop
> >(sync e1 e2))
>
> Oh, that's a lot more convenient than I realized. Guess I never gave
> enough thought to the value of the handler being called in tail
> position w.r.t. the sync. -J
>

-- 
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] [ANN] Simple, Deterministic Sets (dset)

2017-01-26 Thread Andrew Kent
Sets now also have a deterministic variant.

Installation:

`raco pkg install dset`


Documentation:

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


Contributions welcome!

https://github.com/pnwamk/dset

Best,
Andrew

-- 
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] Editor-canvas% how to set default style and use set-line-count correctly?

2017-01-26 Thread WarGrey Gyoudmon Ju
On Fri, Jan 27, 2017 at 1:46 AM, WarGrey Gyoudmon Ju 
wrote:
>
> (send card insert (make-object string-snip% "it's a bug of text%,
> snip's style is not (convert)ed, also affects the following inputs")
>

All right, it is not a bug, it's just how it works. the snip's style will
be convert into the-style-list and affects the following inputs.

Sorry for making so much nonsense words.

-- 
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] Editor-canvas% how to set default style and use set-line-count correctly?

2017-01-26 Thread WarGrey Gyoudmon Ju
Update: this solution does work.

I just found the reason why it did not work before.

(define digivice (new frame% [width 800] [height 600] [label "Standard
Style"]))
(define card (make-object text%))
(define darc (new editor-canvas% [parent digivice] [editor card] [style
'(no-border auto-hscroll auto-vscroll)]))
(define font (make-font #:face "Microsoft Himalaya" #:size 16))
(define color (make-object color% "ForestGreen"))

(change-default-style! card #:font font #:color color) ;;; this can be put
in the class body, or do it in editor-canvas%, it's up to you.

(send card insert "works as expected")
(send card insert (make-object string-snip% "it's a bug of text%,
snip's style is not (convert)ed, also affects the following inputs")
(send digivice show #true)
(send digivice center 'both)


On Fri, Jan 27, 2017 at 12:48 AM, WarGrey Gyoudmon Ju  wrote:

> I have these two helpers (typed racket makes it a little verbose).
>
> (define change-style : (->* ((Instance Style<%>))
> (#:font (Option (Instance Font%))
>  #:color (Option (Instance Color%))
>  #:background-color (Option (Instance Color%)))
> (Instance Style<%>))
>   (lambda [style #:font [font #false] #:color [color #false]
> #:background-color [bgcolor #false]]
> (send style set-delta
>   (let* ([style (make-object style-delta%)]
>  [style (if (false? color) style (send style
> set-delta-foreground color))]
>  [style (if (false? bgcolor) style (send style
> set-delta-background bgcolor))])
> (cond [(false? font) style]
>   [else (send* style
>   (set-face (send font get-face))
>   (set-family (send font get-family)))
> (send+ style
>(set-delta 'change-style (send font
> get-style))
>(set-delta 'change-weight (send font
> get-weight))
>(set-delta 'change-smoothing (send font
> get-smoothing))
>(set-delta 'change-underline (send font
> get-underlined))
>(set-delta 'change-size (min (exact-round
> (send font get-size)) 255)))])))
> style))
>
> (define change-default-style! : (->* ((U (Instance Editor<%>) (Instance
> Style-List%)))
>   (#:font (Option (Instance Font%))
>#:color (Option (Instance Color%))
>#:background-color (Option
> (Instance Color%)))
>   (Instance Style<%>))
>   (lambda [src #:font [font #false] #:color [color #false]
> #:background-color [bgcolor #false]]
> (define-values (style-list style-name)
>   (cond [(text%? src) (values (send src get-style-list) (send src
> default-style-name))]
> [(pasteboard%? src) (values (send src get-style-list) (send
> src default-style-name))]
> [else (values (if (style-list%? src) src (make-object
> style-list%)) "Standard")]))
> (change-style #:font font #:color color #:background-color bgcolor
>   (or (send style-list find-named-style style-name)
>   (send style-list new-named-style style-name (send
> style-list basic-style))
>
> 
> 
> ;;
>
> This line is put in the class body of new instance of Editor<%> (not
> editor-canvas%):
>
> (change-default-style! this #:font font ...)
>
> The idea is attaching a style-delta% object to the standard style, then
> the altered style becomes
> the top-level one so that it will never be `undo`ed by accident.
>
> The awkward thing here is, I cannot make it work in a simple example,
> however it works fine in my real world application.
>
>
> On Thu, Jan 26, 2017 at 7:00 PM, Erich Rast  wrote:
>
>> Hi,
>>
>> I have an editor-canvas% subclass and want to set the default style,
>> but adding it with name "Standard" to the-style-list doesn't work. Do
>> I have to replace the style list of the canvas with a new one? Or does
>> the default style of an editor-canvas% have to be called differently?
>> "Basic"?
>>
>> Without the right default style set-line-count also doesn't work as
>> desired. It sets the wrong size for lines with smaller fonts that are
>> added, so I assume this method is based on the default style. But which
>> style is exactly the default style "Basic" or "Standard", and how do I
>> change it?
>>
>> best,
>>
>> Erich
>>
>> -
>>
>> ; Example (sorry, not runnable, because it uses my own preference and
>> ; what I call 'metastyle' impementation)
>> ; layout-init does not really change the style, which
>> ; is why I use 

Re: [racket-users] Editor-canvas% how to set default style and use set-line-count correctly?

2017-01-26 Thread WarGrey Gyoudmon Ju
I have these two helpers (typed racket makes it a little verbose).

(define change-style : (->* ((Instance Style<%>))
(#:font (Option (Instance Font%))
 #:color (Option (Instance Color%))
 #:background-color (Option (Instance Color%)))
(Instance Style<%>))
  (lambda [style #:font [font #false] #:color [color #false]
#:background-color [bgcolor #false]]
(send style set-delta
  (let* ([style (make-object style-delta%)]
 [style (if (false? color) style (send style
set-delta-foreground color))]
 [style (if (false? bgcolor) style (send style
set-delta-background bgcolor))])
(cond [(false? font) style]
  [else (send* style
  (set-face (send font get-face))
  (set-family (send font get-family)))
(send+ style
   (set-delta 'change-style (send font
get-style))
   (set-delta 'change-weight (send font
get-weight))
   (set-delta 'change-smoothing (send font
get-smoothing))
   (set-delta 'change-underline (send font
get-underlined))
   (set-delta 'change-size (min (exact-round
(send font get-size)) 255)))])))
style))

(define change-default-style! : (->* ((U (Instance Editor<%>) (Instance
Style-List%)))
  (#:font (Option (Instance Font%))
   #:color (Option (Instance Color%))
   #:background-color (Option (Instance
Color%)))
  (Instance Style<%>))
  (lambda [src #:font [font #false] #:color [color #false]
#:background-color [bgcolor #false]]
(define-values (style-list style-name)
  (cond [(text%? src) (values (send src get-style-list) (send src
default-style-name))]
[(pasteboard%? src) (values (send src get-style-list) (send src
default-style-name))]
[else (values (if (style-list%? src) src (make-object
style-list%)) "Standard")]))
(change-style #:font font #:color color #:background-color bgcolor
  (or (send style-list find-named-style style-name)
  (send style-list new-named-style style-name (send
style-list basic-style))

;;

This line is put in the class body of new instance of Editor<%> (not
editor-canvas%):

(change-default-style! this #:font font ...)

The idea is attaching a style-delta% object to the standard style, then the
altered style becomes
the top-level one so that it will never be `undo`ed by accident.

The awkward thing here is, I cannot make it work in a simple example,
however it works fine in my real world application.


On Thu, Jan 26, 2017 at 7:00 PM, Erich Rast  wrote:

> Hi,
>
> I have an editor-canvas% subclass and want to set the default style,
> but adding it with name "Standard" to the-style-list doesn't work. Do
> I have to replace the style list of the canvas with a new one? Or does
> the default style of an editor-canvas% have to be called differently?
> "Basic"?
>
> Without the right default style set-line-count also doesn't work as
> desired. It sets the wrong size for lines with smaller fonts that are
> added, so I assume this method is based on the default style. But which
> style is exactly the default style "Basic" or "Standard", and how do I
> change it?
>
> best,
>
> Erich
>
> -
>
> ; Example (sorry, not runnable, because it uses my own preference and
> ; what I call 'metastyle' impementation)
> ; layout-init does not really change the style, which
> ; is why I use set-style for every snip. But then set-line-count
> ; doesn't work as desired.
>
> (define console%
>   (class editor-canvas%
> (inherit scroll-with-bottom-base allow-scroll-to-last)
>
> (define text #f)
> (define console-style #f)
> (define sema (make-semaphore 1))
>
> (define (layout-init)
>   (define style (send the-style-list
>   find-named-style "Basic"))
>   (set! console-style (send the-style-list
> find-or-create-style
> style
> (metastyle->style
> (pref:console-style
>   (send the-style-list new-named-style "Standard" console-style)
>   (set! text
> (new text%
>  [auto-wrap #t]
>  [line-spacing 0]))
>   (send this set-editor text)
>   (scroll-with-bottom-base #t)
>   (allow-scroll-to-last #t)
>   (send this set-line-count 2))
>
> (define (synced-add-line msg)
>   (send text begin-edit-sequence)
>  

Re: [racket-users] Best practice for using .../private files from packages (pict3d)

2017-01-26 Thread WarGrey Gyoudmon Ju
How about merging these primitive geometry APIs into math-lib?


On Thu, Jan 26, 2017 at 8:53 PM, Jay McCarthy 
wrote:

> I think that it is quite common for a big library (especially
> something really big like pict3d) to create a lot of residual useful
> code that could conceivably be their own libraries. I suggest either
> [2] or [3] or even a new package for some sort of more primitive
> notion of geometry.
>
> Jay
>
> On Thu, Jan 26, 2017 at 7:48 AM, Tim Brown  wrote:
> > Folks,
> >
> > I want to access files from a “private” directory of a package -- in this
> > case pict3d -- but I was wondering what the best way to do this is.
> >
> > First a bit of context:
> >
> >   I am using the pict3d library for a project which allows me to render
> and
> >   experiment on various 3D models.
> >
> >   As an aside to that project, I have a small utility that only uses
> >   pict3d’s ‘pos’ and ‘dir’ types (and their algebra libraries)
> >
> >   I am happy for my “lab” to be massive (I need/want to fly through the
> models);
> >   but the utility will be used as part of a build process inside a
> low-memory
> >   docker instance† -- and needs to be quick.
> >
> >   I can `(require pict3d/private/gui/user-types)`; which avoids me
> needing to
> >   link in all the rest of GUI. And that is necessary and sufficient for
> my needs.
> >
> > My issue is with the “private” portion of that module path. It suggests
> > that its content and structure is at the convenience of the package’s
> > owner. From a “public” point of view, external to the package, I wouldn’t
> > expect ‘pos’ and ‘dir’ to disappear. And they are also well documented so
> > they form part of the API. But there is nothing to stop, for example,
> this
> > file from being refactored -- with the change being reconciled within the
> > overall package.
> >
> > So, I see I have a few options:
> >
> >   [1] (require pict3d/private/gui/user-types)
> >   and moan at the package owner if he breaks this for me
> >
> >   [2] Suggest and submit a change which moves
> >   .../pict3d/private/gui/user-types to .../pict3d/gui/user-types --
> >   and clean up the fallout from this, including triggering complaints
> >   a la [1]
> >
> >   [3] Suggest and submit a change which re-exports
> >   .../pict3d/private/gui/user-types from a new
> .../pict3d/gui/user-types
> >   (in fact, I’m not sure there’s anything necessarily “gui” about
> this
> >   part of the code) which to me looks to be the most correct option,
> but:
> > a. is this necessary
> > b. does this put me / the package onto a slippery slope of making
> >everything public
> >
> > Has anyone had any similar experience of using private package files that
> > they could share? Or any other thoughts on the matter.
> >
> > Tim
> >
> > † It took something like 30 minutes to `raco pkg install pict3d` on this
> >   thing, so `raco make _utility_` is probably a non-starter.
> >
> > --
> > Tim Brown CEng MBCS 
> > 
> > City Computing Limited · www.cityc.co.uk
> >   City House · Sutton Park Rd · Sutton · Surrey · SM1 2AE · GB
> > T:+44 20 8770 2110 · F:+44 20 8770 2130
> > 
> > City Computing Limited registered in London No:1767817.
> > Registered Office: City House, Sutton Park Road, Sutton, Surrey, SM1 2AE
> > VAT No: GB 918 4680 96
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Jay McCarthy
> Associate Professor
> PLT @ CS @ UMass Lowell
> http://jeapostrophe.github.io
>
>"Wherefore, be not weary in well-doing,
>   for ye are laying the foundation of a great work.
> And out of small things proceedeth that which is great."
>   - D 64:33
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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

2017-01-26 Thread Greg Trzeciak
On Wednesday, January 25, 2017 at 2:03:46 PM UTC+1, gustavo wrote:
> Is it possible to offer to run the migrate process automatically
> during the setup? I guess most users (i.e. me) expect and want it.
> 
> It would be also useful to check that the user had at least installed
> one package in the previous version. For multiuser installations,
> perhaps also offer to migrate the packages when DrRacket starts for
> the first time.
> 
> Gustavo

+1 

>From UX perspective that would be a great improvement. As an example:
I personally prefer Solarized theme for my work in DrRacket and I got it from a 
downloaded package, but whenever I update Racket after copying packages from 
previous version I still need to reapply the settings. If there would be an 
option in the installer to "keep the packages" all the preferences for DrRacket 
could be kept as well making the process seamless for the end user.

Question: do round number updates (eg. upcoming 7.0) have any significance in 
Racket release cycle (eg. some major/breaking changes, etc.) or is it just 
business as usual?

As an aside - great job with such regular updates! It is quite a novel 
experience!

-- 
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] Best practice for using .../private files from packages (pict3d)

2017-01-26 Thread Jay McCarthy
I think that it is quite common for a big library (especially
something really big like pict3d) to create a lot of residual useful
code that could conceivably be their own libraries. I suggest either
[2] or [3] or even a new package for some sort of more primitive
notion of geometry.

Jay

On Thu, Jan 26, 2017 at 7:48 AM, Tim Brown  wrote:
> Folks,
>
> I want to access files from a “private” directory of a package -- in this
> case pict3d -- but I was wondering what the best way to do this is.
>
> First a bit of context:
>
>   I am using the pict3d library for a project which allows me to render and
>   experiment on various 3D models.
>
>   As an aside to that project, I have a small utility that only uses
>   pict3d’s ‘pos’ and ‘dir’ types (and their algebra libraries)
>
>   I am happy for my “lab” to be massive (I need/want to fly through the 
> models);
>   but the utility will be used as part of a build process inside a low-memory
>   docker instance† -- and needs to be quick.
>
>   I can `(require pict3d/private/gui/user-types)`; which avoids me needing to
>   link in all the rest of GUI. And that is necessary and sufficient for my 
> needs.
>
> My issue is with the “private” portion of that module path. It suggests
> that its content and structure is at the convenience of the package’s
> owner. From a “public” point of view, external to the package, I wouldn’t
> expect ‘pos’ and ‘dir’ to disappear. And they are also well documented so
> they form part of the API. But there is nothing to stop, for example, this
> file from being refactored -- with the change being reconciled within the
> overall package.
>
> So, I see I have a few options:
>
>   [1] (require pict3d/private/gui/user-types)
>   and moan at the package owner if he breaks this for me
>
>   [2] Suggest and submit a change which moves
>   .../pict3d/private/gui/user-types to .../pict3d/gui/user-types --
>   and clean up the fallout from this, including triggering complaints
>   a la [1]
>
>   [3] Suggest and submit a change which re-exports
>   .../pict3d/private/gui/user-types from a new .../pict3d/gui/user-types
>   (in fact, I’m not sure there’s anything necessarily “gui” about this
>   part of the code) which to me looks to be the most correct option, but:
> a. is this necessary
> b. does this put me / the package onto a slippery slope of making
>everything public
>
> Has anyone had any similar experience of using private package files that
> they could share? Or any other thoughts on the matter.
>
> Tim
>
> † It took something like 30 minutes to `raco pkg install pict3d` on this
>   thing, so `raco make _utility_` is probably a non-starter.
>
> --
> Tim Brown CEng MBCS 
> 
> City Computing Limited · www.cityc.co.uk
>   City House · Sutton Park Rd · Sutton · Surrey · SM1 2AE · GB
> T:+44 20 8770 2110 · F:+44 20 8770 2130
> 
> City Computing Limited registered in London No:1767817.
> Registered Office: City House, Sutton Park Road, Sutton, Surrey, SM1 2AE
> VAT No: GB 918 4680 96
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

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

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


[racket-users] Best practice for using .../private files from packages (pict3d)

2017-01-26 Thread Tim Brown
Folks,

I want to access files from a “private” directory of a package -- in this
case pict3d -- but I was wondering what the best way to do this is.

First a bit of context:

  I am using the pict3d library for a project which allows me to render and
  experiment on various 3D models.

  As an aside to that project, I have a small utility that only uses
  pict3d’s ‘pos’ and ‘dir’ types (and their algebra libraries)

  I am happy for my “lab” to be massive (I need/want to fly through the models);
  but the utility will be used as part of a build process inside a low-memory
  docker instance† -- and needs to be quick.

  I can `(require pict3d/private/gui/user-types)`; which avoids me needing to
  link in all the rest of GUI. And that is necessary and sufficient for my 
needs.

My issue is with the “private” portion of that module path. It suggests
that its content and structure is at the convenience of the package’s
owner. From a “public” point of view, external to the package, I wouldn’t
expect ‘pos’ and ‘dir’ to disappear. And they are also well documented so
they form part of the API. But there is nothing to stop, for example, this
file from being refactored -- with the change being reconciled within the
overall package.

So, I see I have a few options:

  [1] (require pict3d/private/gui/user-types)
  and moan at the package owner if he breaks this for me

  [2] Suggest and submit a change which moves
  .../pict3d/private/gui/user-types to .../pict3d/gui/user-types --
  and clean up the fallout from this, including triggering complaints
  a la [1]

  [3] Suggest and submit a change which re-exports
  .../pict3d/private/gui/user-types from a new .../pict3d/gui/user-types
  (in fact, I’m not sure there’s anything necessarily “gui” about this
  part of the code) which to me looks to be the most correct option, but:
a. is this necessary
b. does this put me / the package onto a slippery slope of making
   everything public

Has anyone had any similar experience of using private package files that
they could share? Or any other thoughts on the matter.

Tim

† It took something like 30 minutes to `raco pkg install pict3d` on this
  thing, so `raco make _utility_` is probably a non-starter.

-- 
Tim Brown CEng MBCS 

City Computing Limited · www.cityc.co.uk
  City House · Sutton Park Rd · Sutton · Surrey · SM1 2AE · GB
T:+44 20 8770 2110 · F:+44 20 8770 2130

City Computing Limited registered in London No:1767817.
Registered Office: City House, Sutton Park Road, Sutton, Surrey, SM1 2AE
VAT No: GB 918 4680 96

-- 
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] Editor-canvas% how to set default style and use set-line-count correctly?

2017-01-26 Thread Erich Rast
Hi,

I have an editor-canvas% subclass and want to set the default style,
but adding it with name "Standard" to the-style-list doesn't work. Do
I have to replace the style list of the canvas with a new one? Or does
the default style of an editor-canvas% have to be called differently?
"Basic"?

Without the right default style set-line-count also doesn't work as
desired. It sets the wrong size for lines with smaller fonts that are
added, so I assume this method is based on the default style. But which
style is exactly the default style "Basic" or "Standard", and how do I
change it?

best,

Erich

-

; Example (sorry, not runnable, because it uses my own preference and
; what I call 'metastyle' impementation)
; layout-init does not really change the style, which
; is why I use set-style for every snip. But then set-line-count
; doesn't work as desired.

(define console%
  (class editor-canvas%
(inherit scroll-with-bottom-base allow-scroll-to-last)

(define text #f)
(define console-style #f)
(define sema (make-semaphore 1))

(define (layout-init)
  (define style (send the-style-list
  find-named-style "Basic"))
  (set! console-style (send the-style-list
find-or-create-style
style
(metastyle->style
(pref:console-style
  (send the-style-list new-named-style "Standard" console-style)
  (set! text
(new text%
 [auto-wrap #t]
 [line-spacing 0]))
  (send this set-editor text)
  (scroll-with-bottom-base #t)
  (allow-scroll-to-last #t)
  (send this set-line-count 2))

(define (synced-add-line msg)
  (send text begin-edit-sequence)
  (send text set-position (send text last-position))
  (define snip (make-object string-snip% msg))
  (send snip set-style console-style)
  (send text insert #\newline)
  (send text insert snip)
  (send text end-edit-sequence)
  (send text scroll-to-position (send text last-position))
  (semaphore-post sema))

(define/public (add-line msg)
  (call-with-semaphore
   sema
   (lambda ()
 (synced-add-line msg

(define/public (show-message msg delay)
  (if (> delay 0)
  (call-once/delayed
   (lambda ()
 (queue-callback
  (lambda ()
(send this add-line msg
   delay)
  (add-line msg)))

(super-new
 [style '(auto-vscroll auto-hscroll no-border no-focus transparent)]
 [wheel-step 1]
 [scrolls-per-page 10]
 [stretchable-height #f])
(layout-init)))


-- 
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] Auto-generating pdf/html from xml/ascii-Input based on racket/scribble/texlive...possible?

2017-01-26 Thread Daniel Brunner
Well, it depends a bit on your use case. I use Scribble nowadays for a
lot of documentation tasks (taking notes at meetings with customer,
documentation of software, technical papers, business related
documents). I even managed to get Scribble to use our company's LaTeX
class.

Am 25.01.2017 um 18:05 schrieb meino.cra...@gmx.de:
> Hi,
> 
> to create html/pdf-documentation from xml/ascii-sources I want to
> use racket/scribble/texinfo.
> 
> Is it a good idea? Is it possible? Or is it a academic approach only (read: 
> pain)? ;)
> 
> Thanks a lot for any help!
> 
> Cheers
> Meino
> 
> 

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