It’s both. Add for-template
and remove for-label
:wink:
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))
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.
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.
My pi4/8gb arrived on the weekend. Racket installed!
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.
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?
I think it is better to find it via the home page (who knows maybe a direct link will trigger an anti-upvote-algorithm).
ok
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
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
Note that Maxima command ends with ; or $. The result is printed if ; is used and suppressed if $ is used.
I have experimented with adding a newline after the ; but that didn’t help.
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)
I can read the welcome message, which is simply: pid=91701
(the process-id).
Found the error! [out pout]
should have been [out lout]
. Sigh.
@lambduli has joined the channel
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 has joined the channel
@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)))))
Thanks. I changed it.
@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.
I think something went wrong with rotate90: (trans 0 1 –1 0 0 0)
Yes. That should have been (trans 0 1 -1 0 0 0)
.
@bedeke Maxima had a hard time with some of your exampels for gamma. I think 20ish points gave overflows.
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.
fadeeva?
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
That explains why Google didn’t find anything :slightly_smiling_face: Sounds like a good idea - they link to several recent algorithms.
Fixed on Github.
and in rotated-about, you mention rotated instead of rotated-about in the text
Thanks. I have committed a fix. Oddly enough it looks okay in rotatedd-about.
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?
Yes.
The transformations use the first arguments as paramters, and if there are more arguments the transformation is applied to the remaining arguments.
I think I skipped that in the docs :disappointed:
ah, ok. Nice feature. But it made me wonder if it was related to trans or metapict
It’s trans
that handles that.
As an example: (define (rotatedd θ . args) (apply rotated (rad θ) args))
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
It would certainly be easy to add.
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.
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")
And join
and friends are defined in metapict/structs
.
At the bottom I have @defstruct*[join ()]
fwiw i noticed in your generated docs curve
itself was underlined in red… good luck
Yes - but that’s because it was used, but not documented.
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
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
I recommend just using raco setup
Is it possible to clear the buffer(read only the buffered bytes) for a non-seekable input port (tcp input port, etc)?
Maybe read-bytes-avail!
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.
if the buffer is already clean, then read-bytes-avail!
should return immediately.
Do you want to just throw away the bytes in the buffer?
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.
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 has joined the channel