
Yeah, Clojure allocates a space for every cons cell to store its length: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentList.java#L20

interesting. I’m not sure what to make of it then, although I would guess that the core of Clojure still doesn’t use as many lists as Racket, but I don’t know by how much.

One related discussion is that it looks like the Racket docs don’t talk much about time and space complexity of operations.

Yes. Although I understand that first year students don’t need to care about that (PLT Scheme mostly comes from there I think), myself I’d rather know where the tradeoffs are.

First year students use HtDP languages, no?

So it’s fine if HtDP docs don’t talk about complexity

but the main docs totally should.

Yes yes, I meant in the beginning of PLT Scheme, I don’t think there was much of a distinction. But I’m not well informed on that matter, so don’t take my word for it.

@hammerha has joined the channel

Hello everyone!
I’m new to Racket and playing around with it. I’ve just noticed that some files saved by DrRacket are not readable and I’m wondering how I should version control them. I’ve googled a bit but couldn’t find anything. How do you handle this?

Hi. Let me guess, you inserted images into the source?

in one file I’ve added an image. in another file I used #lang slideshow

When an image is inserted directly into the DrRacket editor the file will be saved in a special format (not human readable).

(no image in the latter)

The advatange is that the source and images can be saved as one large file (rather than a folder of a files), but as you point out, it makes version control problematic.

makes sense

The solution is to keep the images as image files next to the source file.

Then use the function bitmap
to include the image in your program/slideshow.

The second file without images… maybe you inserted an image and later deleted it? I am not sure what happens in that case.

probably. i don’t know why the code has changed. i thought this conversion was a default behavior as the file without an image is also converted but when i just tested with the same code in a new file it wasn’t converted.

You are not the first to be confused about this. Maybe some kind of status message from DrRacket were a good idea.

Yes, that sounds good.

It could be a fraction too. If you evaluate 3/2 in the interactions and copy/paste the result in the definitions, it will be an image rather than text.

@samth TR extra-env-lang should export struct constructors, right?
Currently this doesn’t work: #lang typed/racket/base
(require typed/pict)
pict ;; missing type for identifier
and if I try my own type-env, I can’t use the struct maker in a different file #lang s-exp typed-racket/base-env/extra-env-lang
(module u racket/base
(struct foo (a b))
(provide (struct-out foo)))
(require 'u)
(type-environment
[#:struct foo ([a : -Real] [b : -Real])])
edit: 6.7 and 6.5 give the same errors as 7.6

It seems like it should but I haven’t thought about it

Does anyone here use iracket? I tried this one but it doesn’t seem to work. https://github.com/rmculpepper/iracket

@ryanc ^

Oh wow, we have the owner of the repo here. Let me just give you some more context.
When I try to create a notebook the kernel throws this exception [I 19:51:20.049 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
Kernel starting.
zmq-socket: could not find libzmq library
error: "ffi-lib: couldn't open \"libzmq.5.dylib\" (dlopen(libzmq.5.dylib, 6): image not found)"
context...:
/Users/hugh/Library/Racket/7.6/pkgs/zeromq-r-lib/main.rkt:222:0: zmq-socket
/Applications/Racket v7.6/collects/racket/contract/private/arrow-val-first.rkt:555:3
/Users/hugh/Library/Racket/7.6/pkgs/iracket/private/jupyter.rkt:324:2: serve
/Users/hugh/Library/Racket/7.6/pkgs/iracket/private/jupyter.rkt:321:0: call-with-services
/Users/hugh/Library/Racket/7.6/pkgs/iracket/iracket.rkt:12:0: start-kernel
(submod "/Users/hugh/Library/Racket/7.6/pkgs/iracket/iracket.rkt" main): [running body]
temp35_0
for-loop
run-module-instance!
What I’ve tried to far is 1. Reinstall zmq (using brew) 2. Reinstall iracket 3. Reinstall zeromq of conda
When I searched libzmq.5.dylib
I was able to find it in a few places in my machine. I don’t know where Racket tries to find it.

@hammerha Let’s look in Ryans code to see where “libzmq” is loaded. Maybe all you need to do is to move the dylib somewhere else.

The iracket
code uses zeromq
which in turn loads “libzmq” like this: > (ffi-lib “libzmq” ’(“5” #f)))

You can get a list of paths where Racket looks for dynamic libraries, by typing: > (https://docs.racket-lang.org/raco/dirs.html#%28def._%28%28lib._setup%2Fdirs..rkt%29._get-lib-search-dirs%29%29\|get-lib-search-dirs) in the repl.

On my machine I get:

So try copying you dylib into one of the locations reported by get-lib-search-dirs
.

oh wow, i just copied it to the Application Racket lib directory and it works. it feels very hacky but thanks a lot!

Great.

Note that it’s more conventional to have libraries somewhere in LD_LIBRARY_PATH
which Racket also searches

@pablore has joined the channel