Perl 6 - the future is here, just unevenly distributed

IRC log for #rosettacode, 2013-05-09

| Channels | #rosettacode index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:42 ttmrichter_ joined #rosettacode
00:47 ttmrichter joined #rosettacode
00:47 ttmrichter_ joined #rosettacode
00:54 mwn3d joined #rosettacode
01:35 ttmrichter joined #rosettacode
02:01 ttmrichter joined #rosettacode
02:40 kpreid joined #rosettacode
03:16 Util joined #rosettacode
04:29 eMBee on our recent discussion on measuring the popularity of languages, this article is interesting: http://www.dataists.com/2010/12/ranking-​the-popularity-of-programming-langauges/
04:29 fedaykin "dataists >> Ranking the popularity of programming languages" http://rldn.net/A7s
04:31 eMBee especially the notes at the end: "StackOverflow measure actually picking up the opaqueness of languages rather than the size of their community?" ...
04:32 ttmrichter eMBee: That's my interpretation both of book sales and of places like StackOverflow.
04:32 ttmrichter You see a billion books on Java because Java is so opaque when you want to do anything even slightly flexible and useful that you need help.  :D
04:36 kpreid pfft, it's popularity
04:36 kpreid if there's something opaque about Java it's the massive accretion of super-awesome-dynamic-abstract-foo *libraries*
04:37 kpreid and most of the people looking for help are having trouble with that
04:37 eMBee btw: for updates of the comparison: http://redmonk.com/sogrady/2013​/02/28/language-rankings-1-13/
04:37 fedaykin "The RedMonk Programming Language Rankings: January 2013 tecosystems" http://rldn.net/CTp
06:00 barneybook joined #rosettacode
08:52 mischi joined #rosettacode
09:05 rublets joined #rosettacode
10:56 barneybook|2 joined #rosettacode
10:56 mischi joined #rosettacode
12:10 mwn3d joined #rosettacode
12:32 opticron joined #rosettacode
12:33 fedaykin joined #rosettacode
14:48 kumul joined #rosettacode
14:50 barosl joined #rosettacode
16:24 mischi joined #rosettacode
17:13 drguildo joined #rosettacode
17:30 drguildo does anybody fancy helping me out with a recursion problem?
17:30 drguildo i could really do with a pointer in the right direction
17:37 opticron there are people here that can probably help, but not without some inkling of the code involved and what the problem is
17:38 opticron toss it up on pastebin or something
17:38 opticron so what's the problem?
17:38 opticron what language?
17:43 drguildo http://codingbat.com/prob/p185204
17:43 fedaykin "CodingBat Java Recursion-2 splitArray"
17:44 drguildo i don't want a solution, just help trying to figure it out for myself
17:44 drguildo so far my idea is to use a recursive function that sums part of an array
17:45 drguildo so int sumArray(int[] nums, int a, int b)
17:45 drguildo is that in the right direction?
17:48 mwn3d Are you trying to sum the whole array or something? What's the ultimate goal?
17:48 mwn3d (I'm on a phone so looking at the code is difficult)
17:48 drguildo Given an array of ints, is it possible to divide the ints into two groups, so that the sums of the two groups are the same. Every int must be in one group or the other. Write a recursive helper method that takes whatever arguments you like, and make the initial call to your recursive helper from splitArray(). (No loops needed.)
17:49 opticron hmmm
17:49 mwn3d Do the groups have to be contiguous?
17:50 drguildo nope
17:50 mwn3d That is...are you supposed to just split the array into two parts at a particular index? Or just gather any two groups from the items in the array?
17:50 drguildo the latter
17:51 opticron sounds like a packing problem
17:51 mwn3d Knapsack-ish
17:52 drguildo the description for the problem set says that they're all recursive backtracking problems
17:52 drguildo i haven't had too much trouble up to this point but this one has me pretty much stumped
17:54 opticron the brute-force way to do it would be to iterate or recurse through all permutations of the items in the array and check each permutation to see whether you can split it at some point making the two halves equal
17:55 opticron that is necessarily expensive for large sets
17:59 opticron so...sum all values and divide by two to get your target value for a single bin
18:01 opticron but the problem statement says no loops at all?
18:03 drguildo it says none are needed
18:04 opticron well...you can do pretty much anything with just recursion, but using a loop for part of would make it less crazy
18:09 drguildo https://github.com/dhbikoff/codingbat-solution​s/blob/master/java/Recursion-2/splitArray.java
18:09 fedaykin "codingbat-solutions/java/R​ecursion-2/splitArray.java at master · dhbikoff/codingbat-solutions · GitHub" http://rldn.net/35T
18:12 drguildo mind = blown
18:15 mwn3d So its basically start at the beginning of the array with a sum of 0 and put that element in group A or B then do the same for the next element and see if either path works out
18:20 drguildo yeah that's a good way of summarising it
18:21 drguildo the use of recursion and the or operator is awesome
18:21 mwn3d Yeah it'll short circuit all the way up once it finds a soluton
18:22 drguildo yeah and it has built-in backtracking
18:22 drguildo as soon as one path fails it'll try the other
18:22 mwn3d I wonder if you could get it to choose a smarter path
18:23 mwn3d Sort the array on the way in and then pick a better path through the tree of possibilities
18:23 mwn3d I feel like sorting it is a good starting point. Not sure why.
18:23 mwn3d The solution for a sorted array might be something close to every even index in one group and every odd index in the other
18:24 mwn3d So if you could alternate the order of the or statement with each level you might get solutions faster but still staying on the same big-O
18:24 mwn3d I dunno. Get the normal way working first :p.
18:25 drguildo i think that'd only work if the elements of the array followed some kind of balanced pattern
18:27 mwn3d Yeah it was all just gut feeling ideas with little grounding in logic
18:27 mwn3d Don't worry about it
20:07 lambdabot joined #rosettacode
21:27 BenBE joined #rosettacode
21:27 BenBE joined #rosettacode
22:20 mwn3d1 joined #rosettacode
22:23 mischi joined #rosettacode
22:31 mwn3d joined #rosettacode
23:42 mwn3d joined #rosettacode

| Channels | #rosettacode index | Today | | Search | Google Search | Plain-Text | summary