jimmysnielsen
2019-4-12 09:32:58

installing Drracket on a new Macbook fails. I have just installed macTex so brew seems to be working: Jimmys-MacBook-Pro:~ jsnielsen$ brew cask install racket ==> Satisfying dependencies ==> Downloading https://mirror.racket-lang.org/installers/7.2/racket-7.2-x86_64-macosx.dmg

curl: (7) Failed to connect to http://mirror.racket-lang.org\|mirror.racket-lang.org port 443: Operation timed out Error: Download failed on Cask ‘racket’ with message: Download failed: https://mirror.racket-lang.org/installers/7.2/racket-7.2-x86_64-macosx.dmg


jimmysnielsen
2019-4-12 09:33:27

operation has timed out several times including yesterday.


pocmatos
2019-4-12 09:46:02

@jimmysnielsen It seems the mirror has been having a few issues. Maybe @jbclements or @mflatt can suggest alternatives.


pocmatos
2019-4-12 09:46:56

@jimmysnielsen not sure if there’s anything special with that brew thing but you can always download the dmg from https://www.cs.utah.edu/plt/installers/7.2/racket-7.2-x86_64-macosx.dmg


pocmatos
2019-4-12 09:47:13

which looks like it’s working.


jimmysnielsen
2019-4-12 09:47:41

thx @pocmatos I will get it from utah.


jimmysnielsen
2019-4-12 10:31:47

@pocmatos thanks. All is well now, just had to add the $PATH manually. did so via the instructions on https://beautifulracket.com/setting-the-mac-os-path.html


pocmatos
2019-4-12 10:32:40

Perfect, great to hear. Now, grab an espresso and go Racket! :sunglasses:


mark.warren
2019-4-12 13:02:15

Is anyone doing anything with racket and webassembly? I saw 3 projects on github but I don’t think there is much activity.


jerome.martin.dev
2019-4-12 13:02:51

mark.warren
2019-4-12 13:03:30

@jerome.martin.dev Cool, I missed that somehow.


jerome.martin.dev
2019-4-12 13:03:59

It was just an experiment, but I got a game working with it


mark.warren
2019-4-12 13:05:25

I’ve been playing with web assembly text, but clearly that is going to take a long time to produce anything useful.


jerome.martin.dev
2019-4-12 13:08:50

Well, I just had to make a canvas fill correctly with pixel data, and from there everything went smoothly


mark.warren
2019-4-12 13:08:59

Nice


casmajavi
2019-4-12 16:57:28

@casmajavi has joined the channel


travis.hinkelman
2019-4-12 16:58:29

How would I convert a procedure name to a string for use in string-append?


greg
2019-4-12 17:01:03

@travis.hinkelman object-name should give you that for procedures (and other values like structs and things made using structs likes ports etc.).


greg
2019-4-12 17:02:39

Well it gives you a symbol but you can symbol->string or use ~a.


greg
2019-4-12 17:04:41

Even anonymous function values from lambda get names, they’re just not always good names. :slightly_smiling_face: You can procedure-rename them. e.g. A few months ago I blogged about doing that with thread thunks for better logging output: https://www.greghendershott.com/2018/11/thread-names.html


philip.mcgrath
2019-4-12 17:14:47

I am getting this strange error from file-size, inconsistently, some of the many times I call it in a loop: file-size: contract violation expected: file? given: #<path:/pond/quick/AppleStoreBackup/Music/.DS_Store> I hope the error message could help to track down the problem, because it refers to file? and there is no such predicate: the contract asks for path-string?. But so far I haven’t found file? in the Racket sources. The problem doesn’t seem to be actually getting the file size, because, out of context, this works: philip@avalon:~$ racket Welcome to Racket v7.2. > (file-size "/pond/quick/AppleStoreBackup/Music/.DS_Store") 10244 > (file-size (bytes->path #"/pond/quick/AppleStoreBackup/Music/.DS_Store")) 10244 > (bytes->path #"/pond/quick/AppleStoreBackup/Music/.DS_Store") #<path:/pond/quick/AppleStoreBackup/Music/.DS_Store> Also, in case it’s relevant, I encountered this on Ubuntu, despite what you might guess from the file name in question.


oldsin
2019-4-12 17:31:41

