bedeke
2020-5-1 09:56:50

Hi all, can anyone help me to get this to run in typed racket? Welcome to DrRacket, version 7.7.0.4 [3m]. Language: typed/racket/base, with debugging; memory limit: 1024 MB. > (require racket/match) (match #hash((a . 3)(b . 4)) [(hash-table [a b][c d]) d]) ;Type Checker: Polymorphic function `hash-map' could not be applied to arguments: ;Domains: HashTableTop (-> Any Any c) ; (HashTable a b) (-> a b c) ;Arguments: (Immutable-HashTable Symbol Integer) (All (a) (-> a * (Listof a))) ; in: (match #hash((a . 3) (b . 4)) ((hash-table (a b) (c d)) d))


soegaard2
2020-5-1 09:58:33

@bedeke That reminds me - did we ever get your PR merged?


bedeke
2020-5-1 10:00:28

Which one? The ones about erf/gamma in the complex plane?


soegaard2
2020-5-1 10:00:37

Yes.


bedeke
2020-5-1 10:02:01

It’s not, but I also asked some questions after the review that have not been answered yet, so I think it needs a little more polish before being ready


soegaard2
2020-5-1 10:05:06

@jbclements What were you hinting about wrt the output types?


bedeke
2020-5-1 10:05:25

soegaard2
2020-5-1 10:06:26

That looks great!


bedeke
2020-5-1 10:07:08

thanks


soegaard2
2020-5-1 10:17:24

The hash-map must be something that match introduces, but I don’t know how to fix the problem.


alexknauth
2020-5-1 12:40:52

What dependencies do I have to install to be able to compile rktio_convert.c when building Racket from source so that using CoreFoundation/CFString.h works on Mac?


mflatt
2020-5-1 12:52:48

clang works but gcc doesn’t? Sounds like you have an unhelpful gcc in your path. You could either fix your system configuration to use gcc-as-clang or select clang as the compiler with something like make CONFIGURE_ARGS_qq=CC=clang.


samth
2020-5-1 12:57:46

@bedeke @soegaard2 that program is not going to typecheck in anything like that form — the expansion of hash-table in match is just too complicated.


bedeke
2020-5-1 13:04:35

Ok, thanks. Back to cond it is


alexknauth
2020-5-1 13:17:04

I have a version of gcc installed through a Nix package. Is that the problem?


samth
2020-5-1 13:17:21

you could use match on the output of hash-map, potentially


capfredf
2020-5-1 13:23:56

I think so. try make gcc an alias to clang


alexknauth
2020-5-1 13:25:25

I’ve removed the nix-profile bin from my PATH, and am trying again


gknauth
2020-5-1 13:25:58

I would try @mflatt’s suggestion before making gcc an alias for clang, because gcc isn’t clang.


bedeke
2020-5-1 13:26:12

oh neat. My real program has more nested hashes, but I think this could do the trick


capfredf
2020-5-1 13:30:17

clang has been pretending to be gcc on mac for a while


alexknauth
2020-5-1 13:32:48

I’m assuming the way the Racket build uses gcc is according to the common interface where clang would work just fine. (Probably doesn’t use any features that gcc has and clang doesn’t) After removing the nix-profile bin directory from my path so that gcc is back to Mac’s normal alias of clang, building Racket from source seems to be working so far. It has gotten past the point it failed before.


pocmatos
2020-5-1 14:23:14

Hi all, since a few version ago we have raco pkg install -D but for older versions the trick was to raco pkg install --no-setup X && raco setup -D X and I thought this would always work. It doesn’t. Not for collections-lib for example. See https://github.com/pmatos/actions-test/runs/636559583?check_suite_focus=true#step:5:4 Does anyone know why?


mflatt
2020-5-1 14:25:59

raco setup expects collection arguments, not packages. Use raco setup --pkgs to specify packagess instead of collections.


pocmatos
2020-5-1 14:28:30

ah! So what’s correct is raco pkg install --no-setup X && raco setup --pkgs -D X ?


mflatt
2020-5-1 14:30:12

I think --pkgs needs to be after any other flags.


mdssjc
2020-5-1 14:30:33

@mdssjc has joined the channel


pocmatos
2020-5-1 14:42:48

Yep… thanks!


pavpanchekha
2020-5-1 15:18:58

Has anyone ever seen this error message: ../../src/uceil_log2.c:40: MPFR assertion failed: exp < 1023 I assume it is an MPFR issue, and I’m told I’m the only one using the bigfloat library, but just asking


soegaard2
2020-5-1 17:05:16

@plragde Did you solve the width problem?


laurent.orseau
2020-5-1 17:06:04

What’s the best way to check whether I’m currently running my program in DrRacket or on the command line? Currently I’m checking the output of (system "tty") but there must be a better way I guess.


laurent.orseau
2020-5-1 17:06:21

(on Unix)


soegaard2
2020-5-1 17:07:37

Haven’t seen it - but I don’t use bigfloats that often.


soegaard2
2020-5-1 17:08:14

In principle racket-cas supports bigfloats, but the bigfloat tests are scarce…


soegaard2
2020-5-1 17:08:23

in racket-cas that is.


soegaard2
2020-5-1 17:09:10

@laurent.orseau I think by design that it is meant to be hard to figure out, that the program is running in DrRacket.


laurent.orseau
2020-5-1 17:10:48

Basically I need to know whether the current output supports colors


laurent.orseau
2020-5-1 17:11:17

Ideally I’d have DrRacket know about ansi colors, but I don’t think that’s going to happen anytime soon


soegaard2
2020-5-1 17:12:56

The tty trick doesn’t seem to work on macOS:


soegaard2
2020-5-1 17:13:08

(in the terminal)


laurent.orseau
2020-5-1 17:15:09

indeed. At least it works when running a program from the command line


laurent.orseau
2020-5-1 17:16:12

(system "tput colors") looks better. Can you confirm?


soegaard2
2020-5-1 17:17:02

FWIW The Julia project has run into the same error, so maybe it is an MPFR problem.

https://github.com/JuliaMath/SpecialFunctions.jl/issues/127


soegaard2
2020-5-1 17:17:38

soegaard2
2020-5-1 17:18:05

And in DrRacket:


laurent.orseau
2020-5-1 17:18:24

cool, thanks


laurent.orseau
2020-5-1 17:25:58

Here’s the magic code: (let ([out (open-output-string)]) (define res (parameterize ([current-output-port out] [current-error-port (open-output-string)]) (system "tput colors"))) (string->number (string-normalize-spaces (get-output-string out))))


samdphillips
2020-5-1 17:56:55

You could check if (port-writes-special? (current-output-port)) returns #f


samdphillips
2020-5-1 17:57:09

Also not 100% probably


soegaard2
2020-5-1 17:57:52

Does the repl in racket-mode support ansi colors?


pavpanchekha
2020-5-1 17:59:56

I filed a bug in MPFR; it’s a known issue that will be released in 4.0.2 (eventually…) that specifically affects erf and erfc


plragde
2020-5-1 18:00:32

Yes, thanks! It was a CSS issue with the embedded player, nothing to do with Racket at all. I should still learn how to vary some of the layout from scribble/manual defaults, but that can wait.


capfredf
2020-5-1 18:07:21

you can use ansi color control code at repl


capfredf
2020-5-1 18:07:25

soegaard2
2020-5-1 18:08:33

Hmm. From a racket-mode repl in GUI emacs on macOS:


soegaard2
2020-5-1 18:09:22

@laurent.orseau ^


greg
2020-5-1 18:18:41

Things that use comint-mode in Emacs — like M-x shell, and the Racket Mode REPL — probably have in newer Emacs by default the ansi-color-process-output function in the variable comint-output-filter-functions. In other words, there is no “terminal” involved, simply an Emacs function that looks for ANSI color codes in the output text and arranges for those to be changed into color text properties in the buffer.


greg
2020-5-1 18:19:23

Of course Emacs also has M-x ansi-term, and in that tput colors returns something like 8 for me.


greg
2020-5-1 18:20:30

For the Racket Mode REPL buffer, the comint-output-filter-functions variable by default looks something like this: (racket-repl-display-images ansi-color-process-output comint-postoutput-scroll-to-bottom comint-watch-for-password-prompt) Which explains certain “magic” you may see.


greg
2020-5-1 18:21:17

But all of these except racket-repl-display-images is just the standard comint-mode stuff you’d also see in e.g. M-x shell and probably many other languages’ REPLs.


soegaard2
2020-5-1 18:21:57

How can Laurent determine that the program is running inside a racket-mode repl?


greg
2020-5-1 18:23:00

Good question. In general, I’m oriented toward trying to make programs not know they’re running inside the Racket Mode REPL because that’s usually desirable. :smile:


pavpanchekha
2020-5-1 18:23:26

I’m getting this error from raco: Downloading repository <https://github.com/oflatt/egg-herbie.git#egg-herbie-deploy-linux> 11 git-checkout: no commit found matching id I suspect this is because the egg-herbie repository does not preserve history (or old commits); how do I get the package server to get the most recent commit ID?


greg
2020-5-1 18:23:29

You could look for the env var EMACS, but that doesn’t narrow it down from e.g. ansi-term.


greg
2020-5-1 18:24:20

I could try to provide some “official” and stable way, to detect.


soegaard2
2020-5-1 18:27:00

Not sure whether there is a better method, but sign in to http://pkgs.racket-lang.org\|pkgs.racket-lang.org and then choose “Rescan all my packages”.


greg
2020-5-1 18:27:38

(require racket/tcp) (tcp-port? (current-output-port)) is a clue but that’s a detail of the implementation today.


soegaard2
2020-5-1 18:27:58

The alternative is of course to let the user configure the program whether to use ansi or not.


soegaard2
2020-5-1 18:28:10

Automatic would be cool though.


greg
2020-5-1 18:28:14

I feel like “output ANSI color codes?” is the sort of thing where maybe it’s nice to try to auto-detect but … ah you typed just what I was going to type.


greg
2020-5-1 18:28:22

:slightly_smiling_face:


soegaard2
2020-5-1 18:28:28

Great minds…


laurent.orseau
2020-5-1 18:32:26

Yeah i have parameter that can be changed by the user but it’s annoying so I’m trying to do it as automatically as possible. –1 is actually ok since it’s still a number :D


soegaard2
2020-5-1 18:32:51

Oh boy…


laurent.orseau
2020-5-1 18:40:58

Doesnt it mean infinite? ;)


alexknauth
2020-5-2 00:24:45

So with this using clang, the build mostly worked, except for one thing, an error rendering the docs involving bytes-convert and bytes-open-converter: raco setup: running: &lt;pkgs&gt;/racket-doc/scribblings/reference/reference.scrbl examples: exception raised in example error: "bytes-convert: contract violation\n expected: bytes-converter?\n given: #f\n argument position: 1st\n other arguments...:\n #\"ABCD\"" This seems to be because bytes-open-converter is returning false on the version I built from source: $ racket Welcome to Racket v7.5.0.13. &gt; (bytes-open-converter "UTF-8" "UTF-16") #&lt;string-converter&gt; &gt; ^D $ ./racket/bin/racket Welcome to Racket v7.7.0.4. &gt; (bytes-open-converter "UTF-8" "UTF-16") #f &gt; ^D The docs say it returns false if the requested conversion pair is not available. Why would it available in a snapshot version, but not a version built from source?


samth
2020-5-2 01:20:46

Another possibility is to use raco pkg install —clone


santoshthapa.wk
2020-5-2 03:47:17

@santoshthapa.wk has joined the channel