Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 976 Categories, Downloaded 29.544.972 Times

Unicode::Overload 0.01

  Date Added: April 09, 2010  |  Visits: 721


Report Broken Link
Printer Friendly Version

Product Homepage
Download (75 downloads)

Unicode::Overload is a Perl source filter to implement Unicode operations. SYNOPSIS use charnames :full; use Unicode::Overload ( "N{UNION}" => infix => sub { my %a = map{$_=>1}@{$_[0]}; my %b = map{$_=>1}@{$_[1]}; return keys(%a,$b); }, "N{SUPERSCRIPT TWO}" => postfix => sub { $_[0] ** 2 }, "N{NOT SIGN}" => prefix => sub { !$_[0] }, [ "N{LEFT FLOOR}", "N{RIGHT FLOOR}" ] => outfix => sub { POSIX::floor($_[0]) }, ); @union = (@a N{UNION @b); # Parentheses REQUIRED die "Pythagoras was WRONG!" # Same here unless sqrt((3)N{SUPERSCRIPT TWO} + (4)N{SUPERSCRIPT TWO}) == 5; $b = N{NOT SIGN}($b); # Required here too die "Fell through floor" # Balanced characters form their own parentheses unless N{LEFT FLOOR}-3.2N{RIGHT FLOOR} == 4; Allows you to declare your own Unicode operators and have them behave as prefix (like sigma or integral), postfix (like superscripted 2), infix (like union), or outfix (like the floor operator, with the L-like and J-like brackets). To keep this document friendly to people without UTF-8 terminals, the N{} syntax for Unicode characters will be used throughout, but please note that the N{} characters can be replaced with the actual UTF-8 characters anywhere. Also, please note that since Perl 5 doesnt support the notion of arbitrary operators, this module cheats and uses source filters to do its job. As such, all "operators" must have their arguments enclosed in parentheses. This limitation will be lifted when a better way to do this is found. Also, note that since these arent "real" operators there is no way (at the moment) to specify precedence. All Unicode "operators" have the precedence (such as it is) of function calls, as they all get transformed into function calls inline before interpreting. In addition, due to a weird unicode-related bug, only one character per operator is currently permitted. Despite behaving correctly elsewhere, substr() thinks that one character equals one byte inside Unicode::Overload . Anyway, this module defines four basic types of operators. Prefix and infix should be familiar to most users of perl, as prefix operators are basically function calls without the parens. Infix operators are of course the familiar + etcetera. The best analogy for postfix operators is probably the algebraic notation for squares. $a**2 is perls notation, ($a)N{SUPERSCRIPT TWO} is the Unicode::Overload equivalent, looking much closer to a mathematical expression, with the 2 in its proper position. Outfix is the last operator, and a little odd. Outfix can best be thought of as user-definable brackets. One of the more common uses for this notation again comes from mathematics in the guise of the floor operator. Looking like brackets with the top bar missing, they return effectively POSIX::floor() of their contents. Since outfix operators define their own brackets, extra parentheses are not needed on this type of operator. A quick summary follows: prefix Operator goes directly before the parentheses containing its operands. Whitespace is allowed between the operator and opening parenthesis. This acts like a function call. Sample: N{NOT SIGN}($b) postfix Operator goes directly after the parentheses containing its operands. Whitespace is allowed between the closing parenthesis and operator. This doesnt have a good Perl equivalent, but there are many equivalents in algebra, probably the most common being: Sample: ($a+$b)N{SUPERSCRIPT TWO} infix Operator goes somewhere inside the parentheses. Whitespace is allowed between either parenthesis and the operator. Sample: ($a N{ELEMENT OF} @list) outfix Operators surround their arguments and are translated into parentheses. As such, whitespace is allowed anywhere inside the operator pairs. There is no requirement that the operators be visually symmetrical, although it helps. Sampe: $c=N{LEFT FLOOR}$a_+$bN{RIGHT FLOOR} The requirements for parentheses will be removed as soon as I can figure out how to make these operators behave closer to perl builtins. Nesting is perfectly legal, but multiple infix operators cant coexists within one set of parentheses..

Requirements: No special requirements
Platforms: Linux
Keyword: Floor Left Floor Libraries Operator Operators Parentheses Perl Right Source Filter Superscript Superscript Two Two Unicodeoverload
Users rating: 0/10

License: Freeware Size: 5.12 KB
More Reviews or Write Review

Libraries  -  Filter::decrypt 1.33
Filter::decrypt Perl module contains a template for a decrypt source filter. SYNOPSIS use Filter::decrypt ; This is a sample decrypting source filter. Although this is a fully functional source filter and it does implement a very simple...
40.96 KB  
Libraries  -  perlfilter 5.8.8
perlfilter package contains Perl source filters. This article is about a little-known feature of Perl called source filters. Source filters alter the program text of a module before Perl sees it, much as a C preprocessor alters the source text...
12.2 MB  
Libraries  -  HTTPD::Log::Filter 1.08
HTTPD::Log::Filter is a Perl module to filter entries out of an httpd log. SYNOPSIS my $hlf = HTTPD::Log::Filter->new( exclusions_file => $exclusions_file, agent_re => .*Mozilla.*, format => ELF, ); while( ) { my $ret =...
10.24 KB  
Libraries  -  Template::Alloy::Operator 1.006
Template::Alloy::Operator is a Perl module that provides the regexes necessary for Template::Alloy::Parse to parse operators and place them in their appropriate precedence. It also provides the play_operator method which is used by...
143.36 KB  
Libraries  -  XML::Filter::Mode 0.02
XML::Filter::Mode Perl module can filter out all chunks not in the current mode. SYNOPSIS use XML::Filter::Mode; use strict; my $filter = XML::Filter::Mode->new( Modes => "a,b,c" ); my $filter = XML::Filter::Mode->new( Modes => [qw( a b c...
4.1 KB  
Libraries  -  Algorithm::DiffOld 1.15
Algorithm::DiffOld is a Perl module to compute `intelligent differences between two files / lists but use the old (<=0.59) interface. NOTE This has been provided as part of the Algorithm::Diff package by Ned Konz. This particular module is...
23.55 KB  
Libraries  -  Algorithm::Diff 1.1902
Algorithm::Diff is a Perl module to compute `intelligent differences between two files / lists. SYNOPSIS require Algorithm::Diff; # This example produces traditional diff output: my $diff = Algorithm::Diff->new( @seq1, @seq2 );...
33.79 KB  
Entertainment  -  Cute Puppy of the Day
Imagine this. You come home from work, open the door, and your brand new puppy comes bounding up to you, big puppy paws sliding all over the floor and little puppy tail wagging frantically. Adorable, right? What if you could experience this...
8 MB  
Productivity  -  Status Tile
Get battery status (percentage and time left), date and operator name, all in a single tile. You can choose between small, medium and wide tile. Also get battery status and operator name on the lock screen. Features: *...
2 MB  
Casino Games  -  Duomatic 1
Duomatic is 14 in 1 multigame Game list: black horse dracula draw poker calligula casino chukcha man crazy hounter fruct twist monkey boy piratos super fairy land 5 super garage tarakanos whisky Some games not available in "play for fun" version...
32.02 MB  
Programming  -  FLEX-db Digital Asset Manager 3.0.9
FLEX-db - an enterprise Digital Asset Manager (DAM). It ingests and links metadata with files, creates thumbnails, and processes files using business rules. FLEX-db has a JSP client, Java app server for file input and output and an EJB metadata...
21.57 MB  
Programming  -  Libicom 0.9.0
The libicom library is a character based dynamicly linked library for Linux. It is used to remotely control the Icom IC-R8500 wide band receiver via an RS232 link. All call and return parameters to the control functions are character string based....
20.48 KB  
Programming  -  dotdesktop 0.3
Dotdesktop library provides ability to parse desktop entry file and access the information in a convenient way. Desktop entry file format is defined by, it is used to describe information about an application such as the name and...
327.68 KB  
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  libyasl 0.2
Libyasl is a C++ class library to easily realize TCP/UDP/Multicast clientsand servers in IPv4 and IPv6 environments under GNU/Linux systems.
143.36 KB  
Libraries  -  EuGTK 4.8.9
Makes it easy to develop good- looking, fast, cross-platform programs that run on Linux, OS X, and Windows. Euphoria is a very fast interpreted/compiled language with straight-forward syntax. EuGTK allows programming in a clean, object-oriented...
10.68 MB  
Libraries  -  Linux User Group Library Manager 1.0
The LUG Library Manager is a project to help Linux User Groups start their own library. A LUG library is helpful to the community at large because it increases access to information, and gives everyone the opportunity to become more knowledgeable.
5.35 KB  
Libraries  -  Module::MakefilePL::Parse 0.12
Module::MakefilePL::Parse is a Perl module to parse required modules from Makefile.PL. SYNOPSIS use Module::MakefilePL::Parse; open $fh, Makefile.PL; $parser = Module::MakefilePL::Parse->new( join("", ) ); $info = $parser->required;...
8.19 KB  
Libraries  -  sqlpp 0.06
sqlpp Perl package is a SQL preprocessor. sqlpp is a conventional cpp-alike preprocessor taught to understand SQL ( PgSQL, in particular) syntax specificities. In addition to the standard #define/#ifdef/#else/#endif cohort, provides also...
10.24 KB  
Libraries  -  App::SimpleScan::Substitution::Line 2.02
App::SimpleScan::Substitution::Line is a line with optional fixed variable values. SYNOPSIS my $line = App::SimpleScan::Substitution::Line->new(" this "); # Use only this value when substituting " ". $line->fix(substituite =>...
54.27 KB