Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Calculate prime factors for a given numer in a perl one-liner

by chrestomanci (Priest)
on Dec 15, 2010 at 18:44 UTC ( [id://877347]=note: print w/replies, xml ) Need Help??


in reply to Re: Calculate prime factors for a given number in a perl one-liner
in thread Calculate prime factors for a given numer in a perl one-liner

I don't think you should have provided an answer, especially one without an explanation. Remember this is a homework problem. We are supposed to be helping the supplicant to reach a solution by giving hints, and insightful analysis of the problem.

For example kennethk pointed out that that there is no need to store prime factors if they will be printed out.

By giving an answer, you did not help the supplicant, you where just showing off.

Replies are listed 'Best First'.
Re^3: OT: Calculate prime factors for a given numer in a perl one-liner
by ww (Archbishop) on Dec 15, 2010 at 19:49 UTC
    chrestomanci:

    You've written some very good nodes in the brief time (since Nov of this year; 40-some days)... and your view (above) finds support in the Monastery's guidance (so NO - - ), but, in this case

    you're teaching your grandfather how to suck eggs!

    Bishop moritz earned his exalted station, too, and has been here enough longer than you to know the local mores.

    So why have I troubled myself to reply?

    Because moritz' golfed solution, if submitted by a student to satisfy a homework assignment, would reveal itself immediately as work copied from somewhere, not arrived at independently. (In fact, IMO, sometimes in the wake of a particularly lazy question, such a reply is offered in hopes that that lazy one will plagarize and be caught.)

    More often, I suspect, such an answer is offered because it can provide a learning opportunity to the diligent student, even if it does no more than inspire that student to de-obfuscate the expert's code.

    Update: mis-spelling corrected

Re^3: Calculate prime factors for a given numer in a perl one-liner
by moritz (Cardinal) on Dec 15, 2010 at 21:13 UTC

    I respect your opinion, but I kindly disagree.

    If the OP wanted to learn something from that solution, a quick google search would have supplied insight to actually understand the solution, and to gain something from it.

    I don't see any harm in posting a solution that follows a very different approach to the initial proposal.

Re^3: Calculate prime factors for a given numer in a perl one-liner
by JavaFan (Canon) on Dec 15, 2010 at 22:53 UTC
    Remember this is a homework problem. We are supposed to be helping the supplicant to reach a solution by giving hints, and insightful analysis of the problem.
    If you want it to be a home-work problem, and to give insightful analysis, you shouldn't ask for a one-liner, and you shouldn't consider Abigail's (infamous) regexp as an answer. It's obscure, inefficient, uses an unreasonable amount of memory, and quite quickly hits limits.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2024-03-28 10:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found