develooper Front page | perl.perl6.language | Postings from March 2005

The S29 Functions Project

Thread Next
Rod Adams
March 12, 2005 23:15
The S29 Functions Project
Message ID:
Barring objections, I'm going to attempt to compile a S29.

Plan of attack:

I'm using a recent copy of Perl 5's perlfunc as a very rough template. 
At some point, I'll drudge through the A's and S's to look for functions 
new to Perl 6. I'll try not to make up too many new ones on my own, but 
I'll mark them as such.

When I've written up a given function from what I believe it will be, 
I'll post the relevant section of pod to the list for comments/approval.

I will not be attempting to rewrite perlfunc. The target audience will 
be someone familiar with Perl 5 and the other synopses. I will be 
listing sub/method signatures, including variants found in the standard 
type classes.

One thing I've already done is make a list of Perl 5 functions I cannot 
address until some future Apocalypse/Synopsis is generated on the topic. 
By far the bulk of this list falls on S16. Partly because IPC is a mess, 
and partly because I lumped all I/O in there.

The list of "pending" functions, by group, is:

=over 8

=item A/S14: Tied Variables

tie tied untie

=item A/S16: IPC / IO / Signals

-X accept alarm bind binmode chown close closedir connect eof fcntl
fileno flock getc getpeername
/[get|set][host|net|proto|serv|sock].*/ glob ioctl kill link listen
lstat mkdir /msg.*/ open opendir pipe print printf read readdir readline
readlink readpipe recv rename rewinddir rmdir seek seekdir select(both)
/sem.*/ send setsockopt /shm.*/ shutdown socket socketpair stat symlink
syscall sysopen sysread sysseek syswrite tell telldir truncate umask
unlink utime

=item A/S??: OS Interaction

chroot exec getlogin /[get|set][pw|gr].*/ setpgrp setpriority system

=item A/S17: Threads

fork lock wait waitpid


And now for a few simple functions to get things started:

=item multi sub abs (?Num) returns Num

=item multi method Num::abs () returns Num

Absolute Value. $_ if omited.

=item multi sub atan2 (Num, Num) returns Num

Arctangent of Y/X (radians)

=item multi sub cos (?Num) returns Num

=item multi method Num::cos () returns Num

Cosine (radians).  $_ if omited.

=item multi sub exp (?Num) returns Num

=item multi method Num::exp() returns Num

Exponent or inverse natural log. $_ if omited.

-- Rod Adams

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About