[racket-users] a matrix question

2018-03-25 Thread Tim Hanson
hi, 

I'm trying out matrices (without typed racket, though I read the performance 
caveat -- I'm not worried about performance at the moment) and am trying to 
find the best idioms for a small function I'd like to build.

Q1: is there an elegant away to assemble a matrix column-wise? (my first draft 
solution is to read one col-matrix and write cell by cell into a destination 
(mutable) matrix); my preference would be to use immutable items, but that's 
secondary to elegance at this point.

cheers,

Tim

-- 
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: Splitting up a GUI source file?

2018-03-25 Thread Jack Firth
On Friday, March 23, 2018 at 8:39:52 AM UTC-7, HiPhish wrote: 
>
> I might reconsider the rentals part, but that's not relevant at the 
> moment. My
> problem is that even though the three panes don't need to know anything 
> about
> each other, they need to know about their parent (the main tab view), I 
> cannot
> split the code into a module hierarchy like the tree.
>
>   (define main-window (new frame% [label "Library"]))
>   (define main-tab-view (new tab-panel% [parent main-window]))
>
>   (define books-panel (new vertical-panel% [parent main-tab-view]))
>   (define books-table (new list-view% [parent books-pane]))
>   (define books-buttons-pane (new horizontal-pane% [parent books-panel]))
>   (define add-button (new button% [parent books-buttons-pane]))
>   (define remove-button (new button% [parent books-buttons-pane]))
>   (define rent-button (new button% [parent books-buttons-pane]))
>
>
> And so on. This isn't much code, but add in all the callbacks and events, 
> and
> repeat that for all the three views, and the code quickly starts adding up.
> How should I break it up into smaller modules?
>

What about defining functions that accept the parent as an argument? That's 
essentially what creating a subclass with an init parameter does, but in a 
less roundabout way:

  (define main-window (new frame% [label "Library"]))
  (define (main-tab-view p) (new tab-panel% [parent p]))
  (define (books-panel p) (new vertical-panel% [parent p]))
  (define (books-table p) (new list-view% [parent p]))
  (define (books-buttons-pane p) (new horizontal-pane% [parent p]))
  (define (add-button p) (new button% [parent p]))
  (define (remove-button p) (new button% [parent p]))
  (define (rent-button p) (new button% [parent p]))

This assumes that the only thing tying these objects together is the 
parent-child relationship. If you've got more cross-component references 
then subclasses might be more manageable. Disclaimer: I'm not very familiar 
with Racket's class system or its GUI system, as I don't typically use 
either in my projects.

-- 
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] a matrix question

2018-03-25 Thread Jens Axel Søgaard
Hi Tim,

Here is one way to do it:

#lang typed/racket
(require math/matrix math/array)

