le.legioner
2021-6-1 07:33:56

@le.legioner has joined the channel


soegaard2
2021-6-1 07:41:06

@shu—hung Thanks for the help yesterday. Everything seems to work now.


jesse697
2021-6-1 07:56:37

@philip.mcgrath good idea! I’m fussy and work hard to make sure I have “exact” require s in each of my modules. That is, nothing require ’d if it’s not needed. It’s a way satisfy my intellectual need for knowing that I’m not pulling in more than I need. But there’s a price to pay for this fussiness. I end up spending a lot of time playing require tetris and go fall into time sinks like the one that prompted my initial question (“how to I make my requires cleaner”)


gknauth
2021-6-1 11:45:52

Platform is Win10. One issue is update-log-choices takes time. It has to take the combination of a remote server and an Applications directory on that server, look in the logs/ directory of the current application choice, and build a list of all the .log and .log.gz files in logs/ or any subdirectory. Since we’ve been working remotely for 14+ months, this takes more time than when we were all in the same building. I thought (send log-choice clear) would clear the choice% instantly (visually that is). I’m going to play around with this a bit more, and see what I can figure out. The good news is that the log-choice does eventually (within a second or two) show the correct new log choices instead of the old ones when you change the server or the application. I just wanted the choice% to be empty while it was loading the new choices.


gknauth
2021-6-1 11:51:17

In the image below, when I pick a different application, I want the Log Choice to clear until I have read in the new log choices for the new chosen application.


mflatt
2021-6-1 13:14:54

I think you’re bumping into one of the hassles of an event loop, where refreshing the screen is part of the event loop, and it can’t run while the event-loop thread is occupied with (get-log-choices). To get quicker refresh, consider using (queue-callback (lambda () (for-each (λ (s) (send log-choice append s)) (get-log-choices))) #f), which will give the event loop a chance to refresh the screen before it starts on (get-log-choices).


rostislav.svoboda
2021-6-1 13:31:45

I mean when this scribble snipped gets converted to html then the syntax-coloring of the html was not present. But requiring (for-label rash syntax/parse) improves it: #lang scribble/manual @(require (for-syntax racket/base syntax/parse ) (for-label rash syntax/parse ) ) @(define-syntax (irash stx) (syntax-parse stx [(_ e1 e ...) #`(codeblock #:keep-lang-line? #f #,(datum-&gt;syntax #'e1 "#lang rash") "\n" e1 e ...)])) codeblock: @codeblock{ #!/usr/bin/env bash #lang rash echo -e "hello \n codeblock" \| wc -l } Example from @hyperlink["<https://docs.racket-lang.org/rash/index.html?q=rash>"]{racket-rash}: @codeblock{ #!/usr/bin/env racket #lang rash cd project-directory echo The number of Racket files in this directory: ls *.rkt \| wc -l } irash: @irash{ #!/usr/bin/env bash echo -e "hello \n irash" \| wc -l } It is however still far from perfect.


gknauth
2021-6-1 14:07:13

Thank you! I’ll try that!


hesiyun1996
2021-6-1 14:18:17

@hesiyun1996 has joined the channel


gknauth
2021-6-1 15:13:01

I had the same behavior with queue-callback, so I did the following instead, which gives enough feedback to the user; it will do for now. Later I can come back to find out why the clear doesn’t happen right away. (define (update-log-choices) (send log-choice set-label " (LOADING) ") (send log-choice clear) (send log-choice enable #f) (let ([new-log-choices (get-log-choices)]) (for-each (λ (s) (send log-choice append s)) new-log-choices)) (send log-choice set-label "Log Choice:") (send log-choice enable #t))


gknauth
2021-6-1 15:18:32

(I realize new-log-choices doesn’t really do anything ahead of time, it’s left over from when I was trying different things.)


hazel
2021-6-1 19:52:45

is there a way to build an array/matrix row-by-row? what I’m trying to do is (define bounds (for/array: ([i (in-range 1 n)]) : (Vectorof Flonum) (define col (array-&gt;list (array-slice-ref mat (list (::) `(,i))))) (vector (apply min col) (apply max col)))) but this ends up with an array of vectors, and not a 2 x n array


hazel
2021-6-1 19:53:19

(Array Flonum) also doesn’t work — again, array of arrays


hazel
2021-6-1 19:56:09

or, at the very least, is there a for/array: that accomplishes the same effect?


soegaard2
2021-6-1 19:56:19

#lang racket (require math/matrix) (for*/matrix 4 3 ([i 4] [j 3]) (+ (* 10 i) j))


hazel
2021-6-1 19:57:15

yeah, but how do I do exactly the thing where I’m doing (so the first column is the min and the second is the max) with for/matrix


hazel
2021-6-1 19:58:42

since I’m getting two values out of col at once


soegaard2
2021-6-1 20:00:35

I haven’t grasped what your example does.

Is this close?

You have a matrix A of size (??) and now you want to construct a new matrix B with size nx2 (?), such that the ith row of B contains both the minimum and maximum of the ith column of A.


hazel
2021-6-1 20:03:19

right


capfredf
2021-6-1 20:03:46

(array #[(apply min col) (apply max col)])


capfredf
2021-6-1 20:03:54

does this work?


soegaard2
2021-6-1 20:04:09

What about (if (= j 0) (apply min col) (apply max col))


hazel
2021-6-1 20:04:20

that works


hazel
2021-6-1 20:04:50

or it could


hazel
2021-6-1 20:09:09

(define bounds (for*/matrix: 2 m ([i (in-range 1 m)] [fn : (-&gt; Flonum * Flonum) (in-cycle (in-list (list min max)))]) : Flonum (define col (array-&gt;list (array-slice-ref mat (list (::) `(,i))))) (apply fn col))) ah yes. type’s


hazel
2021-6-1 20:09:13

(changed to m for other reasons)


soegaard2
2021-6-1 20:11:39

Why not use matrix-col or matrix-cols to produce either a single or all columns. (that array-slice-ref looks confusing).


hazel
2021-6-1 20:12:22

didn’t know it existed


soegaard2
2021-6-1 20:13:03

There is also an matrix-map-cols, so you could write (matrix-map-cols min A) to get all the minima.


soegaard2
2021-6-1 20:13:42

I wonder whether there is an elegant way of “merging” the cols of two matrices.


semiotics
2021-6-1 21:28:30

@semiotics has joined the channel


rostislav.svoboda
2021-6-1 22:14:02

Shouldn’t it be quoted the other way around: Is there an “elegant” way of merging the cols of two matrices? ? Any merge operation is bound to be precisely defined, one way or the other. However, what is “elegant”? :slightly_smiling_face:


rostislav.svoboda
2021-6-1 23:16:13

And it looks like the simplest way is to open the rash/scribblings/rash.scrbl in the DrRacket and press the “Scribble HTML” button. Interestingly enough (from beginner’s perspective) this is also the fasted way how to get the html generated.


rostislav.svoboda
2021-6-1 23:16:27

Ugh.


hazel
2021-6-2 00:24:03

what data structure should I use if I want to routinely retrieve the first and last elements, and add to the beginning and end?


sorawee
2021-6-2 00:24:36

deque?



hazel
2021-6-2 00:32:39

alright


jaz
2021-6-2 00:52:03

do you need access to anything other than the first & last elements?


hazel
2021-6-2 01:14:35

nope