wwall
2020-3-2 08:35:04

hello. I have question - exists simple way for compile scheme into JS (f.e. as clojurescript)


sorawee
2020-3-2 08:46:19

sorawee
2020-3-2 08:46:58

There’s also an older whalesong: https://github.com/soegaard/whalesong



sorawee
2020-3-2 08:49:58

I was gonna say, do raco pkg install --binary-lib sql, but it still doesn’t work


sorawee
2020-3-2 08:59:59

Ah, it needs to be raco pkg install --catalog <https://pkg-build.racket-lang.org/server/built/catalog/> --binary-lib sql


sorawee
2020-3-2 09:23:15

So, I managed to get this working, as detailed in my answer to the StackOverflow post. However, it’s not perfect. I need to separately raco pkg install rackunit-lib db-lib because if I don’t, I will get an error like:

package-catalog-lookup: error from server URL: <https://pkg-build.racket-lang.org/server/built/catalog/pkg/db-lib?version=7.6> status code: 403 And it is the case that https://pkg-build.racket-lang.org/server/built/catalog/pkg/db-lib?version=7.6 is an invalid link, while https://pkg-build.racket-lang.org/server/built/catalog/pkg/sql?version=7.6 is not. Does anyone know what’s going on?


sorawee
2020-3-2 09:25:45

And it’s been like this for 7.5, too


soegaard2
2020-3-2 09:49:08

@wwall @sorawee I can’t recommend using Whalesong anymore. It only runs on very old versions of DrRacket and it hasn’t been updated for years.

The simplest to use project in the Racket world is racketscript.

An alternative is Urlang which isn’t full Racket, but rather JS+Scheme-like-features.

An example of a Space Invaders game in Urlang. https://github.com/soegaard/urlang/blob/master/urlang-examples/space-invaders/space-invaders.rkt#L102


wwall
2020-3-2 10:21:31

Thanks


mflatt
2020-3-2 13:17:27

Packages in the v7.6 main distribution are in the catalog https://download.racket-lang.org/releases/7.6/catalog/ in built form, and the pkg-build server doesn’t currently try to build them or recatalog them.


sorawee
2020-3-2 14:03:53

Hmm. Is it considered a bug then? It makes installation of packages in minimal Racket really difficult.


mflatt
2020-3-2 14:32:32

The original intent is that you’d use both catalogs: the distribution one first, and then the pkg-build one.


sorawee
2020-3-2 14:39:02

That doesn’t sound ergonomic. It means I need to read info.rkt to see what are dependencies (and potentially need to find transitive dependencies), and find which ones are in the main distribution.


mflatt
2020-3-2 14:54:06

Then go fix it.


hazemalhalabi
2020-3-2 18:07:05

I’m so glad this is being done!


hazemalhalabi
2020-3-2 18:14:48

Hi! What’s the cleanest way to overload a struct constructor? I’m using Typed Racket and I want to make an explicitly dependent function type for a struct constructor but I’m not sure what the best approach is for this case


soegaard2
2020-3-2 18:16:08

An idea (but I am no Typed Racket expert): Use a submodule to define your struct and your alternative constructor. Then use rename-out to export your custom constructor instead of the default one.


hazemalhalabi
2020-3-2 18:26:08

That’s the approach I’m considering at the moment but I was wondering if there is a more ergonomic approach. I only want to make the auto-generated constructor dependently typed without modifying its implementation.

I’ll need to do this for a whole bunch of structs so that’s why I’m wondering if there is a better approach


stefan
2020-3-2 18:29:25

@stefan has joined the channel


notjack
2020-3-2 19:15:45

@sorawee If you add the built catalog to the list of catalogs that raco pkg uses by default, then it might check both. If you use --catalog it will ignore all of the default catalogs and only use the one you specified, which won’t work if some packages are in that catalog and some aren’t. See the Dockerfiles of my racket images for details on how to set up the right configuration https://github.com/jackfirth/racket-docker\|https://github.com/jackfirth/racket-docker


notjack
2020-3-2 19:16:23

(also if you try this, let me know how it goes and if anything went wrong or didn’t work)


