
How do you use both Create a new repository on github
and raco pkg new
? I always do a copy/paste dance but that seems suboptimal

Don’t clone the newly created repo. Follow the second instruction instead

So:
$ raco pkg new racket-paint
$ cd racket-paint
$ git init
$ git remote add origin git@github.com:Metaxal/racket-paint.git

haha, I’m impressed, nice inference :slightly_smiling_face:

thanks!

This could probably be automated into a raco pkg github-new
which can retrieve the github name from the global config I guess?

I don’t think raco pkg
itself should support GitHub specially. There are other git clients, and there are other protocols besides git.

I would love to have a third-party package that automates this process, however.

90% of the user packages on pkgs are on github though

Another thing that could be done:
- Try to request to
Metaxal/racket-paint
if it’s already created. - If so, run
git remote add origin git@github.com:Metaxal/racket-paint.git
right away - If not, open the https://github.com/new page.

That would be more helpful already

Now a racket package, so that will be the last update of this thread: https://pkgd.racket-lang.org/pkgn/package/racket-paint

raco new -i
could be extended to to this https://github.com/nixin72/from-template\|https://github.com/nixin72/from-template @sorawee @laurent.orseau

@maxbertinetti has joined the channel

Does anyone know if there has been work on formalizing this notion of, “mostly pure” functions that use side effects locally and are still referentially-transparent?

I wish all such racket visibly-pure functions could be tagged as such, and the tag propagated automatically. That would enable a number of optimisations.

@sahli.youssef has joined the channel

Are there any big obstacles to such a feature being added?

Yes, there’s work on this. You might search for “effect masking”

Concurrency may be one? Maybe the tag could be one of functional
, thread-unsafe-functional
, visibly-functional
, thread-unsafe-visibly-functional
(or not).

One challenge for that is higher order functions — what’s the tag for map

dynamic-pure
?

or conditionally-pure
?

Another issue is errors, and non local control in general

That’s a good one. If the exception is caught and the program recovers, is that non-functional?

I think if the program does not recover it could be (made to be) fine, but I’m not sure about the recovery case.

Hey everyone. I want to make some documentation for the ansi package. I couldn’t find info on how to proceed

In a clean way

Should I begin with the scribble docs?

Yes.

Ok. Thanks

I think there is a tutorial for adding Scribble documentation to a package - but now I can’t find it.

raco pkg new <somename>
creates a new package folder and populates it with scribblings and the corresponding info.rkt.


non-local control flow can be considered impure I assume, unless it’s still local to a function in which case the function can manually be tagged visibly-pure

Thank you guys. Anything else I need to know? General functions first? Or alphabetic order?

My advice: Start with a short intro that can serve as a guide/quickstart, just to let the user know what can be done easily with the package. Then list the functions thematically, possibly with sections.

Thanks you Laurent O

We should have a standard text for explaining how to install and run packages (that have a main.rkt). What do you think of this one: https://github.com/Metaxal/racket-paint\|https://github.com/Metaxal/racket-paint How would you improve it?

I’m thinking: it should be friendly, short and simple for newbies in particular

Maybe something like this should be part of raco pkg new

I’m for it.

It is a chicken and egg situation. If they have discovered raco pkg new
they often already know this.

No, i mean to make it easy also for devs and standardise the text to display to newbies

Now the answer to my question is “YES!” :slightly_smiling_face:

I just use github template repositories

click button, type package name in form, clone, done

But then you don’t get the nice stubs from raco pkg new

Oh wait, is there a template for racket projects?

I made one for single-package repos

Oh I forgot, you have to do a find-and-replace

There are several attempts at this “templating” for Racket packages.
The standard one is raco pkg new
.
The next one is https://docs.racket-lang.org/scaffold/, which is also a raco
based command. It has a real templating engine with a lot of features and extensive documentation. Unfortunately, it doesn’t seem to be popular.
@notjack has https://github.com/jackfirth/racket-package-template which is a GitHub Template based solution. One nice feature is an integration to GitHub. The disadvantage is, as Jack said, you need to find-and-replace some common strings.
This year there’s a new project https://docs.racket-lang.org/from-template/ which is what @spdegabrielle has been promoting. It’s a raco
based command. Last time I saw there are not many features, but it supports a lot of templates from the community. (fun fact: my adviser asked me to create a Rosette template for it after Stephen emailed her).

I suppose that a programming style that uses success/failure return values instead of throwing exceptions would help, but that’s not a drop-in replacement for every case that exceptions are used.

One inconvenience of using https://docs.racket-lang.org/reference/mpairs.html\|mcons is that we can’t take advantage of some functions that work with pairs (and don’t work with mpairs). For instance, assq doesn’t like mconses. If you’re implementing, say, environments as in SICP — which are lists of assoc-lists that need to mutate —, you might want to set-car! and set-cdr! to mutate them. How would you implement these in current Racket? Would you use mpairs and translate them to immutable pairs when you need to use procedures like assq?

Instead of making frames assoc-lists, I used hash tables. That worked well. I thought of just following along the book and implement environments as lists of (now) hash tables, but I don’t know how to conveniently consume an environment (a list) and conveniently replace its car with a new hash table. My best idea right now is to do it the functional way — rebuild the list with a new car and let the caller overwrite its toplevel variable with set!. (That’s for a procedure the book uses — (set-first-frame! env new-frame)
.

If you need set-car!
and set-cdr!
because you are studying SICP you have a few options: • use #lang r5rs
for the modules which require mutable lists (this is what I did) • use one of the SICP modules available • write your own massq
and other functions you need (good learning experience) If you want to implement environments because you want to write your own language, There are better option for their representation than association lists, but I am not familiar with this area and others might be able to provide more guidance here.

Thanks! I’ll write my own massq. Good idea!

My apologies @sorawee - I didn’t intend to cause extra work but wanted to identify an existing work that could be recycled.

No worries. I think it’s a good idea to have a Rosette template, but I need to think how to structure it so that it’s useful to people.

There is only one templating engine: https://docs.racket-lang.org/scaffold/\|https://docs.racket-lang.org/scaffold/ Ultimately raco pkg new
should be extended with scaffold and the GitHub (and other) templates. This will require a file in the templates to specify how they can be customised (suggested by @greg ) with (I believe) scaffold. • Templates should work unchanged. So the exposure provided by GitHub isn’t wasted. • Templates should be published to the pkg server with a special ‘template’ tag so they can be identified (and are not limited to GitHub ) The from-template package should be decommissioned at that point and the raco new
command become an alias for raco pkg new
That’s the plan.

Changing raco pkg new
in such an experimental way is inappropriate so a separate package is a good way to move forward with volunteers.

I believe a configuration language to specify scaffold changes to templates is required, but I don’t have a clear understanding how that would work or what it could do.

I would use immutable pairs with a box in the cdr probably.

In some sense at-expressions and scribble/text
are a “templating engine” — or at least a big chunk of it?

That’s not to say that the “mustaches” style used by scaffold is a bad choice, even if it might seem “less Rackety” to some people.

That’s also not to say I really know much about templating systems.