[racket-users] Resyntax: an automated refactoring tool for Racket

2021-01-24 Thread jackh...@gmail.com
Hello everyone! Just wanted to announce a neat project I've been working 
on: Resyntax , a tool for 
refactoring racket code. Currently the tool is able to replace various uses 
of `let` forms with `define`, as can be seen in this pull request 
.

The tool works by hooking in to the racket macro expander and applying 
*refactoring 
rules* to the code as it's being expanded, where a refactoring rule is a 
syntax-parse macro that says how to rewrite some code pattern. You can see 
all of the refactoring rules I've implemented so far in the 
resyntax/refactoring-rule 
 
module.

Resyntax is in the early stages. It works well enough when run manually on 
single files, and it has some nice features already:

   - Output is correctly indented
   - Rules are hygienic, so Resyntax's rules for replacing `let` with 
   `define` won't run on code where `let` is bound to something other than the 
   `let` from `racket/base`.
   - If a rule leaves a subform untouched, the formatting of that form is 
   left completely unchanged by the tool.

But it's got some issues that need to be worked out:

   - No public API for running it.
   - No documentation on how to create your own refactoring rules.
   - Deletes comments sometimes.
   - Doesn't enforce that code produced by a refactoring rule actually 
   compiles.
   - Current rules are not all that robust yet and may sometimes produce 
   buggy or badly formatted code.
   
If you're interested in following along with Resyntax's development, see 
the github repository . If you've 
got some suggestions for rules, follow the guidance in this github issue 
 to tell me all about your 
ideas. And, as usual, I can be reached by email and in the racket Slack and 
Discord servers.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/93f92eb3-00ad-4b59-818a-7848e984f7ecn%40googlegroups.com.


Re: [racket-users] Moving a Rust/Haskell abstract algebra library to Racket?

2021-01-24 Thread Stuart Hungerford
On Mon, Jan 25, 2021 at 6:52 AM Jens Axel Søgaard 
wrote:

That's a very interesting project. You are so to speak optimizing for
> readability.
> I immediately get a vision of a SICM-like book, but for algebra instead of
> classical mechanics.
>
> Racket will be a good choice, since macros give you the possibility
> of experimenting with suitable, easily understood syntax.
>
> A tricky choice is to be made: how are the concepts going to be
> represented
> as Racket values. Normal structs does not allow multiple inheritance.
>
> Looking at a diagram such as the one below, raises the question whether
> the
> relationship between the various concepts are to be modelled explicitly or
> implicitly.
>
> [image: image.png]
>
> Maybe some kind of interface for each concept is needed?
>

Thanks for pointing those relationships out -- in the earlier Rust and
Haskell libraries I used a trait or typeclass for each concept/structure. I
decided to make the interfaces simpler but more repetitive by having (for
example) separate traits/typeclasses for Additive, Multiplicative and
"abstract" groups. That allowed (for example) the real numbers to form
groups under both addition and multiplication.

I'm hoping I can do something similar with Racket generic interfaces, as
the other people in this thread have kindly pointed out to me in their
packages and examples.


> Link to SICM in case you haven't seen it already.
>
>
> https://mitpress.mit.edu/books/structure-and-interpretation-classical-mechanics
>
> Note that the authors of SICM wrote a CAS in Scheme that is used in the
> book.
>

One of the benefits of reading through this (with a non-physics background)
is the chance to re-examine the use of notation in mathematics and how it
can transfer to a computing environment.

Thanks,

Stu

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAG%2BkMrEZpC2WCCKfa8pL5Jvw-rLRyCs7-053S84N1rJAyBKUGA%40mail.gmail.com.


Re: [racket-users] Moving a Rust/Haskell abstract algebra library to Racket?

2021-01-24 Thread Jens Axel Søgaard
Den tor. 21. jan. 2021 kl. 05.06 skrev Stuart Hungerford <
stuart.hungerf...@gmail.com>:

> On Thursday, 21 January 2021 at 10:22:45 UTC+11 Jens Axel Søgaard wrote:
>


> > Back to your project - what is the goal of the project?
> > Making something like GAP perhaps?
> > Do you want your users to supply types - or do you want to go a more
> dynamic route?
>
> My project is really aimed at supporting self-directed learning of
> concepts from abstract algebra.
>
I was taught many years ago that to really understand something to try
> implementing it in a high level language.
>
That will soon expose any hidden assumptions or misunderstandings.
>

That's a very interesting project. You are so to speak optimizing for
readability.
I immediately get a vision of a SICM-like book, but for algebra instead of
classical mechanics.

Racket will be a good choice, since macros give you the possibility
of experimenting with suitable, easily understood syntax.

A tricky choice is to be made: how are the concepts going to be represented
as Racket values. Normal structs does not allow multiple inheritance.

Looking at a diagram such as the one below, raises the question whether the
relationship between the various concepts are to be modelled explicitly or
implicitly.

[image: image.png]

Maybe some kind of interface for each concept is needed?

/Jens Axel

Link to SICM in case you haven't seen it already.

https://mitpress.mit.edu/books/structure-and-interpretation-classical-mechanics

Note that the authors of SICM wrote a CAS in Scheme that is used in the
book.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABefVgzzBkGYb7qPziPGoOGpDZ9QbpO%3DJVyDRrV_DLx5JJFA-w%40mail.gmail.com.


[racket-users] Racket compiler and runtime status report

2021-01-24 Thread Matthew Flatt
In anticipation of the v8.0 release with Racket CS as the default,
here's this year's update on Racket's compiler and runtime system:

 https://blog.racket-lang.org/2021/01/racket-status.html


Matthew

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20210124102520.300%40sirmail.smtps.cs.utah.edu.