sorawee
2021-7-2 07:41:16

@mflatt unfortunately, while it does copy the correct libcairo2.dylib to racket/lib now, it looks like as long as lib-search-dirs is modified, the system will still use a wrong libcairo2.dylib, resulting in the same crash.


mflatt
2021-7-2 11:57:54

Does putting #f before "/opt/homebrew/lib/" in lib-search-dirs solve the problem?


maxime.jak
2021-7-2 12:15:13

@maxime.jak has joined the channel


sschwarzer
2021-7-2 13:09:55

Reminder: Tomorrow is a Racket online meeting ( https://racket-news.com/2021/06/racket-news-issue-51.html#meetups ) :slightly_smiling_face:


kyp0717
2021-7-2 13:51:33

Hello. I was looking into date functions and came across this snippet of code … (parameterize ([current-locale "en"])     (list (parse-date "January 24, 1977" "LLLL d, y")     (parse-date "2015-03-15T02:02:02-04:00" "yyyy-MM-dd'T'HH:mm:ssxxx"))) '(#<date 1977-01-24> #<date 2015-03-15>) I don’t understand the usage of parameterize . current-locale "en" set the global values for locale I assumed. So what is parameterizing the locale variable and how does it affect the parse-date function. Please advise.


samth
2021-7-2 13:56:54

That sets the value of current-locale for the scope of the parameterize form, so just for that list expression.


soegaard2
2021-7-2 13:58:12

Suppose I in Denmark run (parse-date "January 24, 1977" "LLLL d, y"). And that I had the locale set to “da”, then the problem for me is that “January” needs to “Januar”. So if you know the strings contains english names for month, make sure the locale is set to “en” before parsing them.

(current-locale "da") (list (parse-date "January 24, 1977" "LLLL d, y") (parse-date "2015-03-15T02:02:02-04:00" "yyyy-MM-dd'T'HH:mm:ssxxx")) gives: ; Unable to match pattern [ ] against input "y 24, 1977"


soegaard2
2021-7-2 13:58:47

Turns out my locale was set to "" which (I think) defaults to “en”.


kyp0717
2021-7-2 14:26:19

Thanks. I get it now!!!


massung
2021-7-2 14:26:27

parameterize is Racket’s version of dynamically-scoped (not global) variables.


massung
2021-7-2 14:27:25

Probably the best example is current-output-port, which is dynamically scoped as well.


maxime.jak
2021-7-2 14:34:33

Hi, I have a question about the read-line function. I want to interactively read user input (from the repl), but by default, (read-line (current-input-port)) returns the empty string. How do I provide the right input port? (note: (read-line (current-input-port)) does work as expected when using DrRacket, but not in Emacs or the terminal).


soegaard2
2021-7-2 14:38:48

Hi @maxime.jak . I think, read-line is the wrong tool for the job. Maybe readline is better? https://docs.racket-lang.org/readline/index.html?q=readline


soegaard2
2021-7-2 14:40:40

I am not sure how it works inside DrRacket and Emacs though.


maxime.jak
2021-7-2 14:45:09

Thank you @soegaard2, I will probably use readline then!


shu--hung
2021-7-2 14:50:27

In this particular case, read-line returned the empty string because it consumed the \n character right after (read-line...input-port)) in the terminal


samth
2021-7-2 14:50:29

@maxime.jak interactive input and the REPL don’t play nicely together, because they both want to be in control. Using the readline library will help but mostly I recommend writing a program as a module and then you don’t have to worry about the REPL getting in the way.


maxime.jak
2021-7-2 14:53:09

Interesting! Thanks for the information, it is certainly helpful


shu--hung
2021-7-2 14:54:08

here is a proof-of-concept (but not a solution): > (define (rl) (read-char (current-input-port)) (read-line (current-input-port))) > (rl) asdf qwerty "asdf qwerty"


maxime.jak
2021-7-2 14:55:50

I see, the read-char consumes the newline after entering return in the repl.


maxime.jak
2021-7-2 14:58:33

As a follow-up question out of interest, how would you construct the default input port? The code relies on (current-input-port) being supplied by Racket. However, if I would overwrite that parameter, how would I get the default one back?


soegaard2
2021-7-2 15:01:28

