nma.arvydas.silanskas
2019-7-4 08:16:35

@nma.arvydas.silanskas has joined the channel


nma.arvydas.silanskas
2019-7-4 08:23:09

Hi, do you know how can I disable tests for package I uploaded to https://pkgs.racket-lang.org/index.html ? I made a wrapper for a C lib, and when it tries to invoke tests (which are there none btw), it fails because it naturally cannot find a .so file


jerome.martin.dev
2019-7-4 08:49:03

@nma.arvydas.silanskas Hi! There are usually multiple ways to do that: - You want some executable parts of your Racket files to NOT execute when running tests → Put that code inside a (module+ main <your code here>) to prevent it from being executed by raco test (which looks for a test submodule) - You want a whole directory of your package to be left out → See https://docs.racket-lang.org/raco/test.html?q=.info#%28part._test-config-info%29


jerome.martin.dev
2019-7-4 08:50:31

Oh, and third way: - You can make an empty (module+ test) inside a module without tests


jerome.martin.dev
2019-7-4 08:56:36

I think the most used in the wild is the third way : just define an empty test submodule. The main submodule trick is useful only when you have a Racket file expected to be the entry point for your program, and should not be required by other modules. Setting the code in a main submodule will prevent both tests and imports from executing the code.


jerome.martin.dev
2019-7-4 09:01:11

For example, I have a file that is called start.rkt in one of my packages. It starts up a server when called. If I push that to the package repository, it will get executed, will fail at starting up a server (because the repository’s sandbox will prevent it) and then hang, timeout, and fail. By putting the content of my start script in a main submodule, none of that happens and everyone’s happy :smile:


jerome.martin.dev
2019-7-4 09:03:57

On the other hand, if I have a file that is just a regular module expected to be imported, but has no tests in it, I should create an empty (module+ test) at the end of the file, to tell the raco tester that there’s nothing to see here.


sorawee
2019-7-4 09:16:14

@nma.arvydas.silanskas see also the same question that came up a few weeks ago: https://racket.slack.com/archives/C06V96CKX/p1561054954100700

The solution is to completely disable raco test on package server, but not on regular raco test (which is useful if you want to add tests later to your package) by checking the envvar PLT_PKG_BUILD_SERVICE. That is, put (define test-omit-paths (if (getenv "PLT_PKG_BUILD_SERVICE") 'all '())) in your info.rkt. See an example here: https://github.com/emina/rosette/blob/master/info.rkt


nma.arvydas.silanskas
2019-7-4 09:39:14

wow very fast response thanks :slightly_smiling_face: I’ll check it when I’m gone home


pocmatos
2019-7-4 09:51:10

@samth in preparation for the first-issue tag, can we start tagging bugs? Maybe we could start by doing it automatically using: https://github.com/marketplace/issue-label-bot Are you able to get that installed in racket/racket


pocmatos
2019-7-4 09:51:11

?


stefan.kruger
2019-7-4 10:45:30

Another newbie question — I have a file that contains lines of strings that I’d like to treat as “just bytes”, but no matter how I seem to read the data, any string escapes seem to be processed. Consider a line containing d\" - I like to be able to treat that as (bytes 100 92 34). I had expected a byte-string to be just that, but that must be an error on my behalf: > (bytes-length #"d\"") 2 > (bytes-length (bytes 100 92 34)) 3


pocmatos
2019-7-4 10:47:59

@stefan.kruger do you mean (bytes-length #"d\\\"")?


pocmatos
2019-7-4 10:48:25

There are only two bytes in your first example, the first is d, the second is ".


pocmatos
2019-7-4 10:48:36

The \ is used to escape the "


pocmatos
2019-7-4 10:49:04

This is required because the bytestring is itself delimited by "


stefan.kruger
2019-7-4 10:50:06

Sure.


stefan.kruger
2019-7-4 10:50:56

How do I read data between newlines in a file, and have it as (bytes …) leaving any backslashes etc as is?


pocmatos
2019-7-4 10:52:53

read-bytes?


pocmatos
2019-7-4 10:53:17

is this not doing what you want?


stefan.kruger
2019-7-4 11:09:43

Hmm. Not sure why I find this confusing. But reading around some more I came across in-bytes-lines, which allowed me to do: (call-with-input-file "data/data.txt" (λ (f) (for/fold ([counter 0]) ([line (in-bytes-lines f)]) (+ counter (bytes-length line)))))


stefan.kruger
2019-7-4 11:10:03

which produced the result I was after.


spdegabrielle
2019-7-4 13:37:06

is there video of Rebooting Racket ELS 2019 keynote by Matthew Flatt?


mflatt
2019-7-4 13:40:18

I’m pretty sure it wasn’t recorded


mflatt
2019-7-4 13:43:44

The upcoming ICFP variant (http://www.cs.utah.edu/plt/rkt-on-chez/) in August will be recorded, I assume.


spdegabrielle
2019-7-4 14:31:44

thanks I forgot about ICFP/Scheme workshop sounds exciting. I’d love to see Solver-Aided Programming for All by Emina Torlak.


spdegabrielle
2019-7-4 14:32:13

Solver-Aided Programming sounds exciting!




jjwiseman
2019-7-4 16:57:16

@jjwiseman set the channel purpose: General discussion about racket-lang. Invite others through https://racket-slack.herokuapp.com/.i t to. Thugs gcc


abmclin
2019-7-4 17:19:10

@jjwiseman the first part of the new channel purpose statement seems fine except for the very last few bits .i t to. Thugs gcc. those don’t seem right to me


jaz
2019-7-4 17:53:13

We are rather thuggish


jjwiseman
2019-7-4 18:42:25

Uh. I didn’t do that?


jjwiseman
2019-7-4 18:42:32

That’s very weird.


jjwiseman
2019-7-4 18:46:25

I was driving when slack sent a notification to my locked phone that I was mentioned here. It’s hard for me to imagine that it was any of my devices that did that, so I dunno.


jjwiseman
2019-7-4 18:47:09

@jjwiseman set the channel purpose: General discussion about racket-lang. Invite others through https://racket-slack.herokuapp.com/


jjwiseman
2019-7-4 18:47:48

(I’m in the mountains of New Hampshire with poor reception, sorry I couldn’t fix it earlier)


nma.arvydas.silanskas
2019-7-4 19:06:34

why (list? ' 'a) is #t, and where can I read more on about it?


lexi.lambda
2019-7-4 19:07:02

soegaard2
2019-7-4 19:07:51

’’a is short for (quote (quote a)) so it evaluates to (quote a) which is a list.


samth
2019-7-4 19:08:20

@jjwiseman no worries, enjoy the whites


nma.arvydas.silanskas
2019-7-4 19:17:34

hmm interesting, but something that probably never should appear in proper code I suppose. If I were Scheme lecturer in uni or elsewhere, I’d def put this in the exam


notjack
2019-7-4 21:05:23

@nma.arvydas.silanskas why? if it should never appear in proper code, I doubt it should appear in exam code


samth
2019-7-4 21:07:20

''x can appear in metaprogramming contexts, where you want to create a program that uses quote


samth
2019-7-4 21:07:54

I often find it clearer to use (quote x) explicitly in that case, but some of the complexity is the same