Good day! Is there any pure variant of Racket, or plans to add controlled effects into Racket?
Hi, is this a valid use of hash-update!
or is it not recommended (hash-update! hsh chunk
(λ (val) (+ val 1))
(λ () 0))
It adds any key that is looked for and initialises it to 0, but also immediately adds 1.
Is there a Racket development roadmap?
@mario.luis.guimaraes for these type of questions you will have to wait for US to wake up. Also consider asking it on mailing list.
Yep, I now they are still sleeping :smile:. How do you think the core guys pay more attention to the mailing list?
Simply, some (like Matthias) are not even on Slack, from the core team only Sam seems to be regular, others reply mostly when mentioned
As a rule of thumb if you are trying to get quick answer to current problem Slack is better, when things get more complex mailing list is a way to go, that’s my experience at least.
@mario.luis.guimaraes Check: https://groups.google.com/forum/#!msg/racket-dev/2BV3ElyfF8Y/4RSd3XbECAAJ
Thank you people
Hello, I’m just started the HTDP2 book and I really love it, but sometimes I’m having hard times to figure out what exactly do I have to accomplish in exercises. Could someone please point me out to a right direction for the Exercise 9
:
Exercise 9. Add the following line to the definitions area of DrRacket:
(define in ...)
Then create an expression that converts the value of in to a positive number. For a String, it determines how long the String is; for an Image, it uses the area; for a Number, it decrements the number by 1, unless it is already 0 or negative; for #true it uses 10 and for #false 20.
my solutions for the each case: ;String
(define in "hello")
(if (string? in) (string-length in) false)
;Number
(define in 5)
(if (number? in)
(if (>= in 0) (- in 1) false)
false)
;Image
(define in (rectangle 10 20 "solid" "blue"))
(if (image? in) (* (image-width in) (image-height in))
false)
The concern I have is about last sentence of the problem statement: for #true it uses 10 and for #false 20.
Does that mean that I need to replace all booleans to numbers? And if YES, what’s the point? I guess it is really simple and I’m over complicating things, but I’m confused.
I would really really appreciate for any help and I’m sorry if it is a wrong place to post my problem.
Thanks a lot in advance!
I believe that the question is asking for a single expression, not one for each type.
Your expression for Number works for all cases where ‘in’ is a number. Similarly, your expression for Boolean (or subexpression of the full answer) should work for all cases where ‘in’ is a Boolean value. It’s the same idea.
@mario.luis.guimaraes I don’t think anyone is working on limited effects for Racket
@samth I did not mean controlled in the sense of having some limitation, but controlled in the sense that the compiler’s type system tracks which effects each function does (like Haskell’s IO or better Purescript’s Eff)
@a.nastaev The exercise doesn’t say what the result should be if none of the cases hold (if ‘in’ is not one of these four types). You chose ‘false’, which is a reasonable choice. The point of the exercise is just to give you practice in working with predicates and complex conditional expressions.
@plragde Thank you so much! Let me digest everything what you said and I’ll get back to you shortly! Thanks again! I really appreciate your time!
There is not a unified Racket roadmap, only the stuff everyone is working on at the moment
So what is the closest to the “roadmap” ? The list of issues and PRs on https://github.com/racket/racket ?
@a.nastaev You’re welcome! You should ask lots of questions. Self-study is great but it’s too easy to get stuck or spend too long being confused.
@plragde Thank you so much again! Looks like I will ask tons of questions.
@mario.luis.guimaraes there really isn’t a roadmap
@samth Yes, I understood, so “the stuff everyone is working on” is it the list of issues and PRs on https://github.com/racket/racket ?
no, it mostly isn’t
@samth is it listed somewhere publicly?
no, what I’m trying to say is that there is not an organized plan for what people are working on
ok …
and if you want to know, say, what people working on Typed Racket are doing then you can ask people like me or @ben or @pnwamk and for other parts of Racket you can talk to other people
Thanks
@mario.luis.guimaraes you may find the following helpful to identify people to ask about specific features: https://github.com/racket/racket/wiki/Release-repo-managers
@githree This list is really useful. Thanks
@mario.luis.guimaraes The roadmap is: “One #lang to rule them all…”
Ahah, or perhaps “Many #lang to rule them all.. ”
@rokitna has joined the channel
"…and in the transformer environment bind them"
@mark.warren https://racket.slack.com/archives/C09L257PY/p1551262639034000 It looks like your question, about actually writing code in Racket, got overlooked due to more research-in-case-someday-I-might-use-Racket stuff. How you’re using hash-update!
there looks fine to me! Note that you could use simply 0
instead of (λ () 0)
for the default. Also (λ (val) (+ val 1)
is the same as just add1
. So the whole thing could be (hash-update! hsh chunk add1 0)
. But the way you wrote it is good, too. Maybe better. Depends on your team/audience.
@greg Thanks Greg, I thought the question had got a bit swamped, but great answer, cheers.