Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

moose::autobox::code(3pm) [debian man page]

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

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 <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.14.2 2012-03-20 Moose::Autobox::Code(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 <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.16.2 2012-08-29 Moose::Autobox::Code(3)
Man Page

14 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Desperately Need Help On This Perl script

ok, i dont know any perl. actually, very very little. not much at all. now, the task i have is that i have to go into a directory that is packed with hundreds of files that contains lots of strings of which i have to filter through. so when i get into this directory, i type: grep -r akamai... (19 Replies)
Discussion started by: Terrible
19 Replies

2. Shell Programming and Scripting

Help Help Help in recursion

Hello every body. I am trying to find the factorial using the following code. But it is giving the syntax error. I tried very much but in vain. Thanks in advance for helping me factorial() { if then y=`expr $1 - 1` x=$(( $1 \* factorial $y ))... (6 Replies)
Discussion started by: murtaza
6 Replies

3. Shell Programming and Scripting

Code help with search script perl

Hello, I have a script, but its sorta broke and I need help to tweak it #!/usr/bin/perl my @files_to_search = ("exportOBJ-sark.txt","ResourceRecText-ALL.txt","exportdnsrr-report.txt"); open (FL, "sark.com.txt"); my %search_hash = (); while (my $line = <FL>) { my @parts =... (12 Replies)
Discussion started by: richsark
12 Replies

4. Shell Programming and Scripting

best way for removing comment from ruby program

Hi all, I would want to remove all comments from my ruby/rails program. It may seem like a simple task, but it is not so. Because you need to have your tool implemented as like your language parser which is actually not so easy. And am in the search of it, to remove comment from ruby/rails.... (4 Replies)
Discussion started by: thegeek
4 Replies

5. Shell Programming and Scripting

Error with Expression

Hi All, am trying to add two Inputs i.e., $1 and $2, Code #!/bin/sh $num_sum=`expr $1+$2` echo "Sum = $num_sum" am giving statement sh arithemetic.sh 20 10 am getting error arithemetic.sh: line 2: =20+10: command not found Sum = I want Output as Sum = 30, (5 Replies)
Discussion started by: sunnix
5 Replies

6. Shell Programming and Scripting

What is Ruby?

Lately there have been a lot of one-liners posted in "ruby" on the apparent assumption that mainstream unix or Linux come with "ruby. They don't. What is "ruby"? What platforms and Operating System versions are supported? The syntax for "ruby" seems remarkably obscure compared with say "awk"... (13 Replies)
Discussion started by: methyl
13 Replies

7. Shell Programming and Scripting

By using AWK can I convert matrice shaped data to a row ?

Hello, I have output in the matrice form , for example: 1 2 3 4 a b c d jim joe sue tom how can I convert this line-column data into a row as follows 1 2 3 4 a b c d jim joe sue tom thank you (14 Replies)
Discussion started by: rpf
14 Replies

8. UNIX for Dummies Questions & Answers

put script into file

hi, ok having here some code like: #!/bin/bash echo " hello " # say hello to the user echo " $HOME " echo " $HOSTNAME " echo " $(uname) " echo " today is $(date) " echo " $(whoami) is currently logged in " now my question is how to change the code so that the info is not... (12 Replies)
Discussion started by: me.
12 Replies

9. UNIX for Dummies Questions & Answers

Code to list the files of find command

hi, i want to list the files from the below find commands output. find ./* -name "*.txt" -type f -mtime +10 will give the output like ./a.txt but i need the output in the format like (ls -lrt a.txt ) -rw-rw-rw- 1 srea nast 5 May 23 07:34 a.txt i used xargs for the... (4 Replies)
Discussion started by: msathees
4 Replies

10. Shell Programming and Scripting

Pipe command to script

Hello to all, Having a ruby script that works when an argument is given in command line in this way: ruby script.rb input_to_ruby To accept arguments as input, inside the ruby script has File.open(ARGV) input_to_ruby is generated by another command, so I need to create first input_to_ruby... (6 Replies)
Discussion started by: Ophiuchus
6 Replies

11. Shell Programming and Scripting

[Perl] split on : but with extra challenge

Hi, I am looking for a little bit more advanced split. Code: #!/usr/bin/perl -w #-d use strict; my $Line = "value1:{value2a:value2b}:value3:{}:value5:{value6a:value6b}"; my @LineAttributes = split (/:/, $Line); my $TotalLineAttributes = scalar @LineAttributes; print "Line:... (4 Replies)
Discussion started by: ejdv
4 Replies

12. Red Hat

How to know full width blade or half width blade?

HI, How do we figure out if the server is half blade server or full blade server? Anything we need to look at to know on this? thanks in advance (9 Replies)
Discussion started by: snchaudhari2
9 Replies

13. What is on Your Mind?

New UserCP Landing Page (version 0.48)

There is a know bug deep in the Javascript library d3.js which causes an intermediate charting rendering bug in Vue.js. In a nutshell, when a page is reloaded the chart data is not rendered sometimes, but when the Vue.js route changes (a menu item in the UserCP is selected), it works flawlessly.... (3 Replies)
Discussion started by: Neo
3 Replies

14. UNIX for Beginners Questions & Answers

Multiply values from a file

Hi All, I extracted a file using an awk command like this awk '{print substr($0,78,5)"," substr($0,59,6) "," substr($0,81,3) "," substr($0,11,7)}' file1 >> OUTPUT cat OUTPUT 00001,100000,005,0000080 00001,100000,008,0000220 00001,100000,001,0001000 00010,100000,001,0000400 I want... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies