
Trying something simple out and a bit confused on the output I’m seeing: > (for ([i (range 10)])
(thread (λ () (println i))))
9
8
7
6
5
4
3
2
1
0
To be clear, I don’t care about the order of the output. What I care about is that each line of the output is distinct. The value if i
is being directly manipulated by the loop whether or not the thread has begun executing or not. So, unless the lexical context of the lambda is being copied by thread
, I full expected the output to be something like (for example): 6
6
5
4
7
7
7
3
3
0

Either that, or Racket threads have no correlation to OS threads and do not actually run in parallel at all.


Racket supports multiple _threads_ of evaluation. Threads run concurrently, in the sense that one thread can preempt another without its cooperation, but threads currently all run on the same processor (i.e., the same underlying operating system process and thread).

They don’t run in parallel, but that isn’t what’s going on

for
doesn’t mutate the variable i
, instead there’s effectively a function that takes i
as an argument; it’s called with the values from 0 to 9, and that function creates a thread
that prints i

Okay, so a simple let-over-lambda expansion going on

in general you should not expect there to be implicit mutation in Racket

Started b/c I was surprised that thread
didn’t allow passing an argument list (for exactly the reason I incorrectly assumed above). Put together a bunch of tests and couldn’t get the “bad” behavior to happen. :slightly_smiling_face:

Thanks!
I’ve gradually updated things so that the links for “git+https” sources are corrected, but I haven’t done anything lately that would fix package-submission problems. FWIW, I was able to create a new package just now. I didn’t find anything in the logs to explain what went wrong in your attempts, but I’m not certain that I looked in the right places.

@gmauer has joined the channel

Hi everyone. I’ve been a racket-newbie for a few years now. It’s probably my favorite language in terms of just thinking how I think, but its hard to get enough expertise to really roll it into may day to day.
One thing I did create is my own racket mode for emacs if anyone wants to check it out https://github.com/togakangaroo/ob-racket While a couple other modes exist, I found no easy way of playing around with building custom languages in org documents (which is my default for exploring stuff) so this mode has that capability (see the “custom languages” part of the readme)

Can anyone with M1 and recent Racket build / snapshot try the macro stepper on
#lang racket
(struct a ())
and click step until the end? Is there a problem?
It crashes for me, and I want to make sure the problem is not due to my local configuration.

It steps to the end for me with no error.

I thought the problem is that I have an outdated dylib
, but I just copied https://github.com/racket/libs/blob/master/draw-aarch64-macosx-3/racket/draw/libcairo.2.dylib to ./racket/share/pkgs/draw-aarch64-macosx-3/racket/draw/libcairo.2.dylib
, and the problem persists.

The error is:
cairo_quartz_get_cg_context_with_clip: implementation not found; arguments: #<cpointer>
context...:
/Users/sorawee/projects/racket/racket/share/pkgs/draw-lib/racket/draw/private/emoji.rkt:159:7: draw-loop
/Users/sorawee/projects/racket/racket/share/pkgs/draw-lib/racket/draw/private/dc.rkt:1457:4: do-text method in dc%
...
internal error: attempt to deschedule the current thread in atomic mode
context...:
/Users/sorawee/projects/racket/extra-pkgs/gui/gui-lib/mred/private/wx/common/queue.rkt:634:3
...
internal error: terminated in atomic mode!

What checksum of draw-aarch64-macosx-3
do you have installed?

f252e

And openssl sha1 libcairo.2.dylib
(in racket/lib
) reports 514321ed81…
?

Well, there is no libcairo.2.dylib
in racket/lib

These are all what I have in ./racket/lib
<http://GRacket.app\|GRacket.app> <http://Starter.app\|Starter.app> libcrypto.1.1.dylib libintl.9.dylib librktio.dylib mans.rktd scheme.boot
<http://GRacketBC.app\|GRacketBC.app> buildinfo libedit.0.dylib libmpfr.4.dylib libs.rktd mzdyn3m.o starter
MMTabBarView.framework launchers.rktd libexpat.1.dylib libmpfr.4.dylib.bak libssl.1.1.dylib petite.boot starter-sh
Racket.framework libatk-1.0.0.dylib libffi.6.dylib libracketcs.a libuuid.1.dylib racket.boot system.rktd

But if you mean racket/share/pkgs/draw-aarch64-macosx-3/racket/draw
, then yes, the file has that checksum.

Running raco setup
should copy the “.dylib” from there to “lib”.

I just ran git pull; make
. That should implicitly run raco setup
, no?

But I can try it again.

raco setup
is done. Nothing is copied. And it still crashes.

Let me start from a fresh clone and see if that helps

The problem is whatever keeps the “.dylib” from being copied, but I don’t know what that could be.

Anything customized in etc/config.rktd
?

Ohh, that might be it. I added:
(lib-search-dirs . ("/opt/homebrew/lib/" #f))

Should #f
come before "/opt/homebrew/lib/"
?

Yeah, with a fresh clone, it now works properly.

Yep, confirming that by removing "/opt/homebrew/lib/"
from lib-search-dirs
, the foreign libraries are copied properly

Did some experiments:
- The order of
"/opt/homebrew/lib/"
and#f
doesn’t seem to matter.(lib-search-dirs . (#f "/opt/homebrew/lib/"))
wouldn’t copy the foreign libs too. - So it looks like if
lib-search-dirs
is non(#f)
, the foreign libs won’t be copied. Is this considered a bug though?

Ah, ok. Yes, the library is not installed again if it already exists in the search path. That’s new behavior intended to better support layering, but it conflicts with setting a search path to find libraries that are not installed by raco setup
.

Probably there will need to be a new config.rktd
option for layering.

Or maybe layering support should copy if the existing library is not the same as the one that would be installed. That’s a simpler and maybe better choice in the case of libraries.

I have a feeling this involves custodians, which I know nothing about, but I would like to delete a temporary directory when my program exits, even if in error. Any pointers?

(This wouldn’t be necessary if I could find a mkdtemp
or similar; as a hack, I’m making directories in (find-system-path 'temp-dir)
, which is the same place between runs.)

@ben.knoble see plumbers, but also see make-temporary-file
with 'directory
as the second argument

I looked at make-temporary-file
, but IIUC that makes files and not directories; I need to make a directory (in which I am unzip
ping an archive). I’ll look at plumbers, though.

@ben.knoble to be a little less oblique, (make-temporary-file "mydir-~a" 'directory)
makes a directory

Ah, I misunderstood the phrasing “combined with” in the docs. This looks like what I need. Thanks @samth!

@petertbrady has joined the channel

The latest version of the archive is up-and-running at https://benknoble.github.io/racket-slack-archive/ (extends through roughly 2021–05–16). The site is now built using a mix of Racket (data processing) and Jekyll/Ruby (site-generation). I have some todos to make a nicer experience, and help is welcome. (Also if anyone wants to start working porting the Jekyll + Ruby stuff to Racket, feel free.)

set the channel topic: Racket — http://racket-lang.org — http://pasterack.org - Slack invite link: http://racket-slack.herokuapp.com — Archived at https://benknoble.github.io/racket-slack-archive/

This is awesome. Thank you. You should put this in the next Racket News https://github.com/pmatos/racket-news/issues/new\|https://github.com/pmatos/racket-news/issues/new @pocmatos

Thanks Stephen!

does anyone have a good list of uses of racket in industry? even chez scheme. or just scheme in general…



thank you! any other input welcome. Trying to build a case for using racket at work