Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Some older languages had/have a clear separation - syntactic and semantic - between subroutine and function!

Perl doesn't, but explains the terminology for people coming from there.

perlfunc describes builtin "functions" in CORE::

Most can be replicated with with pure Perl when using prototypes , so those "flat list arguments" don't apply in these cases.

Other built-ins can't be replicated because they require special parsing of their arguments.

The " mathematical function" part is misleading, because Perl's subs can have side-effects, like altering passed or global or closure variables.

Compare that to languages like Haskell which do their best to be side-effect free like mathematical functions.

Operators in perlop are indeed built-in functions with special syntax, context and precedence. You can replicate $a+$b*$c with add( $a, mul( $b, $c ) ) and in some docs you'll find function like built-ins called "operators"

The goal you seem to have is to define Perl in Lisp'ish way, where everything can be derived from a small set of axioms.

I doubt that's possible, because the creators cared more about DWIM than orthogonality.

Perl has loads of influences from C, bash, sed, awk and Lisp and tried to combine them in an "organic" way to make people coming from those ends feal like at home.

Those features were not implemented in a clean canonical mini Perl ...

EDIT

... and there is no language definition like ECMA.

The best possible outcome you can achieve is probably a language definition for 98% of Perl combined with a long list of exceptions.

One simple example: built-ins like map and grep can be replicated with

sub name(&;@) { my ($code, @list) = @_; ... } # then called name {BLOCK} LIST;

BUT having a return inside the BLOCK will lead to a very different result, hence gone the orthogonality.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery


In reply to Re: My problems to understand the Perl documentation by LanX
in thread My problems to understand the Perl documentation by bojinlund

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-04-19 06:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found