Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

data::util::curry(3pm) [debian man page]

Data::Util::Curry(3pm)					User Contributed Perl Documentation				    Data::Util::Curry(3pm)

NAME
Data::Util::Curry - Curries functions and methods SYNOPSIS
use feature 'say'; use Data::Util qw(curry); sub sum{ my $total = 0; for my $x(@_){ $total += $x; } return $total; } # placeholder "" indicates a subscript of the arguments say curry(&add, , 42)->(10); # 52 # placeholder "*_" indicates all the arguments say curry(&add, *_)->(1 .. 10); # 55 # two subscripts and the rest of the arguments say curry(&add, *_, 1, )->(1 .. 5); # 3 + 4 + 5 + 1 + 2 DESCRIPTION
(todo) EXAMPLES
Currying Functions curry(&f, , 2)->(1); # f(1, 2) curry(&f, 3, )->(4); # f(3, 4) curry(&f, *_)->(5, 6); # f(5, 6) curry(&f, , 1, *_)->(1, 2, 3, 4); # f(1, 2, 3, 4) curry(&f, *_, , 1)->(1, 2, 3, 4); # f(3, 4, 1, 2) Currying Methods curry($obj, 'something', *_)->(1, 2); # $obj->something(1, 2) curry($obj, 'something', foo => , bar => 1)->(1, 2); # $obj->something(foo => 1, bar => 2) curry(, 'something', 1)->($obj, 42); # $obj->something(42) curry($obj, , *_)->('something', 1, 2); # $obj->something(1, 2) Argument Semantics sub incr{ $_[0]++ } my $i = 0; curry(&incr, )->($i); # $i++ curry(&incr, *_)->($i); # $i++ curry(&incr, $i)->(); # $i++ SEE ALSO
Data::Util. perl v5.14.2 2011-10-20 Data::Util::Curry(3pm)

Check Out this Related Man Page

Moose::Autobox::Code(3) 				User Contributed Perl Documentation				   Moose::Autobox::Code(3)

NAME
Moose::Autobox::Code - the Code role SYNOPOSIS
use Moose::Autobox; my $adder = sub { $_[0] + $_[1] }; my $add_2 = $adder->curry(2); $add_2->(2); # returns 4 # create a recursive subroutine # using the Y combinator *factorial = sub { my $f = shift; sub { my $n = shift; return 1 if $n < 2; return $n * $f->($n - 1); } }->y; factorial(10) # returns 3628800 DESCRIPTION
This is a role to describe operations on the Code type. METHODS
curry (@values) rcurry (@values) conjoin (&sub) disjoin (&sub) compose (@subs) This will take a list of @subs and compose them all into a single subroutine where the output of one sub will be the input of another. y This implements the Y combinator. u This implements the U combinator. meta SEE ALSO
<http://en.wikipedia.org/wiki/Fixed_point_combinator> <http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/20469> BUGS
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT. AUTHOR
Stevan Little <stevan@iinteractive.com> COPYRIGHT AND LICENSE
Copyright 2006-2008 by Infinity Interactive, Inc. <http://www.iinteractive.com> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2013-10-27 Moose::Autobox::Code(3)
Man Page

5 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

awk command not woking

code ************ obj=test export obj file_str=`awk '{ print substr( $obj, 0, 17 ) }'` export file_str ************ This is not working... Thanks (3 Replies)
Discussion started by: w020637
3 Replies

2. Shell Programming and Scripting

How to add the contents of a file?

Hi I have a file named Data cat Data 1797548295 2420652689 513068908 1426750759 3229436285 2710691077 i want to sum all these lines, can we use any direct command for that in unix. Thanks in advance.:b: (7 Replies)
Discussion started by: Prateek007
7 Replies

3. Programming

Linking Linux Driver written in C with ASM module

Hi, I have got sample linux driver written in C. I got also some assembly code, compiled into .o file (using as compiler). In my Makefile I got: obj-m += someDriver.o someDriver-objs := CFile1.o CFile2.o ASMFile.o default: $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modulesUnfortunatelly I cannot... (0 Replies)
Discussion started by: Chrisdot
0 Replies

4. SCO

Printer is winning the battle! (for now)

All, Q: how would I add some escape codes to an interface that i have setup t print.? Goal: to switch from NLQ to Util modes. back and forth. Scenerio: SCO OS 5.05 PRINTER: OKI Data 320 or similar. printer is called "test" What I have done thus far. (just cannot get their) I can from a... (6 Replies)
Discussion started by: TheSniper
6 Replies

5. Solaris

SunONE (webserver7) obj.conf

Hello all, I'm configuring the webserver and I need to add some parameters to be logged, so I don't know if I'm doing it right, please advice. Here's my obj.conf: # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # You can edit this... (0 Replies)
Discussion started by: TorvusBog
0 Replies