Math::...umpers(3pm)

πŸ’– Math::Symbolic::Custom::DefaultDumpers (3pm) πŸ’–

okay bestie, so this is the manual page for Math::Symbolic::Custom::DefaultDumpers β€” it's a Perl module, it lives in section 3pm of the manual, and it's part of the User Contributed Perl Documentation. It's the home of the default output routines for Math::Symbolic trees. Let's get into it 🫢


✨ NAME ✨

Math::Symbolic::Custom::DefaultDumpers β€” the default Math::Symbolic output routines. That's the whole vibe. It dumps. It's the default. Iconic behavior, no notes πŸ’…


🌸 SYNOPSIS 🌸

use Math::Symbolic qw/parse_from_string/;
$term = parse_from_string(...);
my ($sub, $leftover_trees) = $term->to_sub();

Like… that's it. That's the whole teaser. Very "come get your output routines" energy ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

So this is a class of default output routines for Math::Symbolic trees. Class. Of. Routines. She's organized πŸ’œ

And it does not come alone β€” the roster is:

  • Math::Symbolic::Custom::DefaultTests β€” which defines the default tree testing routines
  • Math::Symbolic::Custom::DefaultMods β€” which has the default tree modification methods

If you want the full tea on how the custom method delegation model actually works, go look at the Math::Symbolic::Custom and Math::Symbolic::Custom::Base classes. They explain it way better than I can in a group chat, fr fr.


πŸŽ€ EXPORT πŸŽ€

Okay so, like, please go read the docs for Math::Symbolic::Custom::Base for the details on this one. But the headline is: do not try to use the standard Exporter semantics with this class. It's giving "not like other modules". Respect that πŸ™ˆ


πŸ‘‘ SUBROUTINES πŸ‘‘

These are the girlies. The main characters. Let's meet them πŸ₯°


🌟 to_string

So rn, to_string is currently implemented in the module core namespaces, and it will be moved to Math::Symbolic::DefaultDumpers in a future release. So it's technically crashing here before it moves out. Glow up incoming, lowkey πŸ’…

It takes one optional argument that says whether the Math::Symbolic tree should get transformed into a string using 'postfix' notation or 'infix' notation.

The default is infix, which is also the one more likely to be reparseable by the Math::Symbolic parser. So if you want your stuff to round-trip, bestie, stay in infix 🫢

🌟 to_code

This method is a wrapper around the compile_to_code class method in the Math::Symbolic::Compiler module. 🧚

It takes key/value pairs of variables and integers as argument. The integers should start at 0, and they determine the order of the variables/parameters to the compiled code. Yes, order matters. It always matters πŸ‘‘

It returns:

  • the compiled code, and
  • a reference to an array of possible leftover tree elements that could not be compiled

For the full details, please refer to the Math::Symbolic::Compiler man page. She has the receipts πŸ”₯


🌟 to_sub

This method is a wrapper around the compile_to_sub class method in the Math::Symbolic::Compiler module. Same family, different function ✨

It takes key/value pairs of variables and integers as argument. The integers should start at 0, and they determine the order of the variables/parameters to the compiled code. (Yes, same rule as above. Consistency queen.)

It returns:

  • the compiled sub, and
  • a reference to an array of possible leftover tree elements that could not be compiled

Again: please refer to the Math::Symbolic::Compiler man page for details. Go read it. I'm literally begging 😭


πŸ’Œ AUTHOR πŸ’Œ

Okay so if you've got feedback, bug reports, or support requests, please send them to the Math::Symbolic support mailing list:

math-symbolic-support at lists dot sourceforge dot net

And pls consider letting us know how you use Math::Symbolic. Genuinely. We want to know. Thank you πŸ’–

If you're interested in helping with development or extending the module's functionality, hit up the developers' mailing list instead:

math-symbolic-develop at lists dot sourceforge dot net

And now, the contributor roll call β€” absolute legends, every single one 🌈:

Steffen MοΏ½ller, symbolic-module at steffen-mueller dot net
Stray Toaster, mwk at users dot sourceforge dot net
Oliver EbenhοΏ½h

πŸ” SEE ALSO πŸ”

New versions of this module can be found on http://steffen-mueller.net or on CPAN. And the module development takes place on Sourceforge at http://sourceforge.net/projects/math-symbolic/ β€” go check it out, iykyk πŸ¦‹

The squad:

  • Math::Symbolic::Custom
  • Math::Symbolic::Custom::DefaultMods
  • Math::Symbolic::Custom::DefaultTests
  • Math::Symbolic

and that's the page, bestie πŸ’œ tysm for reading the whole thing, you ate. this was perl v5.40.0, dated 2024-09-16 β€” and yeah, the title is Math::...umpers(3pm), it's foreshortened, we don't talk about it 😭

mwah πŸŽ€ bye!!

πŸ“¦ where this page comes from