Is there a preferred way to talk to leveldb with racket?
@jbclements I think people who have already done the investment to create a bib library using autobib use that and everyone else uses bibtex
question about style - whenever I need a tail-recursive function, I define a function f with the parameters I need, and then I define a separate function called f-aux (or f-rec) with the same parameters plus the accumulators
do you guys do the same?
so I might have (f x) calling (f-aux x acc)
@capfredf so you define the tail recursive one inside the ‘main’ f, right?
yep
I can see a use for that back in the day when we didn’t have modules in scheme, but I feel like a top-level definition makes it easier to test f-aux / f-rec
but maybe it’s just me
thanks for reminding me about named lets :slightly_smiling_face:
I usually use autobib because i avoid latex like the plague, but ive found autobib and bibtex to be just as easy to use in scribble land
@raymond.machira has joined the channel
Hey team, I noticed that Dr Racket will not save my files. Sequence of actions: 1. CMD+S 2. Navigate to destination dir, change name from Untitled to stacker.rkt 3. Hit save. 4. Observe that the tab still says “Untitled” and that the file does not exist at that directory. FYI, I am on Mac OS Catalina. Is this a known issue?
@raymond.machira no, this is not a known issue. this might be related to being on Catalina, but I’m not a mac expert.
is there a log location for Dr Racket?
@raymond.machira can you run Dr.Racket from the command line and see if there are any error messages?
Here is a warning that seems relevant: 2019-10-28 11:09:20.358 DrRacket[44876:2177210] Using [NSApp runModalForWindow:] for Open/Save panels is deprecated. Please use the [NSSavePanel runModal] API directly.
Btw is the folder special in any way? (Part of Dropbox/gdrive or similarly)
No, the destination folder that I am saving to is a regular folder.
Did you get the warning from the Console app or from the terminal you ran Dr.Racket?
From the terminal.
How did you run the Dr.Racket? open -a DrRacket
or racket -l drracket
?
I just ran drracket
.
I think this issue is related: https://github.com/racket/racket/issues/2835
Cool. Glad to hear this issues has been addressed in pre-built versions.
@raymond.machira Which version?
@raymond.machira aha, this is actually a known issue. you can download a snapshot build from http://snapshot.racket-lang.org\|snapshot.racket-lang.org to work around it. see https://github.com/racket/racket/issues/2835 for more
Hi everyone. Given a contract, how can I get the original value?
Original value of what?
sorry, I mean of that contracted value
For example, racket
(module a racket
(provide (contract-out [amount positive?]))
(define amount 1))
(module b racket
(require (submod ".." a))
amount)
I want get access to the original amount
in module a
while I am in module b
@capfredf in general, you can’t
#lang racket
(module a racket
(provide (contract-out [amount positive?]))
(define amount 1))
(module b racket
(require (submod ".." a))
(displayln amount))
(require (submod "." b))
prints 1 (the original value)
@capfredf as I understand, there are two kinds of contracts.
- Flat contracts: these are simply checks that will check against values right away. Therefore, the contracted value and the actual value are the same.
#lang racket
(module a racket
(provide (contract-out [amount positive?])
(rename-out [amount amount-2]))
(define amount 1))
(module b racket
(require (submod ".." a))
(eq? amount amount-2)) ;=> #t
(require (submod "." b))
- Higher-order contracts: these are contracts that can’t be checked right away, so they attach themselves to values so that they can perform the checks later. This will affect the identity of the values but otherwise would behave like the original values.
#lang racket
(module a racket
(provide (contract-out [amount (-> number?)])
(rename-out [amount amount-2]))
(define (amount) 1))
(module b racket
(require (submod ".." a))
(eq? amount amount-2) ;=> #f
(eq? (amount) (amount-2))) ;=> #t
(require (submod "." b))
@soegaard2 @sorawee Thank you guys. I didn’t make my self clear. What I wanted was to “bypass” the contract system, so to speak. In @sorawee’s example of Higher-order contracts, how could I get access to the un-contracted amount function in module b
? But as Sam said, what I wanted shouldn’t be possible. Otherwise, everyone would go around contracts :slightly_smiling_face:
Successfully ported existing Mandelbrot compute pipeline from C++ to Racket+Vulkan :tada:
Source: https://github.com/zyrolasting/racket-vulkan/blob/master/examples/mandelbrot.rkt
Output is currently raw RGBA samples. PNG created by convert -size 3200x2400 -depth 8 mandelbrot.rgba mandelbrot.png
Credit to @Erkaman for original C++ source https://github.com/Erkaman/vulkan_minimal_compute
You can use the #:unprotected-submodule no-contract
option to add a contracts-free submodule to the original module. Then you can choose whether to use the module with or without contracts. Details here: https://docs.racket-lang.org/style/Language_and_Performance.html#%28part._.No_.Contracts%29
Your example could be: #lang racket
(module a racket
(provide
(contract-out
#:unprotected-submodule no-contract
[amount positive?]))
(define amount 1))
;; this module imports a with contracts
(module b racket
(require (submod ".." a))
amount)
;; this module imports a without contracts
(module c racket
(require (submod ".." a no-contract))
amount)
@notjack Thanks for the tip. One assumption I forgot to mention is that I can’t make changes to server sides, i.e. module a
in this case.
Yeah in that case there’s no way to get around the contracts. Bypassing a module’s safety checks requires that module’s consent.
If the server code is some open source library or something, you could ask the owner to add a no-contract
submodule.
Are place-channel
s usable as sync evt
s? I don’t see an indication in the documentation, but there is a reference in the Places paper.
Yes. (The indication is normally in an overview section of the reference, in this case the 5th paragraph of https://docs.racket-lang.org/reference/places.html)
Thanks I missed that. For some reason I was just searching the page for evt
When I probably should have searched for sync