sorawee
2020-7-6 07:03:58

It’s both. Add for-template and remove for-label :wink:


samdphillips
2020-7-6 07:40:51

So if the list box has N items visible and you tried to set the Nth item as the top most one it won’t actually execute the low level Windows bit to do that.

Here’s the bit (i is the item you want to set as the top item) (let ([c (SendMessageW hwnd LVM_GETCOUNTPERPAGE 0 0)]) (unless (= c i) (if (> (SendMessageW hwnd LVM_GETTOPINDEX 0 0) i) (void (SendMessageW hwnd LVM_ENSUREVISIBLE i 0)) (void (SendMessageW hwnd LVM_ENSUREVISIBLE (sub1 (min num (+ i c))) 0))


spdegabrielle
2020-7-6 11:55:32

Hi Racketeers,

Our first week of the Quickscript competition is almost over.

Prizes include stickers, mugs, caps and T-shirts! AND participation gives you an exclusive badge for your GitHub profile[1].

The good news is it’s not to late to enter!

Kind regards,

Stephen

[1] this is implemented with the Organisation and teams functionality in GitHub.


spdegabrielle
2020-7-6 12:13:57

Just to clarify: No cash prizes - Stickers, mugs, caps and T-shirts!

We don’t have corporate sponsors*.

Stephen

  • if you are interested in sponsoring Racket please consider one of the GitHub Sponsors tiers. It will give you exposure to a community of high quality developers and graduates who have learnt from the best teachers.

spdegabrielle
2020-7-6 12:29:41

My pi4/8gb arrived on the weekend. Racket installed!


soegaard2
2020-7-6 12:44:05

That’s new. I submitted Alex’s blog post on Ishido to Hacker News. No one noticed. Now I get an email from the staff - they are “resubmitting” it to to the frontpage in order to give it a second chance.


soegaard2
2020-7-6 12:44:14

spdegabrielle
2020-7-6 12:44:23

Calling package authors and language designers? Have you considered a quickscript for your language or package? Quickscript can access any package - there are scripts that post to twitter with net or display an interactive graph with plot - what could you do with your package?


spdegabrielle
2020-7-6 12:45:12

soegaard2
2020-7-6 12:46:12

I think it is better to find it via the home page (who knows maybe a direct link will trigger an anti-upvote-algorithm).


spdegabrielle
2020-7-6 12:46:38

ok


soegaard2
2020-7-6 12:49:22

Hi All.

In order to test some numerical functions, I decided to resurrect some code that talks to Maxima. It’s quite simple, it simply sends a line containing a maxima command to a maxima process. Then reads the output from Maxima.

But for some reason, I can’t get the output back from Maxima (that used to work 10-ish years ago). It’s probably something simple, but I can’t spot the error - so I need a second set of eyes:

https://gist.github.com/soegaard/66e9ed074a2cf6c3c7faa040dbda3931


soegaard2
2020-7-6 12:50:46

For comparison, here is a terminal sesssion with Maxima: soegaard@mbp2 tmp % maxima --very-quiet   warning: ignoring an empty documentation index in /usr/local/Cellar/maxima/5.43.0/share/info/./ 1+2;                     3 log(1.2);                0.1823215567939546


soegaard2
2020-7-6 12:51:33

Note that Maxima command ends with ; or $. The result is printed if ; is used and suppressed if $ is used.


soegaard2
2020-7-6 12:52:03

I have experimented with adding a newline after the ; but that didn’t help.


soegaard2
2020-7-6 12:53:03

This snippet starts the maxima process: (define (start) (let ([listener (tcp-listen PORT 3 #t)]) (match-let ([(list pin pout pid perr status) (process* MAXIMA-PATH "--very-quiet" "-s" (format "~a" PORT))]) ;(displayln (list pin pout pid perr status)) (let-values ([(lin lout) (tcp-accept listener)]) (parameterize ([in lin] [out pout]) (displayln (receive-welcome-message)) (display "Enter a Maxima command. Terminate a command with either ; or $ .\n") (read-send-receive-loop))))))

(start)


soegaard2
2020-7-6 12:53:49

I can read the welcome message, which is simply: pid=91701 (the process-id).


soegaard2
2020-7-6 13:17:14

Found the error! [out pout] should have been [out lout]. Sigh.


lambduli
2020-7-6 15:25:25

@lambduli has joined the channel


soegaard2
2020-7-6 15:36:56

Hi All. I have written a section on transformations in the MetaPict manual. Feedback is welcome (grammar, spelling, confusing examples etc). https://docs.racket-lang.org/metapict/index.html?q=metapict#%28def._%28%28lib._metapict%2Ftrans..rkt%29._trans%29%29

Scroll up a bit to see the beginning (the tag for the transformation section is fixed on Github, but the docs haven’t updated yet).


kiefertravis
2020-7-6 16:35:11

@kiefertravis has joined the channel


maueroats
2020-7-6 16:38:19

@soegaard2 Most examples look great. Beautiful, in fact. I’d suggest something like this for the first one (thicker lines and removed the overlapping transformations): (penwidth 4 (draw (color "black" (penwidth 8 (draw c))) (color "red" (draw ((shifted 1/2 1/2) c))) (color "blue" (draw ((rotated (/ π 2)) c))) (color "green" (draw (((shifted 0 -0.1) flipy) c)))))


soegaard2
2020-7-6 16:41:58

Thanks. I changed it.


sorawee
2020-7-6 16:42:55

@cris2000.espinoza677 would you mind sharing your code that triggers the problem? I want to see if there’s a way to configure the permission so that things work.


bedeke
2020-7-6 16:51:28

I think something went wrong with rotate90: (trans 0 1 –1 0 0 0)


soegaard2
2020-7-6 16:52:59

Yes. That should have been (trans 0 1 -1 0 0 0).


soegaard2
2020-7-6 16:54:39

@bedeke Maxima had a hard time with some of your exampels for gamma. I think 20ish points gave overflows.


bedeke
2020-7-6 16:59:47

good to know. I’m going to investigate later, and try to find out if something smart can be done to improve it on the racket side. for the erf I was thinking to maybe go via the fadeeva fct.


soegaard2
2020-7-6 17:01:35

fadeeva?


bedeke
2020-7-6 17:03:52

Missed a d… https://en.wikipedia.org/wiki/Faddeeva_function I found out about it on the wiki page about erf. It’s a generalisation of erf that can be used to implement erf, and the fresnel functions


soegaard2
2020-7-6 17:07:45

That explains why Google didn’t find anything :slightly_smiling_face: Sounds like a good idea - they link to several recent algorithms.


soegaard2
2020-7-6 17:10:22

Fixed on Github.


bedeke
2020-7-6 17:10:59

and in rotated-about, you mention rotated instead of rotated-about in the text


soegaard2
2020-7-6 17:13:03

Thanks. I have committed a fix. Oddly enough it looks okay in rotatedd-about.


bedeke
2020-7-6 17:23:02

In the first example a transformation is realized with ((shifted 1/2 1/2) c) but afterwards most transformations are done with (shifted 1/2 1/2 c) is this something that can generally be done in metapict?


soegaard2
2020-7-6 17:23:15

Yes.


soegaard2
2020-7-6 17:24:42

The transformations use the first arguments as paramters, and if there are more arguments the transformation is applied to the remaining arguments.


soegaard2
2020-7-6 17:24:56

I think I skipped that in the docs :disappointed:


bedeke
2020-7-6 17:26:11

ah, ok. Nice feature. But it made me wonder if it was related to trans or metapict


soegaard2
2020-7-6 17:26:52

It’s trans that handles that.


soegaard2
2020-7-6 17:27:52

As an example: (define (rotatedd θ . args) (apply rotated (rad θ) args))


samdphillips
2020-7-6 17:33:59

bedeke
2020-7-6 17:34:50

I like that you explain the transformations in fct of the equations. I think it would be nice to also include them for the rotations, …but maybe it gets to verbose


soegaard2
2020-7-6 17:39:05

It would certainly be easy to add.


soegaard2
2020-7-6 20:19:52

I am attempting to document curve and path specifications in Racket. That in itself is tricky, but I have run into the problem that some structs are underlined with red. Normally it means that something needs to be required in an for-label but … I can’t get it to work today.


soegaard2
2020-7-6 20:20:21

The start of curve.scrbl is: #lang scribble/manual @(require (for-label metapict (except-in racket angle box open path? unit identity ...)) (for-label metapict/curve metapict/path metapict/path-operations metapict/structs) scribble/extract scribble/eval scribble/base scribble/manual "utils.rkt")


soegaard2
2020-7-6 20:20:54

And join and friends are defined in metapict/structs.


soegaard2
2020-7-6 20:21:22

At the bottom I have @defstruct*[join ()]



maueroats
2020-7-6 20:24:33

fwiw i noticed in your generated docs curve itself was underlined in red… good luck


soegaard2
2020-7-6 20:25:34

Yes - but that’s because it was used, but not documented.


soegaard2
2020-7-6 21:35:12

FWIW - This is the line I use to invoke scribble: raco scribble ++xref-in setup/xref load-collections-xref +m --dest html --redirect-main <http://docs.racket-lang.org> metapict.scrbl


alexharsanyi
2020-7-6 23:35:46

it is interesting that Reddit held back the post as well and Stephen had to unblock it — perhaps the title triggered some anti-spam measure


samth
2020-7-7 00:54:54

I recommend just using raco setup


343519265
2020-7-7 01:57:18

Is it possible to clear the buffer(read only the buffered bytes) for a non-seekable input port (tcp input port, etc)?


samth
2020-7-7 02:17:30

Maybe read-bytes-avail!


343519265
2020-7-7 02:37:05

I didn’t find document about this. Looking at https://github.com/racket/racket/blob/6184de2389f2b13224234e54254aae1e43dc67d1/racket/src/io/port/read-and-peek.rkt#L67, It seems read-bytes-avail! with a sufficiently large bytes argument could clear the buffer without touching the underlying file, but if the buffer is already clean or the bytes is not sufficiently large, there would still be bytes in buffer, which I didn’t find any way to detect.


samth
2020-7-7 02:39:34

if the buffer is already clean, then read-bytes-avail! should return immediately.


samth
2020-7-7 02:39:49

Do you want to just throw away the bytes in the buffer?


343519265
2020-7-7 02:45:59

Ok, I will try it. I am thinking about how to make use of unsafe-port->file-descriptor, but it seems not very useful without such functionality.


343519265
2020-7-7 02:59:18

I didn’t describe the question clearly, I only want to clear the racket buffer, not the underlying buffer for the file descriptor. unfortunately, It seems read-bytes-avail!* would still touching the os buffer, not only the racket buffer.


dnsosebee
2020-7-7 03:22:40

@dnsosebee has joined the channel