guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Megacut - a clojure-like lambda shorthand


From: Amirouche Boubekki
Subject: Re: Megacut - a clojure-like lambda shorthand
Date: Tue, 26 Mar 2019 21:32:02 +0100

Thanks for sharing!

Le mar. 26 mars 2019 à 21:28, Linus Björnstam <address@hidden>
a écrit :

> Hello everybody!
>
> I have written a bunch of small libraries to scratch some itches, and I
> thought now might be a good time to actually release them here.
>
> Megacut is the first of a few. It is a lambda shorthand, like cut, but
> with different semantics and more features:
>
> (megacut (apply + (/ %1 %2) %&))
>
> (lambda (%1 %2 . %&) (apply + (/ %1 %2) %&))
>
> Using guile's read-hash-extend #%(+ %1 %2) gets expanded to (megacut (+ %1
> %2)).
>
> The workings are simple: positional arguments are %n (where n is a
> positive integer) and rest arguments are %&. It adds as many positional
> arguments as n is big so #%(display %2) becomes (lambda (%1 %2) (display
> %2)).
>
> The symbol % is a shorthand for %1, so #%(+ % %) is the same as #%(+ %1
> %1).
>
> It can be found here: https://bitbucket.org/bjoli/megacut
>
> Play with it if you want. It is licensed under a BSD-styled license. My
> linux box died recently, so I haven't been able to package it for guix.
>
> Best regards
> Linus Björnstam
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]