These are chat archives for FreeCodeCamp/Help

3rd
Apr 2015
Briana Swift
@brianamarie
Apr 03 2015 01:00
Alright, more questions on the same bonfire. So it's my understanding I should return all of the numbers that are unique to their own array. If the arguments are ([1, 2, 5], [2, 3, 5], [3, 4, 5]), I should return [1,4], right?
Cristián Berríos
@crisberrios
Apr 03 2015 01:04
hmm not exactly
try to read first about symmetric difference
it's not something you can guess
then implementing it should be easier
because it varies between 2, 3 and (n) sets
though for this bonfire getting it with 2 and 3 is fine
One tip is that repeated items within an array should be considered as a repeated item
Briana Swift
@brianamarie
Apr 03 2015 01:05
Ah. I think I have it for if there's 2, but I must have a misunderstanding of the concept with more than 2 sets.
Cristián Berríos
@crisberrios
Apr 03 2015 01:06
so [1,2,3] is the same as [1,1,3,3,2,2]
Suzanne Atkinson
@AdventureBear
Apr 03 2015 02:37
Sorted Union...
I haven't tried sorting yet but I can't get the duplicates out with my indexOf method...
Justin Rogers
@yaskyj
Apr 03 2015 02:43
@AdventureBear For your filter to remove dups, you should pass the number and the index to the anon function. Then compare the indexOf to the current index.
Suzanne Atkinson
@AdventureBear
Apr 03 2015 02:48
I'm not sure what the comparison would be? I want to find out if it's already there, and if it is not return the value. So I'm returning the number if indexOf doesn't exist at all. How does that sound?
does the fact that I am mapping an array of subarrays need to be taken into account?
Justin Rogers
@yaskyj
Apr 03 2015 02:50
indexOf returns the first index it finds.
So if indexOf doesn't equal the current index in the filter function, it won't be returned.
Justin Rogers
@yaskyj
Apr 03 2015 02:58
@AdventureBear Did that help?
Suzanne Atkinson
@AdventureBear
Apr 03 2015 03:08
sort of. I was trying to use it to find out if it was unique, ie indexOf = -1. but I still am having logic troubles. Thanks @yaskyj , I'm still playing with it
Justin Rogers
@yaskyj
Apr 03 2015 03:10
You're also calling the return on union instead of copy.
Suzanne Atkinson
@AdventureBear
Apr 03 2015 03:11
thanks, i've been going back and forth to see what I'm actually modifying. It's a little messy. :)
Justin Rogers
@yaskyj
Apr 03 2015 03:11
Did that fix it?
But still, the indexOf the number will never be -1.
Suzanne Atkinson
@AdventureBear
Apr 03 2015 03:14
if it's not in the other set it should return -1, that's how I can tell if it's a unique value
The indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present.
I'm not saying I'm using it correctly, but that was my logic.
Justin Rogers
@yaskyj
Apr 03 2015 03:18
Maybe try to work backwards. Ultimately you want an array of unique elements from all the arrays in one array, right?
Suzanne Atkinson
@AdventureBear
Apr 03 2015 03:20
I think i need to take a break. This is actually further than I've gotten before, lol.
thanks @yaskyj
Justin Rogers
@yaskyj
Apr 03 2015 03:21
np, hope I helped.
Suzanne Atkinson
@AdventureBear
Apr 03 2015 03:24
i think so, i'll let you know. :)
Justin Rogers
@yaskyj
Apr 03 2015 03:26
And the map call is returning the same arrays back. I'd try concat.
Suzanne Atkinson
@AdventureBear
Apr 03 2015 03:38
yeah, I'm mapping with no change in the array. Just playing I guess.
Justin Rogers
@yaskyj
Apr 03 2015 03:40
You could use a forEach to concat them all to one array.
Suzanne Atkinson
@AdventureBear
Apr 03 2015 03:45
well I have this...http://repl.it/gsE/2
and I tried a one liner inside the forEach to check for duplicates at the same time and it wasn't working
and I'm not using the filter correctly
like I wasn't using the map correctly
the good news is that I'm using filter & map to iterate, so that's something.
Justin Rogers
@yaskyj
Apr 03 2015 03:48
You can run the filter of list using indexOf and check it it's the the index of the current number. That would remove the dups.
Suzanne Atkinson
@AdventureBear
Apr 03 2015 03:58
OH...I get what you're saying now
Justin Rogers
@yaskyj
Apr 03 2015 03:58
Sweet!
Bianca Mihai
@biancamihai
Apr 03 2015 11:11
@brianamarie did you solve it?
https://www.youtube.com/watch?v=PxffSUQRkG4
so sym([1, 2, 5], [2, 3, 5], [3, 4, 5]) = sym(sym([1, 2, 5], [2, 3, 5]),[3, 4, 5]) = sym([1,3],[3,4,5]) = [1,4,5] hope it helps
Briana Swift
@brianamarie
Apr 03 2015 11:51
Thank you @biancamihai!
Bianca Mihai
@biancamihai
Apr 03 2015 11:56
@brianamarie you are welcome, I hope it helps :)
Evan Davis
@davisec52
Apr 03 2015 15:21

Does anyone happen to know how--using the node.js command prompt screen and not the windows cmd prompt--to run commands from a subdirectory within the home directory. Unfortunately, I'm running xp and there is an error preventing the execution of js from cmd. Anyway, the path to the home directory looks like this:

C:\Documents and Settings\Evan>

The nodeschool how-to-npm workshop wants me to install package.json into a new directory and I don't know how or if it is possible to do that from the node.js command prompt.

Anyone happen to know?

Sudeepto
@Sudeepto
Apr 03 2015 16:05
@AdventureBear Did you solved the sorted Union problem ??
Suzanne Atkinson
@AdventureBear
Apr 03 2015 16:11
no not yet
Sudeepto
@Sudeepto
Apr 03 2015 16:12
I can help you. I already solved it couple of weeks ago for another fellow FCC :smile: So I'm solving it again.
Suzanne Atkinson
@AdventureBear
Apr 03 2015 16:36
I went to bed lat night and have yet to take another crack at it. If I don't get it this time around I'll send you a message or tag you here! THanks.
Sudeepto
@Sudeepto
Apr 03 2015 17:39
@AdventureBear Okay :smile: Its 11 pm here and i'll be up for another hour.
Sudeepto
@Sudeepto
Apr 03 2015 19:50
@AdventureBear Hey I solved it. I can explain it you okay ?? I couldn't sleep without solving the problem :smile:
Suzanne Atkinson
@AdventureBear
Apr 03 2015 22:50
Lol, hopefully you're asleep right now @Sudeepto but when you wake up feel free