Click here to Skip to main content
15,914,400 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
JokeRe: A man has a woman accident Pin
Brisingr Aerowing18-Sep-16 11:49
professionalBrisingr Aerowing18-Sep-16 11:49 
GeneralRe: A man has a woman accident Pin
BillWoodruff18-Sep-16 12:17
professionalBillWoodruff18-Sep-16 12:17 
JokeA pregnant woman has a car accident... PinPopular
OriginalGriff18-Sep-16 4:59
mveOriginalGriff18-Sep-16 4:59 
PraiseRe: A pregnant woman has a car accident... Pin
Suvendu Shekhar Giri18-Sep-16 6:29
professionalSuvendu Shekhar Giri18-Sep-16 6:29 
GeneralRe: A pregnant woman has a car accident... Pin
Sander Rossel18-Sep-16 7:52
professionalSander Rossel18-Sep-16 7:52 
GeneralWhen you realize you don't know what you thought you knew... Pin
Sander Rossel18-Sep-16 2:53
professionalSander Rossel18-Sep-16 2:53 
GeneralRe: When you realize you don't know what you thought you knew... Pin
BillWoodruff18-Sep-16 5:25
professionalBillWoodruff18-Sep-16 5:25 
GeneralRe: When you realize you don't know what you thought you knew... Pin
Sander Rossel18-Sep-16 6:02
professionalSander Rossel18-Sep-16 6:02 
BillWoodruff wrote:
that is when you, very temporarily, most often without suspecting it, have wisdom.
I'm wearing my Wisdom + 1 shorts! Big Grin | :-D
BillWoodruff wrote:
I would be tempted just to make sure the 'Add function failed if the candidate Key was a duplicate
Yeah, that was my first attempt. The problem is that the easiest way to create a "hash" in JavaScript is by simply calling toString() and almost all toString() functions return "[object Object]". So almost all hashes collide... Sigh | :sigh:
Of course I could force the user to always implement a custom toString, but that's a PITA (it's supported, as well as a custom getHash function so toString can be used for other stuff).
So I'm letting go of the O(1) as well. It's more like an O(1-for-custom-toStrings-else-O(n)) or O(1-ish).
I know it can be done with a proper hash, but I've seen an implementation of a dictionary with proper hash and it was over 1000 lines WTF | :WTF:
I'm going with a simpler lightweight "good enough" solution (that's a bit of wisdom as well Laugh | :laugh: ).

The idea was to bring some good old C# collections and LINQ to JavaScript.
I know it's been done before, but my implementation is better (because your own code is always better) *waves wisdom goodbye* Big Grin | :-D
Besides, it's good fun! Big Grin | :-D
Read my (free) ebook Object-Oriented Programming in C# Succinctly.
Visit my blog at Sander's bits - Writing the code you need.
Or read my articles here on CodeProject.
Simplicity is prerequisite for reliability.
— Edsger W. Dijkstra
Regards,
Sander

GeneralRe: When you realize you don't know what you thought you knew... Pin
Jörgen Andersson18-Sep-16 7:34
professionalJörgen Andersson18-Sep-16 7:34 
GeneralRe: When you realize you don't know what you thought you knew... Pin
Sander Rossel18-Sep-16 7:49
professionalSander Rossel18-Sep-16 7:49 
GeneralRe: When you realize you don't know what you thought you knew... Pin
Jörgen Andersson18-Sep-16 7:57
professionalJörgen Andersson18-Sep-16 7:57 
GeneralRe: When you realize you don't know what you thought you knew... Pin
Sander Rossel18-Sep-16 8:05
professionalSander Rossel18-Sep-16 8:05 
GeneralRe: When you realize you don't know what you thought you knew... Pin
Jörgen Andersson18-Sep-16 8:33
professionalJörgen Andersson18-Sep-16 8:33 
GeneralRe: When you realize you don't know what you thought you knew... Pin
Sander Rossel18-Sep-16 10:14
professionalSander Rossel18-Sep-16 10:14 
GeneralRe: When you realize you don't know what you thought you knew... Pin
BillWoodruff18-Sep-16 10:48
professionalBillWoodruff18-Sep-16 10:48 
GeneralRe: When you realize you don't know what you thought you knew... Pin
Sander Rossel18-Sep-16 21:08
professionalSander Rossel18-Sep-16 21:08 
GeneralRe: When you realize you don't know what you thought you knew... Pin
kdmote19-Sep-16 10:18
kdmote19-Sep-16 10:18 
GeneralRe: When you realize you don't know what you thought you knew... Pin
Sander Rossel19-Sep-16 20:32
professionalSander Rossel19-Sep-16 20:32 
AnswerRe: When you realize you don't know what you thought you knew... Pin
Plamen Dragiyski19-Sep-16 11:56
professionalPlamen Dragiyski19-Sep-16 11:56 
GeneralRe: When you realize you don't know what you thought you knew... Pin
Sander Rossel19-Sep-16 20:36
professionalSander Rossel19-Sep-16 20:36 
GeneralRe: When you realize you don't know what you thought you knew... Pin
Plamen Dragiyski20-Sep-16 20:38
professionalPlamen Dragiyski20-Sep-16 20:38 
GeneralRe: When you realize you don't know what you thought you knew... Pin
Sander Rossel20-Sep-16 20:52
professionalSander Rossel20-Sep-16 20:52 
GeneralRe: When you realize you don't know what you thought you knew... Pin
Fabio Franco20-Sep-16 2:53
professionalFabio Franco20-Sep-16 2:53 
GeneralRe: When you realize you don't know what you thought you knew... Pin
Sander Rossel20-Sep-16 10:10
professionalSander Rossel20-Sep-16 10:10 
GeneralRe: When you realize you don't know what you thought you knew... Pin
Fabio Franco20-Sep-16 15:24
professionalFabio Franco20-Sep-16 15:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.