Here current-output-port is a parameter. The intended way of temporarily setting a parameter to another value is: (parameterize ([current-input-port (open-input-string "an example input port"))]) <do-something-here>) which set the current input back.


soegaard2
2021-7-2 15:03:05

For input and output ports, there are some common use patterns that call-with-input-port or call-with-input-string solves well.


spdegabrielle
2021-7-2 16:48:09

Racket Users Video Meetup (Saturday, July 3 at 20.00 UTC) <https://www.timeanddate.com/worldclock/converter.html?iso=20210703T200000&p1=136&p2=204&p3=179&p4=224|Timezone Converter> https://www.timeanddate.com/worldclock/converter.html?iso=20210703T200000&amp;p1=136&amp;p2=204&amp;p3=179&amp;p4=224\|https://www.timeanddate.com/worldclock/converter.html?iso=20210703T200000&amp;p1=136&amp;p2=204&amp;p3=179&amp;p4=224 <https://gather.town/app/wH1EDG3McffLjrs0/racket-users|Gather Town Room> https://gather.town/app/wH1EDG3McffLjrs0/racket-users\|https://gather.town/app/wH1EDG3McffLjrs0/racket-users


ryanc
2021-7-2 17:18:26

A port is just a value, so you can save it in a variable: (define original-in (current-input-port)) (parameterize ((current-input-port ___)) ___ original-in ___) If you didn’t save the original port, you’re not supposed to be able to get it from the parameter.


soegaard2
2021-7-2 17:41:17

Apropos the previous discussion on parameters . I found this question on StackOverflow - but it has been closed. I have given it an “reopen” vote. If you have enough SO reputation consider giving it a reopening vote too.

https://stackoverflow.com/questions/63313964/what-are-the-uses-for-parameters-in-racket


greg
2021-7-2 18:55:42

I’m CI seeing failures today: Run Bogdanp/setup-racket@v1.1 Looking up stable version... Installing Racket 8.1 (CS, full, x64)... installerURL = <https://mirror.racket-lang.org/installers/8.1/racket-8.1-x86_64-linux-cs.sh> Error: connect ETIMEDOUT 129.10.116.85:443 and indeed trying e.g. https://mirror.racket-lang.org/installers/8.1/racket-8.1-x86_64-linux-cs.sh in the browser from home also times out.


greg
2021-7-2 18:56:50

@popa.bogdanp Is it normal for the GH action to use mirror. instead of download.? I don’t know if that originates in your script, or if it’s the result of some redirect, or what.


greg
2021-7-2 19:00:00

If I’m understanding common.ts correctly it looks like you specify download.. I guess something on the Racket infra side redirects to mirror.; I don’t know if that’s normal or not, but anyway mirror. is timing out while download. is just fine. So maybe on the Racket infra side it could… just not redirect? idk


greg
2021-7-2 19:00:59

Looks like enough of us voted to reopen that it is now open again.


samth
2021-7-2 19:01:30

See the mailing list post about this, but basically mirror. is down temporarily for maintainence, download. is pointing to a different site that works, probably setup-racket should have used download. the whole time, and there’s a new version of setup-racket that does just that.


greg
2021-7-2 19:04:00

Ah. I’m probably using an older version of setup-racket. Thanks for that clue, I should have thought of that. Thanks!


eeide
2021-7-2 21:11:51

If you use Racket for operating systems or OS-like programming, I hope you will consider submitting a paper to the PLOS ’21 workshop.

:mega: Call for Papers: PLOS ’21: 11th Workshop on Programming Languages and Operating Systems https://plos-workshop.org/2021/

Sponsored by ACM SIGOPS / In conjunction with SOSP Paper submission deadline: August 6, 2021 Workshop: October 25, 2021

Historically, operating system development and programming language development went hand-in-hand. Today, although the systems community at large retains an iron grip on C, many people continue to explore novel approaches to OS construction based on new programming language ideas.

This workshop will bring together researchers and developers from the programming language and operating system domains to discuss recent work at the intersection of these fields. It will be a platform for discussing new visions, challenges, experiences, problems, and solutions arising from the application of advanced programming and software engineering concepts to operating systems construction, and vice versa.

Please visit the website for more info: https://plos-workshop.org/2021/