Quickscript of the day: Extract to function

44 views
Skip to first unread message

Laurent

unread,
May 7, 2020, 5:33:41 AM5/7/20
to racket-users@googlegroups.com List
Have you ever wanted to extract a block of code out of its context and wrap it in a function?

Have you ever *not* done it because of the cognitive load(*) of figuring out the function arguments and the return values?

Well, now it's as easy as Ctrl-Shift-X and Ctrl-Shift-Y. Using check-syntax, the extract-function and put-function scripts figure out what goes in and out for you.

`raco pkg install quickscript-extra` to install, or 
`raco pkg update quickscript-extra` if it's already installed.

(*) a.k.a. laziness ;) 

Dexter Lagan

unread,
May 7, 2020, 6:20:48 AM5/7/20
to Laurent, racket-users@googlegroups.com List
Nice!! Yay for laziness.

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CABNTSaHpOYQM2X3TW%3DHYGP7_CTA8jCaj4Euh0mcjnus1aOdt-g%40mail.gmail.com.

Andre Garzia

unread,
May 7, 2020, 7:03:24 AM5/7/20
to racket-users@googlegroups.com List
that is really cool! thanks for sharing!

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CABNTSaHpOYQM2X3TW%3DHYGP7_CTA8jCaj4Euh0mcjnus1aOdt-g%40mail.gmail.com.


--

Stephen De Gabrielle

unread,
May 7, 2020, 7:52:38 AM5/7/20
to Laurent, racket-users@googlegroups.com List
Awesome - keep them coming.

You should feature one in each Racket-News! 

Stephen

On Thu, 7 May 2020 at 10:33, Laurent <laurent...@gmail.com> wrote:
--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CABNTSaHpOYQM2X3TW%3DHYGP7_CTA8jCaj4Euh0mcjnus1aOdt-g%40mail.gmail.com.
--
----

Laurent

unread,
May 10, 2020, 2:46:05 AM5/10/20
to racket-users@googlegroups.com List
Major update:
- put-function is much faster, by triggering check-syntax as early as possible and avoiding its re-computation.
- More warnings and error reporting (in particular regarding mutated variables).
- Added more information at the top of the script file, in particular some caveats.

Please report bugs here:

If you have already installed this: 
raco pkg update quickscript-extra
and if DrRacket is open, click on "Scripts | Manage scripts | Unload persistent scripts" to restart the script.
Reply all
Reply to author
Forward
0 new messages