I installed the latest Elementary OS, a Linux distro, installed the latest version 6 then 7 of Racket and they both have this problem: when you exit DrRacket, the warning box to save your work only shows the X and you can’t save or even exit the DrRacket.
@steveh2009 can you report at bug at http://github.com/racket/racket/issues\|github.com/racket/racket/issues ?
I don’t have a github account and don’t want to open one just for this. It works on Lubuntu so I’ll stick with that.
I’m familiar with HtDP and SICP. I’m trying to teach basic programming in a week to beginners. My plan is to combine the theories of education promoted by developmental psychologists like Jean Piaget with my personal experience in hackerspaces. Essentially, I want to take a day or two to walk through the basics and then help the students solve their own problems. I would like to ask if anyone else here has done anything similar and for advice on a good, short jumpstart into programming (ideally with Racket :slightly_smiling_face: ). This isn’t one of those commercial “bootcamps”, just a community project aimed at helping creative people gain technical skills they otherwise think is beyond their capacity. Advice appreciated, I’m just some guy not a professor or anything.
Even advice on key selections from HtDP or something like that would be great, I just won’t have the time to methodically work through an entire textbook. I’m tempted to just take from the introduction but I don’t have the personal history of teaching the material to know whether or not that is wise, and thought maybe someone here would have already done the work of finding a good “condensed” place to begin.
@samth To follow up from last night https://github.com/greghendershott/racket-mode/commit/8180205ef83893e2a99e40168194b6d01b8e3281 should be on MELPA soon-ish. Also if you’re patching locally note this is a different commit than what I shared last night.
@greg what do I run to upgrade from melpa?
It’s probably simplest and most reliable to do M-x package-delete
and enter racket-mode
, then M-x package-install
, racket-mode
.
is there an upgrade command if i’m feeling lucky?
Maybe as step 0 do M-x package-initialize
if that’s not already in your Emacs init file.
The lucky/official way is M-x list-packages
, then use its UI buffer to mark packages to upgrade, then say upgrade them.
I’m not sure that’s really easier ¯_(ツ)_/¯
At least for a package like racket-mode, on which no other packages depend
@nathaniel Not Racket-oriented, but there are many good resources at http://code.org\|code.org, both for kids and adults.
If the audience is adults with no technical expertise, maybe some of the high-school-level resources would be applicable: https://code.org/educate/curriculum/high-school
And honestly, even for adults, some of those “create your own game in 1 hour” tutorials can be quite fun :slightly_smiling_face:
thanks for the advice!
Hope it helps! I’m only learning Racket myself, but have been programming for many many years. Lately I’m also interested in teaching programming, but for my two kids. I’ve used Scratch so far (http://scratch.mit.edu\|scratch.mit.edu - also interesting but more kid-oriented), I’ve been thinking of maybe using Realm of Racket.
Question: what is “SICP” (from your question)?
The S tructure and I nterpretation of C omputer P rograms https://en.wikipedia.org/wiki/Structure_and_Interpretation_of_Computer_Programs
Ah! Of course :slightly_smiling_face:
Thanks.
I just published a short article about the type of call/cc
that may interest Racketeers: https://www.leafac.com/prose/understanding-the-type-of-call-cc/
I’d love to hear what you have to say about it.
This is very illustrative. I really like it
Thank you.
I like it too; didn’t expect it to approach the topic from a type-system perspective but the types did help in the end
Hi
I’m obviously missing something while trying to write a minimal, gracefully restarting web server.
Given this code: http://pasterack.org/pastes/85563
What I expect:
curl localhost:8000
prints “begin”, waits for ten seconds and then prints “end”- Pressing
Ctrl-C
in the window running the server waits until the request has been processed completely and then shuts down the server
What actually happens:
curl localhost:8000
waits for ten seconds and then prints “begin” and “end”- Pressing
Ctrl-C
in the window running the server immediately terminates the process
Does anybody here have an idea what I might be doing wrong?
Thanks for reading.
@dario.hamidi my guess is that the exn:break is delivered to another thread than the one you’re catching it in
and that out
is not connected to the network directly, but is a buffer
I enjoyed reading your article, my question is why the constraint that the type of k
’s argument must be the same as the return type of call/cc
’s function argument and call/cc
’s return type? Racket’s call/cc
doesn’t appear to have that restriction.
I understand that the motivating examples intentionally ensure that k
’s argument type is the same but there’s no a prior reason for that. Shouldn’t it be possible to supply any arbitrary value we want to the k
even if they cause an exception to be raised if used incorrectly in the surrounding continuation?
Won’t it make more sense to say call/cc : ((α → β) → γ) → (∪ α γ)
where (∪ α γ)
denotes the union of the type variables α
γ
?
I’m not familiar with type theory so don’t know the correct way to express the concept of typing a union of types.
@abmclin as I understand, it’s because traditional type systems (like Hindley–Milner) don’t support untagged union. And when we talk about types, we tend to assume that we are using this kind of type systems.
Untagged union is really complicated. Most programming languages that have it need it because they were not originally designed with type system in mind. Most programming languages that are designed with type system in mind usually don’t need untagged union.
I see that googling tells me there’s the corresponding concept of tagged union or otherwise called disjoint union or sum type. I suppose if we’re using a type system that supports tagged union then the notation would be call/cc : ((α → β) → γ) → α + γ
The question then becomes why do we assume traditional Hindley-Milner type system? Is it safe to assume that @leafac is assuming HM?
@abmclin Your observation is correct and it’s closer to the type that call/cc
has in Typed Racket. This is part of the complexity I’m trying to sweep under the rug when I say “In Typed Racket the type of call/cc is a bit more elaborate, but for reasons that are beyond the scope of this article.” This topic is already pretty complicated as it is.
@sorawee’s interpretation is correct, I wrote this with a Hindley–Milner type system in mind. These assumptions should be made more clear and I’ll revise the article accordingly.
I guess if the traditional type system can’t cope with tagged unions then why not use a better one? :slightly_smiling_face:
@leafac ok I see, I thought the topic in your article was straightforward, it didn’t seem difficult or complicated and was comprehensible except for that observation
Thanks for reading and for the comments.
FWIW I found this thread in the mailing list: https://groups.google.com/forum/#!searchin/racket-users/streaming$20response%7Csort:date/racket-users/fc0mRI-empE/28Q5gUopBgAJ
The important bit being:
> The reason why responses have the lambda rather than a byte string is specifically for streaming like you want. Make sure you specify the correct response size in the headers.
And indeed, specifying the “Content-Length” headers make the “begin” show up before the “end”.
That’s at least a step in the right direction
I published a revision with: (1) an appendix addressing this concern @abmclin raised; (2) an alternative argument for k
’s return type; and (3) an acknowledgements section thanking you for your contributions.
I like your new rewrite, it’s more satisfying in that it answers my immediate questions and points me to where I can explore more
@mflatt I have a weak hash table containing ephemeron values, and I’ve noticed that it’s possible for a GC to collect the value inside the ephemeron after the key is passed to hash-ref
but before ephemeron-value
is applied, as illustrated by this program: #lang racket
(define h (make-weak-hasheq))
(define (f)
(define k (gensym))
(hash-set! h k (make-ephemeron k (gensym)))
(ephemeron-value (begin0 (hash-ref h k)
(collect-garbage)
(collect-garbage)
(collect-garbage))))
(f) ; => #f
In my situation, I’m not using this table as a cache, so I really do need the value. I can insert a hack so that k
is referenced later in the program, but this seems fragile… I don’t know which uses of k
the optimizer might optimize away, so I don’t know that I can rely on that working. Is there a proper way to ensure that hash-ref
+ ephemeron-value
is somehow atomic with respect to the reachability of k
?
Why not (define (f)
(define k (gensym))
(let ([v (gensym)])
(hash-set! h k (make-ephemeron k v))
v))
?
In my real program, the part of the program writing the value is not the same part reading the value.
@jeapostrophe I have a student who created the “r-linq” package on http://pkgs.racket-lang.org\|pkgs.racket-lang.org but then deleted it, and it wasn’t deleted but now is in a weird state where it has no author but still exists.
Also, it seems like the “Create new package” interface no longer adds .git
which causes things to break.
That’s interesting problem. The ffi/unsafe
library provides void/reference-sink
to reliably retain a reference, but it’s in ffi/unsafe
because I’ve never seen a need outside of unsafe code. Passing k
as the second argument to ephemeron-value
fundamentally also has to work, and maybe that should be a designated pattern.
And now that you point it out, probably wrap-key
in “racket/private/custom-hash.rkt” should use that pattern. Or maybe that’s already the code that you’re looking at.
That was not the code I was looking at, as it happens, but that sounds right. :) I will use that pattern, then.