Indeed (re: Re^2: Extending a perl program with Scheme, Lua, or JS)! That's exactly how I got my degree, got out of a lengthy prison sentence and keep adding extra money to my bank account every month. All via a script.

Seriously now, you may believe that defining a function (in X language) to take in data structures (plain arrays which can soon become Perl's objects or hashes) and then, I guess, modify these data structures back in the main Perl program is trivial. And all these for the sake of avoiding a shift. But you may be happier if you reconsider. For example shift can also be written as $_[0] or using the power of OO:

my ($teacher_obj, $student_obj, $new_grades) = @_; $student_obj->teacher_modify_grades($new_grades, $teacher_obj);

The argument for keeping within Perl can only be strengthen by looking at modules like dc, bc which are not shelling out to bc but implement its operation in Perl or C. And of course, you can create any calculator to suit your needs using Marpa by following MarpaX::ESLIF::Tutorial::Calculator.

In any event, I would keep the calculator for calculating. And provide an API for the higher-level operations. But that's me.


In reply to Re: Extending a perl program with Scheme, Lua, or JS by bliako
in thread Extending a perl program with Scheme, Lua, or JS by bcrowell2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.