user-pic

echowuhao

Subscribe to feed Recent Actions from echowuhao

  • yanick.champoux commented on Watch the secret YAPC::NA live

    I understand the frustration, and I agree that the communication channels have been sub-optimal. No arguing there.

    However, I think we should also take a long, deep breath, and try to veer the discussion toward what can we do to improve the situation. For most (if not all) of the organizers, YAPC is a labor of love. And labor is the right word there -- it's a long, arduous, exhausting, unglorious process that end in a big final week-long push. Personally, I have no doubt that everybody involved honestly did gave their all. But life, and things, and then more life, happened. And as Ki…

  • Ron Savage commented on Book Report - December 2014

    I'd say it's contrived to discuss objects before constructors. It sounds like you feel constructors need to be discussed in detail before object are mentioned, but perhaps you can introduce them (ctors) briefly, i. e. just enough to provide context for the discussion of objects, before returning to them.

  • https://www.google.com/accounts/o8/id?id=AItOawmEFmsULh5l4dO4ek5K2NQ-8wcJG99nGOA commented on Book Report - December 2014

    Sid Burn:

    You didn't really need any module at all to explain classes. I would say, someone only has really understand object-orientation if he knew how to code OO in an imperative or functional style. And that is the most important thing. OO is not about shiny syntax and having "class, method, new" keywords and so on, it is about the idea of encapsulating data/state.

    For example an imperative way of describing a "Person-Class". At first you think about a datastructure which data/state it should hold. Well something simple, a person just have a name and an age field. And you …

  • J commented on The clearest way(s) to check if a List contains...

    I was just thinking on this the other day. To answer your Hash question: Like another commenter said hash lookup time is constant. It's can be a better choice when you want to search the array multiple times.

    When I was thinking about this I did some benchmarks. Hopefully I've done them right. I tested arrays of 100 elements searching for an integer that was in the middle of the array. I've pasted the results below.

    The way I interpret it is that you'd need to do at least 7 lookups for a hash lookup to be a better choice than grep, and around 25 lookups before it outperforms…

  • J commented on The clearest way(s) to check if a List contains...

    I forgot to mention that the reason why the lookup is slower on a single search in the first place is that I'm converting the array to a hash before doing the search. I'm using the "%hash = map { $_ => 1 } @array;" pattern you often see.

Subscribe to feed Responses to Comments from echowuhao

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.