soegaard2
2019-7-19 13:58:07

Compared to modules, units are cumbersome to use. The only use case where you are forced to use units is where the dependency graph has a “diamond”. And with a little care it is a situation that often can be avoided.

Prior to the introduction of modules, units were in more wide-spread use. Now almost everyone uses modules. So not exactly legacy - but close.


stefan.kruger
2019-7-19 14:54:42

Is there a standard way to shuffle a list? Picking a random permutation…


stefan.kruger
2019-7-19 14:56:34

In python I’d say from random import shuffle x = [[i] for i in range(10)] shuffle(x)


soegaard2
2019-7-19 14:56:37

@stefan.kruger Yes. Use shuffle!


stefan.kruger
2019-7-19 14:56:42

bah


stefan.kruger
2019-7-19 14:56:56

Why can’t I find these things?


lexi.lambda
2019-7-19 16:18:15

@stefan.kruger In case you don’t know about it, the search box in the Racket docs is very useful for that sort of thing: https://docs.racket-lang.org/search/index.html?q=shuffle


lexi.lambda
2019-7-19 16:18:32

It also links to combinations if you search for “powerset.”


leif
2019-7-19 21:52:38

Hey @mflatt, just a heads up that I’ve been getting segfaults from the Racket gui system on the latest version of mac os x.


leif
2019-7-19 21:52:52

The specific error being:

CGContextRef->C: argument is not non-null `CGContextRef' pointer
  argument: #f
  context...:
   /Users/leif/racket/racket/collects/ffi/unsafe.rkt:1364:12
   /Users/leif/rsrc/gui/gui-lib/mred/private/wx/cocoa/dc.rkt:117:9: send-arg203
   /Users/leif/rsrc/gui/gui-lib/mred/private/wx/common/backing-dc.rkt:79:4: on-backing-flush method in backing-dc%
   /Users/leif/rsrc/gui/gui-lib/mred/private/wx/cocoa/dc.rkt:113:0: do-backing-flush
   /Users/leif/rsrc/gui/gui-lib/mred/private/wx/cocoa/canvas.rkt:357:5: paint-or-queue-paint method in .../wx/cocoa/canvas.rkt:271:3
   /Users/leif/rsrc/gui/gui-lib/mred/private/wx/cocoa/canvas.rkt:69:2
about to suspend in atomic mode
[1]    33885 abort      ./plt-games

leif
2019-7-19 21:53:12

(Also from DrRacket and any other gui program)


leif
2019-7-19 21:53:27

But the ‘goblet’ plt game seems to trigger the error the quickest.


leif
2019-7-19 21:53:37

Not sure if this is just a problem with my machine though.


spdegabrielle
2019-7-19 21:55:56

Let me know your versions and I’ll try on my machine


leif
2019-7-19 21:57:02

@spdegabrielle honestly master.


leif
2019-7-19 21:57:10

But I suspect 7.3 would have the same issue.


leif
2019-7-19 21:57:13

I can check that now.


spdegabrielle
2019-7-19 22:04:38

@leif Which version of macOS


leif
2019-7-19 22:05:01

Oh, the latest one, mojave I think?


leif
2019-7-19 22:05:18

Ya, it looks like mojave, 10.14.4


leif
2019-7-19 22:05:51

(Sorry, macOS isn’t really my primary OS at this point, so I’m a bit out of the loop if there’s something newer.)


travis.hinkelman
2019-7-19 22:10:49

When using a “vertical” slider, it is very squished. Not sure what I’m doing wrong.

(define frame (new frame%
                   [label "Example"]
                   [width 300]))

(define slider (new slider%
                     [label "Slider"]
                     [parent frame]
                     [min-value 0]
                     [max-value 100]
                     [init-value 50]
                     [style '(vertical)]))

(send frame show #t)

leif
2019-7-19 22:13:33

@spdegabrielle Hmm…it looks like when I use the 7.3 distribution, it stops segfaulting. Weird.


spdegabrielle
2019-7-19 22:17:32

@leif Do you want me to build from master to reproduce? or is this a DrDr option?


spdegabrielle
2019-7-19 22:32:56

@travis.hinkelman sorry for slow response. I can’t get a vertical slider at all - it just renders as a squashed horizontal.


spdegabrielle
2019-7-19 22:35:45
#lang racket/gui
(define frame (new frame%
                   [label "Example"]
                   [width 600]
                   [height 600]))
(define hp (new vertical-pane% [parent frame]
                [min-width 200]
                [min-height 200]))
(define slider (new slider%
                    [label "Slider"]
                    [parent hp]
                    [min-value 0]
                    [max-value 100]
                    [init-value 50]
                    [min-width 200]
                    [min-height 200]
                    [vert-margin 10]
                    [horiz-margin 10]
                    [style '(horizontal)]))

(send frame show #t)

travis.hinkelman
2019-7-19 22:39:53

I want the slider value on the right (which is oddly created by using vertical for style).


spdegabrielle
2019-7-19 22:47:09

I’m still confused by no vertical , but let me look at getting the label on the right


leif
2019-7-19 22:47:09

@spdegabrielle Eh. Honestly, its probably not worth it. I can’t find a single other person who can reproduce it, so I suspect there’s something odd with my macOS install.


leif
2019-7-19 22:47:17

Thanks for offering though. :slightly_smiling_face:


spdegabrielle
2019-7-19 22:47:47

@leif your version number was lower than mine; I’m on 10.14.5 (18F132)


spdegabrielle
2019-7-19 22:48:17

@leif I believe you wrote 10.14.4


mflatt
2019-7-19 22:59:35

@leif I saw that crash today, too. I was running one of the GL games and figured it was specific to that, but didn’t yet investigate. Racket crashed reliably, CS didn’t. Will investigate more as soon as I can.


leif
2019-7-19 23:00:05

@mflatt cool, thanks.w


leif
2019-7-19 23:00:16

and @spdegabrielle thanks for checking that.


spdegabrielle
2019-7-19 23:06:26

@travis.hinkelman #lang racket/gui (define fish% (class object% [init parent val] (super-new) (define hp (new horizontal-pane% [parent parent])) (define slider (new slider% [label "Slider"] [parent hp] [min-value 0] [max-value 100] [init-value val] [style '(horizontal plain)])) (define label (new message% [label (format "~a" val) ] [parent hp])) )) (define frame (new frame% [label "Example"] [width 300] [height 300])) (define charlie (new fish% [parent frame] [val 55])) (send frame show #t)


spdegabrielle
2019-7-19 23:06:49

@travis.hinkelman This is a way to put the label on the right.


travis.hinkelman
2019-7-20 01:31:41

Thanks. It’s nice to know that there is a relatively straightforward workaround. I started toying around with that simple slider example when I saw this Reddit post: https://www.reddit.com/r/Racket/comments/cew4ws/ui_layout_question/


luosha865
2019-7-20 02:25:21

@luosha865 has joined the channel


mflatt
2019-7-20 02:35:58

I’ve pushed a change that should avoid the crash. I have no idea why it only started happening now or why it happens more for you.