Thanks for writing this book and making it available under the Creative Commons License.
939 karma · joined April 5, 2010
Thanks for writing this book and making it available under the Creative Commons License.
* <> reads from file(s) specified as command-line arguments (data.json in this case)
* Option -0777 tells Perl to slurp the whole file
* Option -MJSON loads the JSON module perl -0777 -MJSON -le '
print for "name,creditcard\n",
map {"$_->{name},$_->{creditcard}\n"}
grep {$_->{creditcard}}
@{JSON->new->decode(<>)}
' data.json > 20150425.csvNot true.
$ touch 1 2 3 4.c 5.c 6.c 7 8
$ ls
1 2 3 4.c 5.c 6.c 7 8
$ perl -E '
@globvals = glob("*");
say "globvals = @globvals";
$glob1 = glob("*");
$glob2 = glob("*.c");
say "glob1 = $glob1\nglob2 = $glob2"
'
globvals = 1 2 3 4.c 5.c 6.c 7 8
glob1 = 1
glob2 = 4.c
As you can see, the third call to glob returns the expected value.Here's how glob is documented in the perlfunc document[1].
glob In list context, returns a (possibly empty) list of filename
expansions on the value of EXPR such as the standard Unix shell
/bin/csh would do. In scalar context, glob iterates through such
filename expansions, returning undef when the list is exhausted.
[1]: http://perldoc.perl.org/functions/glob.html [1]: http://modernperlbooks.com/books/modern_perl_2014/01-perl-philosophy.html#Q29udGV4dA
[2]: This very accessible, and free, book (updated very recently for 2014) is a must-read for any Perl developer.While searching for these, I found what appears to be a pretty comprehensive list of books on Indian space program here: http://forum.nasaspaceflight.com/index.php?topic=33814.0
[1]: https://metacpan.org/pod/List::Util#values-shuffle-values [2]: http://www.perlmonks.org/?node_id=1869
It's all in C#.
True. However, the question is, does it need to be stated explicitly every time someone gets criticized, or asked to be held accountable for something.
> You can't just hold someone to an arbitrary standard just because you don't like them.
I don't think that was happening here. Modi wasn't being held to an "arbitrary standard" because he wasn't "liked". His actions were the point of discussion here.
Andy Lester, the primary author of ack, is one of the nicest guys I know of. You wouldn't see any trash-talking on that site. He even changed the name of the site from "better than grep" to "beyond grep" [1].
In fact, he gives props to similar tools like ag and others [2].
[1] https://news.ycombinator.com/item?id=5578304 [2] http://beyondgrep.com/more-tools/
For example, if you want to print the id and name of each user from a file in the /etc/passwd format:
-- display all users: ids and names from /etc/passwd
import Data.List.Split (splitOn)
eachLine :: (String -> String) -> (String -> String)
eachLine f = unlines . map f . lines
showUser :: String -> String
showUser line = fields !! 0 ++ "\t" ++ fields !! 4
where fields = splitOn ":" line
main = interact (eachLine showUser)
This can be run, like (assuming the program is saved in list-users.hs): $ runhaskell list-users.hs < /etc/passwd
I am very new to Haskell, and I am sure there are other, perhaps better ways to do this. var firstVar = "one";
var secondVar = "two";
var thirdVar = "three";
var thisVarHasAReallyLongName = "four";
var thisIsAnotherVarWithALongerName = "five";I don't think it's misleading at all.
If electricity and electric cars were available and commonplace in Fred Flintstone's era, and he designed a car that used no electricity, then he could and should be credited for designing a car that "ran without electricity".
Now, if someone said this machine ran without energy, that would me not only misleading, but a lie.
> At this stage of mankind's industrialization, it's disingenuous to look at a human powered machine as an improvement over an electricity powered one.
That's a legitimate point, and one that is worth discussing about.
You don't mean that the GP (taliesinb) is confused, do you?. He works for Wolfram Research, developing Mathematica.
This is the direct link to the pdf file: https://github.com/sarabander/sicp-pdf/raw/master/sicp.pdf
The original Perl implementation is Data::Faker (https://metacpan.org/pod/Data::Faker). The earliest version available on CPAN appears to be from 2005.
Sigh. Sadly, it has become fashionable to bring up Perl only to ridicule it even when there is absolutely no context or need.
Take a look at this implementation [1] of doubly linked list in Perl. Tell me how that is worse [2].
Now, I will go back to my corner to being productive using Perl or whatever language I need.
[1] https://metacpan.org/source/LEONT/List-DoubleLinked-0.003/li...
[2] Of course, I have no way of knowing if it is an exact or even close translation of your code, but it does implement doubly linked lists.
Are you referring to the book authored by Richard Courant (http://www.amazon.com/dp/0195105192)?
http://googleblog.blogspot.com/2013/10/a-long-way-home-with-...
He wrote a book about his experience: "A Long Way Home" (http://www.penguin.com.au/products/9780670077045/long-way-ho...)
Are you saying that corruption exists only among this limited group of individuals?