stefan.kruger
2019-10-28 10:17:55

Is there a preferred way to talk to leveldb with racket?


samth
2019-10-28 13:08:38

@jbclements I think people who have already done the investment to create a bib library using autobib use that and everyone else uses bibtex


cmscalzo
2019-10-28 13:35:57

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


cmscalzo
2019-10-28 13:36:02

do you guys do the same?


cmscalzo
2019-10-28 13:36:35

so I might have (f x) calling (f-aux x acc)


capfredf
2019-10-28 13:39:24

I also use letrec or named let


cmscalzo
2019-10-28 13:40:51

@capfredf so you define the tail recursive one inside the ‘main’ f, right?


capfredf
2019-10-28 13:41:15

yep


cmscalzo
2019-10-28 13:41:40

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


cmscalzo
2019-10-28 13:41:52

but maybe it’s just me


cmscalzo
2019-10-28 13:43:02

thanks for reminding me about named lets :slightly_smiling_face:


florence
2019-10-28 14:08:59

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
2019-10-28 14:54:52

@raymond.machira has joined the channel


raymond.machira
2019-10-28 14:57:17

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?


samth
2019-10-28 14:58:15

@raymond.machira no, this is not a known issue. this might be related to being on Catalina, but I’m not a mac expert.


raymond.machira
2019-10-28 15:03:08

is there a log location for Dr Racket?


capfredf
2019-10-28 15:08:37

@raymond.machira can you run Dr.Racket from the command line and see if there are any error messages?


raymond.machira
2019-10-28 15:10:35

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.


soegaard2
2019-10-28 15:12:32

Btw is the folder special in any way? (Part of Dropbox/gdrive or similarly)


raymond.machira
2019-10-28 15:14:47

No, the destination folder that I am saving to is a regular folder.


capfredf
2019-10-28 15:17:45

Did you get the warning from the Console app or from the terminal you ran Dr.Racket?


raymond.machira
2019-10-28 15:17:59

From the terminal.


capfredf
2019-10-28 15:19:46

How did you run the Dr.Racket? open -a DrRacket or racket -l drracket?


raymond.machira
2019-10-28 15:20:08

I just ran drracket.


raymond.machira
2019-10-28 15:25:30

I think this issue is related: https://github.com/racket/racket/issues/2835


capfredf
2019-10-28 15:29:30

Cool. Glad to hear this issues has been addressed in pre-built versions.


soegaard2
2019-10-28 15:41:41

@raymond.machira Which version?


samth
2019-10-28 15:43:25

@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


capfredf
2019-10-28 18:46:52

Hi everyone. Given a contract, how can I get the original value?


soegaard2
2019-10-28 18:48:31

Original value of what?


capfredf
2019-10-28 18:49:41

sorry, I mean of that contracted value


capfredf
2019-10-28 18:51:18

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


samth
2019-10-28 18:53:49

@capfredf in general, you can’t


soegaard2
2019-10-28 18:55:59
#lang racket

(module a racket
  (provide (contract-out [amount positive?]))

  (define amount 1))

(module b racket
  (require (submod ".." a))
  (displayln amount))

(require (submod "." b))

soegaard2
2019-10-28 18:56:11

prints 1 (the original value)


sorawee
2019-10-28 20:45:21

@capfredf as I understand, there are two kinds of contracts.

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

capfredf
2019-10-28 21:25:20

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


deactivateduser60718
2019-10-28 21:40:55

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


deactivateduser60718
2019-10-28 21:42:28

Credit to @Erkaman for original C++ source https://github.com/Erkaman/vulkan_minimal_compute


notjack
2019-10-28 23:09:08

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


notjack
2019-10-28 23:12:03

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)


capfredf
2019-10-28 23:39:13

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


notjack
2019-10-28 23:39:58

Yeah in that case there’s no way to get around the contracts. Bypassing a module’s safety checks requires that module’s consent.


notjack
2019-10-28 23:40:42

If the server code is some open source library or something, you could ask the owner to add a no-contract submodule.


samdphillips
2019-10-29 02:19:06

Are place-channels usable as sync evts? I don’t see an indication in the documentation, but there is a reference in the Places paper.


mflatt
2019-10-29 02:58:06

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)


samdphillips
2019-10-29 03:50:02

Thanks I missed that. For some reason I was just searching the page for evt


samdphillips
2019-10-29 03:50:20

When I probably should have searched for sync