sorawee
2020-4-10 07:11:20

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


laurent.orseau
2020-4-10 07:29:58

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.


sorawee
2020-4-10 07:54:49

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


laurent.orseau
2020-4-10 08:03:13

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.


sorawee
2020-4-10 08:06:49

First year students use HtDP languages, no?


sorawee
2020-4-10 08:07:08

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


sorawee
2020-4-10 08:07:14

but the main docs totally should.


laurent.orseau
2020-4-10 08:10:43

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
2020-4-10 10:52:21

@hammerha has joined the channel


hammerha
2020-4-10 11:10:51

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?


soegaard2
2020-4-10 11:11:33

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


hammerha
2020-4-10 11:12:06

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


soegaard2
2020-4-10 11:12:55

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


hammerha
2020-4-10 11:13:01

(no image in the latter)


soegaard2
2020-4-10 11:13:35

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.


hammerha
2020-4-10 11:13:53

makes sense


soegaard2
2020-4-10 11:14:06

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


soegaard2
2020-4-10 11:14:34

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


soegaard2
2020-4-10 11:16:27

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


hammerha
2020-4-10 11:18:57

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.


soegaard2
2020-4-10 11:23:29

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


hammerha
2020-4-10 11:25:01

Yes, that sounds good.


laurent.orseau
2020-4-10 11:36:24

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.


ben
2020-4-10 13:22:11

@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


samth
2020-4-10 13:47:05

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


hammerha
2020-4-10 19:03:20

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


soegaard2
2020-4-10 19:03:56

@ryanc ^


hammerha
2020-4-10 19:10:05

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.


soegaard2
2020-4-10 19:13:44

@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.


soegaard2
2020-4-10 19:22:13

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


soegaard2
2020-4-10 19:23:56

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.


soegaard2
2020-4-10 19:25:03

On my machine I get:


soegaard2
2020-4-10 19:25:40

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


hammerha
2020-4-10 19:27:11

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


soegaard2
2020-4-10 19:27:26

Great.


samth
2020-4-10 20:47:53

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


pablore
2020-4-11 02:55:44

@pablore has joined the channel