unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* New macro `seq-let' in seq.el
@ 2015-05-01 17:37 Nicolas Petton
  2015-05-05 16:25 ` Bozhidar Batsov
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Petton @ 2015-05-01 17:37 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 354 bytes --]

Hi,

I just pushed a new macro for seq.el named `seq-let' in the branch
seq-let.

This macro is similar to `cl-destructuring-bind' but provides
destructuring for all sequence types supported by seq.el.

I find this macro quite useful, but I'd like to have some feedback about
it.

Cheers,
Nico
-- 
Nicolas Petton
http://nicolas-petton.fr

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: New macro `seq-let' in seq.el
  2015-05-01 17:37 New macro `seq-let' in seq.el Nicolas Petton
@ 2015-05-05 16:25 ` Bozhidar Batsov
  2015-05-05 18:36   ` Nicolas Petton
  0 siblings, 1 reply; 7+ messages in thread
From: Bozhidar Batsov @ 2015-05-05 16:25 UTC (permalink / raw)
  To: Nicolas Petton; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 473 bytes --]

You've got +1 from me. Great feature!

On 1 May 2015 at 20:37, Nicolas Petton <nicolas@petton.fr> wrote:

> Hi,
>
> I just pushed a new macro for seq.el named `seq-let' in the branch
> seq-let.
>
> This macro is similar to `cl-destructuring-bind' but provides
> destructuring for all sequence types supported by seq.el.
>
> I find this macro quite useful, but I'd like to have some feedback about
> it.
>
> Cheers,
> Nico
> --
> Nicolas Petton
> http://nicolas-petton.fr
>

[-- Attachment #2: Type: text/html, Size: 943 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: New macro `seq-let' in seq.el
  2015-05-05 16:25 ` Bozhidar Batsov
@ 2015-05-05 18:36   ` Nicolas Petton
  2015-05-05 19:56     ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Petton @ 2015-05-05 18:36 UTC (permalink / raw)
  To: Bozhidar Batsov; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 555 bytes --]


Bozhidar Batsov writes:

> You've got +1 from me. Great feature!

I think I'll merge the branch into master and add a TODO to add a pcase
pattern that `seq-let' could wrap instead.

I could also spend some time on it now, but the internals of pcase are
still obscure to me and it will take me some time to grasp it.

PS: `pcase--u1' is pretty long (almost 200 loc), is there any reason not
to refactor it?  As it is now I will have a very hard time understanding
what is does exactly.

Nico
-- 
Nicolas Petton
http://nicolas-petton.fr

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: New macro `seq-let' in seq.el
  2015-05-05 18:36   ` Nicolas Petton
@ 2015-05-05 19:56     ` Stefan Monnier
  2015-05-05 20:15       ` Nicolas Petton
  2015-05-06  3:46       ` Nicolas Petton
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Monnier @ 2015-05-05 19:56 UTC (permalink / raw)
  To: Nicolas Petton; +Cc: Bozhidar Batsov, emacs-devel

> PS: `pcase--u1' is pretty long (almost 200 loc), is there any reason not
> to refactor it?  As it is now I will have a very hard time understanding
> what is does exactly.

You shouldn't need to know how pcase--u1 works.

You just need to write a pcase-macro which turns (seq ...) patterns into
other (more primitive) pcase patterns.  E.g. it could turn (seq a b)
into a pattern like (and (pred seq-p) (app (elt 0) a) (app (elt 1) b)).


        Stefan



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: New macro `seq-let' in seq.el
  2015-05-05 19:56     ` Stefan Monnier
@ 2015-05-05 20:15       ` Nicolas Petton
  2015-05-06  3:08         ` Stefan Monnier
  2015-05-06  3:46       ` Nicolas Petton
  1 sibling, 1 reply; 7+ messages in thread
From: Nicolas Petton @ 2015-05-05 20:15 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Nicolas Petton, Bozhidar Batsov, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 487 bytes --]


Stefan Monnier writes:

>> PS: `pcase--u1' is pretty long (almost 200 loc), is there any reason not
>> to refactor it?  As it is now I will have a very hard time understanding
>> what is does exactly.
>
> You shouldn't need to know how pcase--u1 works.

I'm not saying that I have to know how it works, only that I find it
hard to understand, and I was wondering if there was a reason for the
function to be so long.


Nico
-- 
Nicolas Petton
http://nicolas-petton.fr

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: New macro `seq-let' in seq.el
  2015-05-05 20:15       ` Nicolas Petton
@ 2015-05-06  3:08         ` Stefan Monnier
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2015-05-06  3:08 UTC (permalink / raw)
  To: Nicolas Petton; +Cc: Bozhidar Batsov, emacs-devel

> and I was wondering if there was a reason for the function to be
> so long.

It just grew.


        Stefan



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: New macro `seq-let' in seq.el
  2015-05-05 19:56     ` Stefan Monnier
  2015-05-05 20:15       ` Nicolas Petton
@ 2015-05-06  3:46       ` Nicolas Petton
  1 sibling, 0 replies; 7+ messages in thread
From: Nicolas Petton @ 2015-05-06  3:46 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Nicolas Petton, Bozhidar Batsov, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 357 bytes --]


Stefan Monnier writes:

> You just need to write a pcase-macro which turns (seq ...) patterns into
> other (more primitive) pcase patterns.  E.g. it could turn (seq a b)
> into a pattern like (and (pred seq-p) (app (elt 0) a) (app (elt 1)
> b)).

Thank you, I'll try to add this soon enough.

Nico
-- 
Nicolas Petton
http://nicolas-petton.fr

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-05-06  3:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-01 17:37 New macro `seq-let' in seq.el Nicolas Petton
2015-05-05 16:25 ` Bozhidar Batsov
2015-05-05 18:36   ` Nicolas Petton
2015-05-05 19:56     ` Stefan Monnier
2015-05-05 20:15       ` Nicolas Petton
2015-05-06  3:08         ` Stefan Monnier
2015-05-06  3:46       ` Nicolas Petton

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).