(: columns->matrix (All (A) ((Listof (Matrix A)) -> (Matrix A
(define (columns->matrix cs)
  (define m (matrix-num-rows (first cs)))
  (define n (length cs))
  (: has-m-rows? : ((Matrix A) -> Boolean))
  (define (has-m-rows? c) (= (matrix-num-rows c) m))
  (unless (andmap has-m-rows? cs)
(error 'columns-matrix "all columns must have the same number of rows"))
  (for*/matrix n m ([c (in-list cs)]
[x (in-vector (matrix->vector c))]) : A
x))

(display (columns->matrix (list (col-matrix [1 2 3]) (col-matrix [4 5 6]

-- 
Jens Axel



2018-03-25 13:12 GMT+02:00 Tim Hanson :

> hi,
>
> I'm trying out matrices (without typed racket, though I read the
> performance caveat -- I'm not worried about performance at the moment) and
> am trying to find the best idioms for a small function I'd like to build.
>
> Q1: is there an elegant away to assemble a matrix column-wise? (my first
> draft solution is to read one col-matrix and write cell by cell into a
> destination (mutable) matrix); my preference would be to use immutable
> items, but that's secondary to elegance at this point.
>
> cheers,
>
> Tim
>
> --
> 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.


[racket-users] "conflicts" badge for pkgs page?

2018-03-25 Thread 'John Clements' via Racket Users
I’m fixing problems related to documentation on the libgit2 package, and it 
appears there are a number of issues to fix, but the first one was that the 
package was written with a main scribblings file called “manual.scrbl”. It 
turns out this is a bad idea, and in fact this is mentioned in the raco 
documentation, and there’s a helpful “conflicts” file that appears in the “Most 
Recent Build Results.” (Unfortunately, I didn’t find this until I’d already 
figured out this part of the problem.) My question is this; have we given any 
thought to adding a conflict notification—either a badge or an entry in the 
green box—to the front pkgs.racket-lang.org page?

Apologies if there’s some good reason this isn’t already a thing.

John



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


[racket-users] No scroll ability in DrRacket v6.12

2018-03-25 Thread Stephen Smith
Hi All,

I'm not sure if it just happened after installing 6.12 but after working on 
a program of some length I noticed I can't scroll any windows in DrRacket 
with the scroll wheel (grabbing a scrollbar works). Even the Help -> About 
DrRacket window won't scroll.

I'm using an external Microsoft mouse with a scroll wheel. Enabled my 
touchpad to see if it would work, but it barely works - I have to really 
exaggerate a scroll gesture to get the screen to nudge even just a little. 

All my other applications are scrolling as expected, just DrRacket not 
working. I did an uninstall-reinstall but same behaviour. 

On a Windows 10 machine.

Anyone else having this issue?

Stephen.

-- 
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] No scroll ability in DrRacket v6.12

2018-03-25 Thread 'John Clements' via Racket Users


> On Mar 25, 2018, at 12:25, Nadeem Abdul Hamid  wrote:
> 
> I had a student in class the other day also complaining about sluggish 
> scrolling in DrRacket (while all other applications work fine), but I think 
> he was using 6.11 on Mac OS X.
> — nadeem

FWIW, I think these are probably different issues. *All* of my students have 
had somewhat sluggish OS X scrolling for the last 10 years, but I think that 
changing this would require a major overhaul of DrRacket’s GUI architecture, 
and also probably require writing a huge amount of platform-specific code. It 
sounds to me like the issue below is a horse of a different color.

John

> 
> On Sun, Mar 25, 2018 at 1:20 PM, Stephen Smith  
> wrote:
> Hi All,
> 
> I'm not sure if it just happened after installing 6.12 but after working on a 
> program of some length I noticed I can't scroll any windows in DrRacket with 
> the scroll wheel (grabbing a scrollbar works). Even the Help -> About 
> DrRacket window won't scroll.
> 
> I'm using an external Microsoft mouse with a scroll wheel. Enabled my 
> touchpad to see if it would work, but it barely works - I have to really 
> exaggerate a scroll gesture to get the screen to nudge even just a little. 
> 
> All my other applications are scrolling as expected, just DrRacket not 
> working. I did an uninstall-reinstall but same behaviour. 
> 
> On a Windows 10 machine.
> 
> Anyone else having this issue?
> 
> Stephen.
> 
> 
> -- 
> 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.


[racket-users] Another pkgs badge improvement, re needing documentation

2018-03-25 Thread Philip McGrath
While we're (sort of) on the subject of badges on pkgs.racket-lang.org: the
"This package needs documentation" badge is mostly great, both as a
producer and consumer of packages.

I've encountered at least two types of cases, though, where packages may
intentionally and justifiably lack documentation (or at least not have it
in a form that pkgs.racket-lang.org can recognize):

   - Packages that are split up into "foo"/"foo-lib"/"foo-doc"/"foo-test".
   The server doesn't know that "foo-doc" documents "foo-lib", so packages
   like "foo-lib" get the "needs documentation" badge. For example,
   "gui-lib" gets the badge.
   - Packages that just distribute platform-specific native binaries, like
   "ffmpeg-x86_64-win32". It's a bit more complicated in this case to
   generalize where the documentation is, and it is certainly at least
   arguable that there should be some sort of documentation of the existence
   and purpose of such packages, but it would probably be very silly to give
   each one its own "scribblings/ffmpeg-x86_64-win32.scrbl" as the package
   server expects.

Giving these kinds of packages the "This package needs documentation" badge
seems less than ideal for package consumers: I'm probably not the only one
who avoids depending on undocumented packages. Most of the time, of course,
it isn't too confusing given a moment's thought (assuming one knows the
-lib/-doc/-test convention and/or the maintainer filled in the
"description" field), though there do seem to be some native binary
packages that are not obviously linked to their client package(s), but even
a momentary stop-and-think impedes quickly scanning or programmatically
filtering the search results.
There's another downside for package maintainers, which is that these show
up as "todos". While, again, maintainers probably don't have to think much
about it when they actually review them, the existence of
intentional/expected "todos" prevents maintainers from applying the simple
rule that nonzero "todos" always means there's something they should go and
fix.

I think the most useful resolution would be to give package maintainers a
way to specify that some package documents or is documented by some other
package (or possibly some arbitrary URL—I would have reservations about
that approach, but it seems worth considering whether it might be useful
for the case of native binary packages). Other options I can imagine, like
adding a way to just suppress the badge, seem less good in that they would
weaken the badge system.

This is a post and not a pull request because it seems like there are a lot
of details that would need to be agreed upon, and I'm not sure I know the
right answers or all of the non-obvious implications. (For example, should
the documented package point to the documenting package, or vice versa, or
should both packages have to "agree" on the relationship?) If consensus
emerges, though, I would be happy to contribute some implementation effort!
(Eventually …)

-Philip

On Sun, Mar 25, 2018 at 1:02 PM, 'John Clements' via Racket Users <
racket-users@googlegroups.com> wrote:

> I’m fixing problems related to documentation on the libgit2 package, and
> it appears there are a number of issues to fix, but the first one was that
> the package was written with a main scribblings file called “manual.scrbl”.
> It turns out this is a bad idea, and in fact this is mentioned in the raco
> documentation, and there’s a helpful “conflicts” file that appears in the
> “Most Recent Build Results.” (Unfortunately, I didn’t find this until I’d
> already figured out this part of the problem.) My question is this; have we
> given any thought to adding a conflict notification—either a badge or an
> entry in the green box—to the front pkgs.racket-lang.org page?
>
> Apologies if there’s some good reason this isn’t already a thing.
>
> 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.


Re: [racket-users] No scroll ability in DrRacket v6.12

2018-03-25 Thread Nadeem Abdul Hamid
I had a student in class the other day also complaining about sluggish
scrolling in DrRacket (while all other applications work fine), but I think
he was using 6.11 on Mac OS X.
--- nadeem

On Sun, Mar 25, 2018 at 1:20 PM, Stephen Smith 
wrote:

> Hi All,
>
> I'm not sure if it just happened after installing 6.12 but after working
> on a program of some length I noticed I can't scroll any windows in
> DrRacket with the scroll wheel (grabbing a scrollbar works). Even the Help
> -> About DrRacket window won't scroll.
>
> I'm using an external Microsoft mouse with a scroll wheel. Enabled my
> touchpad to see if it would work, but it barely works - I have to really
> exaggerate a scroll gesture to get the screen to nudge even just a little.
>
> All my other applications are scrolling as expected, just DrRacket not
> working. I did an uninstall-reinstall but same behaviour.
>
> On a Windows 10 machine.
>
> Anyone else having this issue?
>
> Stephen.
>
> --
> 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: sharing an awesome plot - warms the cockles of my heart

2018-03-25 Thread Sanjeev Sharma
http://pasterack.org/pastes/59894

for your  desktop (4k monitor) :

(require plot)(plot-new-window? #t)

(plot(polar
  (λ(θ)(+(exp(sin θ))(*(cos(* 4 θ))-2)(expt(sin(/(-(* 2 θ)pi)24))5)))
  -99 99 #:samples 9)#:width 3870 #:height 2170)


On Friday, March 23, 2018 at 5:17:03 PM UTC-4, Sanjeev Sharma wrote:
>
> I've done no math in 20 years - used to do tons (with the not so great 
> graphics of the time) saw this intriguing plot & banged my head against a 
> wall for a couple of hours.
>
> Then I just settled down & read the manual systematically, pretending it 
> may have some info,  followed the examples and voila
>
> (require plot)(plot-new-window? #t)
> (define(xu u)(*(sin(* 33 u))(cos(* 9 u
> (define(yu u)(*(sin(* 49 u))(sin(* 7 u
> (plot(parametric(λ(t)(vector(xu t)(yu t)))0 1));
>
>
>

-- 
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: sharing an awesome plot - warms the cockles of my heart

2018-03-25 Thread Sanjeev Sharma
http://pasterack.org/pastes/84326

(again - for your desktop)

(require plot)(plot-new-window? #t)

(plot(polar(λ(θ)
   (*(+(*(cos(* 8 θ)).9)1)
 (+(*(cos(* 24 θ)).1)1)
 (+(*(cos(* 200 θ)).05).9)
 (+(sin θ)1)))
 (* pi -1) pi #:samples 9)#:width 3870 #:height 2170)


On Friday, March 23, 2018 at 5:17:03 PM UTC-4, Sanjeev Sharma wrote:
>
> I've done no math in 20 years - used to do tons (with the not so great 
> graphics of the time) saw this intriguing plot & banged my head against a 
> wall for a couple of hours.
>
> Then I just settled down & read the manual systematically, pretending it 
> may have some info,  followed the examples and voila
>
> (require plot)(plot-new-window? #t)
> (define(xu u)(*(sin(* 33 u))(cos(* 9 u
> (define(yu u)(*(sin(* 49 u))(sin(* 7 u
> (plot(parametric(λ(t)(vector(xu t)(yu t)))0 1));
>
>
>

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