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

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

@maxime.jak has joined the channel

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

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.

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

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"

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

Thanks. I get it now!!!

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

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

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

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

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

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

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

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

Interesting! Thanks for the information, it is certainly helpful

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"

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

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?

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.

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

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&p1=136&p2=204&p3=179&p4=224\|https://www.timeanddate.com/worldclock/converter.html?iso=20210703T200000&p1=136&p2=204&p3=179&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

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.

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

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.

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

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

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

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.

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

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/