capfredf
2020-3-2 20:02:57

I just took another look at the document. The type declaration seems legit.


capfredf
2020-3-2 20:03:59

I think what you need in your code is to call vector? before calling vector-ref


capfredf
2020-3-2 20:05:18

like (define v (if (vector? vs) (vector-ref vs i) &lt;some-default vector&gt;)


soegaard2
2020-3-2 20:09:27

Thanks for the tip. I’ll keep it in mind. Inserting an explicit check often helps. For my code experiment I decided to use matrix-&gt;vector* instead. It might be faster to use than the general array-&gt;vector*. I am not sure though.


capfredf
2020-3-2 20:09:48

I don’t think there is a built-in way. I would write a simple macro to do the job.


sorawee
2020-3-3 01:12:34

Nice, that works perfectly! I guess the improvement here could be allowing multiple --catalog flags? I tried that and it doesn’t work, so I thought only one catalog is supported at a time.


andrew.giessel
2020-3-3 01:17:09

@andrew.giessel has joined the channel


andrew.giessel
2020-3-3 01:18:02

Hello everyone, I’m currently working through Beautiful Racket. I’ve hit an error that I can’t figure out involving the use of #:unless. The code in question is here: https://beautifulracket.com/funstacker/the-rewrite.html#a_y4buf


d_run
2020-3-3 01:18:45

:wave: howdy! Problem with cmdline https://docs.racket-lang.org/reference/Command-Line_Parsing.html?q=cmdline#%28def._%28%28lib._racket%2Fcmdline..rkt%29._parse-command-line%29%29

The spec says that #:usage-help can take a string or an expression that evals to a string:

help-spec = string \| (string-expr ...+) But when I try to slap in a variable containing a string I get an error:

(define help-text (~a "The following commands are available: " command-dirs)) ... (command-line #:program "retriever" #:usage-help help-text ... command-line: #:usage-help clause contains non-string at: help-text


andrew.giessel
2020-3-3 01:19:06

The error is #%datum: keyword misused as an expression, which suggests that its not defined.


andrew.giessel
2020-3-3 01:22:33

ah, it’s a paren error. sorry about that!


sorawee
2020-3-3 01:24:48

@d_run the parens are “literal”. Try changing #:usage-help help-text to #:usage-help (help-text)?


d_run
2020-3-3 01:25:33

no :game_die:

command-line: #:usage-help clause contains non-string at: (help-text)


sorawee
2020-3-3 01:25:54

Oh wait


sorawee
2020-3-3 01:26:15

According to the grammar, the thing after #:usage-help is not help-spec


sorawee
2020-3-3 01:26:26

#:usage-help string ...


d_run
2020-3-3 01:26:32

gah


d_run
2020-3-3 01:26:56

def need to able to slot generated content in there


sorawee
2020-3-3 01:26:58

I think you can hack this by using parse-command-line


sorawee
2020-3-3 01:27:20

and does quasiquote/unquote voodoo to make it work


d_run
2020-3-3 01:27:26

aight


d_run
2020-3-3 01:42:42

okay yup that worked, switching to parse-command-line - thanks! I avoided that at first because the syntax is very hard to follow


ben
2020-3-3 03:20:00

@mflatt any idea how make site PKGS="typed-racket" SRC_CATALOG=../my-cat2 could fail because build/installers does not exist? Full log attached. EDIT this is on a fresh clone. my-cat2 is from a raco pkg catalog-copy --from-config using a Racket 7.5 I think


mflatt
2020-3-3 03:39:46

I think you’ll have to supply a CONFIG argument to provide a configuration file that specifies clients. Otherwise, a default “build/site.rkt” is created with no clients specified — which doesn’t seem very useful, and maybe it should try to build a default configuration that specifies an installer via localhost.


ben
2020-3-3 04:04:04

Ok I’ll try that.

I don’t remember needing to give a config when I got a pkg-build running last December


mflatt
2020-3-3 04:11:00

Maybe you edited at the default “build/site.rkt” location, instead?


notjack
2020-3-3 05:51:43

I think that would be a great improvement