laurent.orseau
2020-10-25 08:57:10

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


sorawee
2020-10-25 09:01:15

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


sorawee
2020-10-25 09:02:49

So:

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


laurent.orseau
2020-10-25 09:03:37

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


laurent.orseau
2020-10-25 09:03:40

thanks!


laurent.orseau
2020-10-25 09:05:35

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


sorawee
2020-10-25 09:07:48

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


sorawee
2020-10-25 09:09:15

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


laurent.orseau
2020-10-25 09:10:17

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


sorawee
2020-10-25 09:10:22

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.

laurent.orseau
2020-10-25 09:11:13

That would be more helpful already


laurent.orseau
2020-10-25 09:18:51

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


spdegabrielle
2020-10-25 10:13:07

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
2020-10-25 10:20:21

@maxbertinetti has joined the channel


kellysmith12.21
2020-10-25 10:46:34

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?


laurent.orseau
2020-10-25 11:37:19

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
2020-10-25 12:52:24

@sahli.youssef has joined the channel


kellysmith12.21
2020-10-25 13:19:28

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


samth
2020-10-25 13:26:26

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


laurent.orseau
2020-10-25 13:26:28

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


samth
2020-10-25 13:27:23

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


laurent.orseau
2020-10-25 13:27:47

dynamic-pure?


laurent.orseau
2020-10-25 13:27:58

or conditionally-pure?


samth
2020-10-25 13:28:34

Another issue is errors, and non local control in general


laurent.orseau
2020-10-25 13:32:29

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


laurent.orseau
2020-10-25 13:33:01

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


sahli.youssef
2020-10-25 13:45:36

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


sahli.youssef
2020-10-25 13:45:50

In a clean way


sahli.youssef
2020-10-25 13:46:36

Should I begin with the scribble docs?


soegaard2
2020-10-25 13:46:47

Yes.


sahli.youssef
2020-10-25 13:47:55

Ok. Thanks


soegaard2
2020-10-25 13:48:29

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


laurent.orseau
2020-10-25 13:49:46

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



laurent.orseau
2020-10-25 13:55:59

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


sahli.youssef
2020-10-25 14:30:07

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


laurent.orseau
2020-10-25 14:31:29

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.


sahli.youssef
2020-10-25 14:48:29

Thanks you Laurent O


laurent.orseau
2020-10-25 15:28:04

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?


laurent.orseau
2020-10-25 15:28:59

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


laurent.orseau
2020-10-25 15:42:42

Maybe something like this should be part of raco pkg new


sahli.youssef
2020-10-25 16:35:42

I’m for it.


spdegabrielle
2020-10-25 17:03:37

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


laurent.orseau
2020-10-25 17:24:13

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


samdphillips
2020-10-25 17:51:24

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


notjack
2020-10-25 19:14:08

I just use github template repositories


notjack
2020-10-25 19:14:16

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


laurent.orseau
2020-10-25 19:24:24

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


laurent.orseau
2020-10-25 19:36:34

Oh wait, is there a template for racket projects?


notjack
2020-10-25 20:50:40

I made one for single-package repos


notjack
2020-10-25 20:50:48

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


sorawee
2020-10-25 21:41:03

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


kellysmith12.21
2020-10-25 23:24:01

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.


anything
2020-10-26 01:18:36

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?


anything
2020-10-26 01:21:59

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


alexharsanyi
2020-10-26 01:36:10

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.


anything
2020-10-26 01:43:02

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


spdegabrielle
2020-10-26 02:08:44

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


sorawee
2020-10-26 02:15:44

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.


spdegabrielle
2020-10-26 02:27:37

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.


spdegabrielle
2020-10-26 02:32:42

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


spdegabrielle
2020-10-26 02:39:52

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.


samdphillips
2020-10-26 03:51:19

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


greg
2020-10-26 03:52:42

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


greg
2020-10-26 03:52:52

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.


greg
2020-10-26 03:53:19

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