Not sure if you are using htdp/dir (https://docs.racket-lang.org/teachpack/dir.html?q=htdp%2Fdir), as its file-size uses the file struct provided by this package. Otherwise I could not provide more help.


samth
2019-4-12 17:33:42

@philip.mcgrath that’s indeed odd


jbclements
2019-4-12 17:42:35

Are you familiar with the “file-exists?” predicate? I would imagine that the intent of this contract violation is to signal that the file fails this predicate. Just a guess, though.


lexi.lambda
2019-4-12 17:44:45

I think that @oldsin’s response (in the slack thread) is a compelling theory of how that error message might be generated, but I have no idea how an entirely different file-size procedure could get called if it’s really just running in a loop!


philip.mcgrath
2019-4-12 18:33:41

@oldsin Nope, I’m just using the file-size from racket/base. (Or at least, per @lexi.lambda’s comment, I think I am, and I seem to be on the other iterations of the loop.)


samth
2019-4-12 18:38:25

I genuinely looked in the source and can’t find a way it could generate that error message


philip.mcgrath
2019-4-12 18:39:17

@jbclements Yes, my guess was that file? is a mis-typed version of file-exists?—but, of course, the file does exist, and Racket knows that except in this loop. I wondered if the problem might be a system-level error (like, maybe I’m sizing too many files too quickly or something) that a low-level layer like rktio is incorrectly assuming to be a file-does-not-exist error: but, as I said, I haven’t found anywhere in the source that would put the string file? into an error message.


greg
2019-4-12 19:20:06

@philip.mcgrath Not sure it matters, but: What is the loop iterating? Items from an in-directory sequence? Or from directory-list? Or elsewhere?


lexi.lambda
2019-4-12 19:20:19

How big is the program producing the error message? Can you make a smallish program that reproduces it?


philip.mcgrath
2019-4-12 19:22:34

The program is very short; here it is: (struct directory (path-bytes) #:prefab) (struct file (path-bytes size) #:prefab) (struct symlink (path-bytes target) #:prefab) (define roots '(#"/pond/quick/AppleStoreBackup/Music/" #"/pond/iTunes/" #"/pond/aux-storage/2018-02-04-iTunes-pre-purge/" #"/pond/aux-storage/iTunes-remote/" #"/pond/aux-storage/Sapientia~/philip/Music/")) (module+ main (require racket/cmdline racket/file) (command-line #:args (output-file) (call-with-atomic-output-file output-file (λ (out tmp) (for* ([root (in-list roots)] [pth (in-directory (bytes->path root))]) (define bs (path->bytes pth)) (write (cond [(link-exists? pth) (symlink bs (path->bytes (resolve-path pth)))] [(directory-exists? pth) (directory bs)] [(file-exists? pth) (file bs (with-handlers ([exn:fail? (λ (e) (println e) (println pth) (raise e))]) (file-size pth)))] [else bs]) out)))))) (The with-handlers is from a previous attempt at debugging, which wasn’t helpful.)


philip.mcgrath
2019-4-12 19:23:37

The issue is that I haven’t yet managed to reproduce the error outside of walking these particular directories, which are many hundreds of GB.


rokitna
2019-4-12 19:26:35

do you intend for file-size to call the field accessor of your struct file at the top there? that looks like what could be happening


lexi.lambda
2019-4-12 19:41:42

Yes, it seems like that should always fail.


lexi.lambda
2019-4-12 19:43:08

…which DrRacket’s binding arrows would make very clear, I might add. :)


philip.mcgrath
2019-4-12 19:48:08

Ugh. Yes, that would be the problem. I don’t know why it seemed to work for some number of iterations into the loop … I guess I must not have been getting to the file-exists? case as early as I expected. Thanks, all.


greg
2019-4-12 20:06:40

Ah. So @oldsin had the right intuition — are we sure what what file-size is bound to? @lexi.lambda is right, the DrR binding arrows help with that, if you’re using DrR and have background expansion on. Otherwise go-to-definition is another sanity check. (I’m typing this as captain-obvious postmortem notes for my own benefit.)


greg
2019-4-12 20:07:44

This reminds me, lately I’ve been experimenting more with capitalizing struct names. At least, I was doing that with some prefab structs used for a light wire format. That might have helped here. But I’m not sure that’s a good argument for or against capitalizing struct names.


greg
2019-4-12 20:09:18

I guess it’s really just: Racket lets you redefine everything. Which is awesome and usually isn’t a problem.. but sometimes it is.


leif
2019-4-12 21:56:28

@mflatt When you use syntax-binding-set-extent, what are the module path’s resolved relative to?


leif
2019-4-12 21:56:48

(or I guess, does it just produce a syntax object with unresolved module path indexes.)


mflatt
2019-4-12 22:00:13

I think the MPIs should be built on some existing MPI, or they should be non-relative MPIs (i.e., don’t use #f as the base if the path is relative).


leif
2019-4-12 22:04:48

Sure, I just note that you can use the self module path ((module-path-index-join #f #f)) without any seeming errors.


leif
2019-4-12 22:07:08

LIke with:

(syntax-binding-set->syntax
 (syntax-binding-set-extend
  (syntax-binding-set)
  'blue
  0
  (module-path-index-join #f #f))
  'hello)