Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: (ar0n) Re: Storing Info

by jepri (Parson)
on Jan 21, 2002 at 11:24 UTC ( #140337=note: print w/ replies, xml ) Need Help??


in reply to (ar0n) Re: Storing Info
in thread Storing Info

I thought the general consensus was that we would help people if they had a try at it. He posted code that works, and asked for a better way to do it. I don't see what's so bad about teaching him to do it better (as opposed to at all). map and grep aren't immediately intuitive unless you are already seeped in lisp.

Why not just tell him to put the conditional into a grep statement and it will spit out the right hashes? It hardly takes more effort than blowing him off. As an added bonus, less people will think that you are a grumpy loser monk.

____________________
Jeremy
I didn't believe in evil until I dated it.


Comment on Re: (ar0n) Re: Storing Info
(ar0n) Re (3): Storing Info
by ar0n (Priest) on Jan 21, 2002 at 11:58 UTC
    He posted code that works,

    Err, actually, he didn't. See dvergin's post.

    I don't see what's so bad about teaching him to do it better (as opposed to at all). map and grep aren't immediately intuitive unless you are already seeped in lisp.

    That's why I told him to take a look at map and grep (implying, "Read the documentation"). I am not 'seeped in Lisp'. In fact, I have just started learning some Common Lisp, yet I've been using map and grep in Perl for quite some time now. I assume he's intelligent enough to understand the definition of grep:

        grep - locate elements in a list test true against a given criterion
      
    And, using that definition, construct something like
    my @matches = grep { ... } keys %friends
    as he is apparently already able to retrieve hash keys.

    Why not just tell him to put the conditional into a grep statement and it will spit out the right hashes?

    Because he can deduce that from reading the documentation on grep. One of Perl's great resources is its extensive documentation. Learning to read the documentation is a good thing, in my opinion.

    As an added bonus, less people will think that you are a grumpy loser.

    So I'm a grumpy loser now?

    [ ar0n -- want job (boston) ]

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://140337]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2014-10-01 23:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (40 votes), past polls