p.kushwaha97
2020-1-23 12:36:51

What’s a definition context? Why is begin not a definition context?


soegaard2
2020-1-23 12:37:51

A body contains a series of definitions-or-expressions followed by an expression. For example . (lambda () (define a 42) (+ a 1))


soegaard2
2020-1-23 12:39:14

The begin form does not create a new scope, so if your begin is in an expression position, it can not contain definitions.


p.kushwaha97
2020-1-23 12:40:07

I see, thanks.


soegaard2
2020-1-23 12:41:49

The begin is handled specially by the expander. So if your begin is in a definition context, then the begin form can contain definitions. (lambda () (begin (define a 42)) (+ a 1))


soegaard2
2020-1-23 12:42:12

The expander will simple rewrite this to: (lambda () (define a 42) (+ a 1))


soegaard2
2020-1-23 12:42:23

This is known as “splicing”.


p.kushwaha97
2020-1-23 12:50:57

My begin was in a expression context (if statement), that’s why I got the error. Anyways, I moved up my definition to the nearest definition context without problems.


sorawee
2020-1-23 12:53:02

FWIW, you can create an internal-definition context by (let () put-stuff-here)


sorawee
2020-1-23 12:54:29

For Rhombus (the next generation of Racket), I have been proposing that the current behavior of begin is harmful and it should be renamed to something else: https://github.com/racket/rhombus-brainstorming/issues/87


soegaard2
2020-1-23 12:56:27

Did you check the discussion on begin on the rrrs-authors mailing list?


sorawee
2020-1-23 12:56:41

Nope


sorawee
2020-1-23 12:56:50

Can you point me to it?


sorawee
2020-1-23 12:56:58

I was not aware that there’s a discussion


soegaard2
2020-1-23 12:57:24

I recall reading about sequence vs begin . It’s in the archive. Somewhere …


soegaard2
2020-1-23 13:01:16


sorawee
2020-1-23 13:07:30

Oh well, it’s started as an April Fools’ joke


soegaard2
2020-1-23 13:07:46

What?


soegaard2
2020-1-23 13:08:48

I totally missed that :slightly_smiling_face:


samth
2020-1-23 15:10:56

there’s also block which is more like what you want begin to be


notjack
2020-1-23 18:42:26

begin is usually what you want when writing macros, block is usually what you want everywhere else


samdphillips
2020-1-23 20:08:58

It’s not happy about rash.


samdphillips
2020-1-23 20:10:06

Same error on rebellion


samdphillips
2020-1-23 20:10:35

Checking that my bespoke Dockerfile is setting up Racket the same as @notjack ’s


samdphillips
2020-1-23 20:13:17

Yeah it’s setting up the same catalogs


shawsumma060
2020-1-23 20:15:59

@soegaard2 thank you earlier for hinting me about basic blocks. it has improved made it nearly twice as fast in tight loops, and no less than 50% in other places!


notjack
2020-1-23 20:29:24

Huh, maybe the dockerfiles don’t set up that catalog. Haven’t looked at them in a while.


notjack
2020-1-23 20:29:38


p.kushwaha97
2020-1-23 20:48:55

Is there a graph library (A graph with vertices and edges, not charts) that works with typed racket?


p.kushwaha97
2020-1-23 20:50:43

If not a library, then some reference implementation so I could avoid re-implementing common things?


jaz
2020-1-23 20:57:00

I imagine you could use require/typed with Stephen Chang’s graph library. (In fact, the ~typed racket~ gradual typing benchmarks do that, I think…)


p.kushwaha97
2020-1-23 21:01:35

Do you happen to have a link to these benchmarks? I could take the type definitions from there instead of reworking them



p.kushwaha97
2020-1-23 21:03:54

Thanks, this looks promising!


samdphillips
2020-1-23 21:43:06

yep it’s using that one


zalp.rogue
2020-1-24 00:14:04

There is also the shared library which comes with racket to build graphs with normal racket data structures, which can then be typed. https://docs.racket-lang.org/reference/shared.html?q=shared#%28form._%28%28lib._racket%2Fshared..rkt%29._shared%29%29


notjack
2020-1-24 00:18:10

Is there a way to say what order the catalogs should be tried in? The console output you gave made it seem like the regular catalog was tried first and the built-package catalog wasn’t tried at all


notjack
2020-1-24 00:19:36

I’m guessing raco pkg doesn’t know how to fallback to another catalog if one has the package, but not in precompiled form


samdphillips
2020-1-24 03:12:30

That’s an idea. I’ll try that.