question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Transformer: unpacking children

See original GitHub issue

Hello,

First, thanks for making Lark, I just discovered it, and I already like it a lot !

My suggestion would be this:

Adding a transform_unpack alternative to Transformer.transform which passes children in unpacked form:

For instance, in my transformer, a rule of the form

def int(s,x):
    a,b, name, init = x
    ... do something with it

would become

def int(s, a,b, name, init):

which matches more closely the intuitive view of each node as a constructor in a pattern-matching.

Of course in variadic cases, you could still write

def int(s, a,b, name, init, *other_args):

I have only taken a cursory look, but this seems trivial to implement by adding an option to _call_userfunc and calling f(children) or f(*children) depending on whether it is passed. (_call_userfunc could also be duplicated if performance from the added “if” is a concern)

Would this be something you’re interested in implementing or, if I submit a PR to that effect, that you would be willing to integrate?

Cheers

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
erezshcommented, Dec 6, 2022

Sphinx is already set up, and iirc most of the docs are in markdown, so you don’t need to worry about it too much.

1reaction
vincent-hugotcommented, Dec 6, 2022

Once I have a bit more experience as a user — and have read the existing documentation — I definitely will.

It will force me to get into Sphinx as well, which I’ve avoided for a while…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Transformer Unboxing + Giveaway!! | Fun Videos for Children
Thanks Hasbro for sending us this package of the Transformers. ... Transformer Unboxing + Giveaway!! | Fun Videos for Children.
Read more >
Optimus Prime Bumblebee Megatron Dinobot Grimlock Toy ...
New Transformers toys unboxing video featuring Transformers Autobot ... this awesome YouTube kid friendly toy video from Kevs Toy Fun.
Read more >
Kid unboxing a transformer - YouTube
Kid unboxing a transformer. 14 views 3 years ago. Louie Jr. Louie Jr. 5 subscribers. Subscribe ... Show more. Show less. Try YouTube...
Read more >
Transformers Combiner Wars Unpacking Decepticon Vortex ...
Dima unpacks transformer Combiner Wars from Hasbro Decepticon Vortex. Transformer is part of a large ... Try YouTube Kids. Learn more ...
Read more >
Transformers Toys BotBots Surprise Unboxing: Claw Machine
BotBots figures change from ordinary objects to little Transformers robots in 3 to 5 easy steps. Great toys for kids 5 and up!...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found