Hacker Newsnew | past | comments | ask | show | jobs | submit | zevyoura's commentslogin


But this is wrong in at least two ways:

> Additionally, if the hash contains duplicate keys, swapping the keys and values may not have the desired effect.

You can't have duplicate keys in a hash.

More importantly, their implementation adds the swapped pairs but does not remove the original k/v pairs, which is both incorrect and does not match the output it prints.


It looks like you can have duplicate keys so I'll give it the benefit of the doubt: https://stackoverflow.com/questions/6808801/ruby-hash-with-d...

But maybe this is why they still used GPT-4 for benchmarking, GPT-4's take:

Actually, there is a mistake in that response. The code snippet I provided modifies the original hash during iteration, which can lead to unexpected results. Also, the code can't handle the case where there are duplicate values.

A safer and more accurate way would be to create a new hash and then populate it with the swapped keys and values:

   hash = {a: 1, b: 2, c: 3}
   swapped_hash = {}

   hash.each do |key, value|
      swapped_hash[value] = key
   end

    puts swapped_hash
    # Output:
    # {1 => :a, 2 => :b, 3 => :c}
In this example, we avoid modifying the original hash while iterating over it, and the potential problems that can cause. Additionally, please note that if the hash contains duplicate values, some entries might be overwritten in the new hash since hash keys must be unique.

Also, the invert method is a built-in Ruby method for swapping keys with values in a hash. It's a simpler approach:

   hash = {a: 1, b: 2, c: 3}
   swapped_hash = hash.invert
   
   puts swapped_hash
   # Output:
   # {1 => :a, 2 => :b, 3 => :c}
Remember that the invert method also doesn't handle duplicate values gracefully. If a value appears more than once, only one of those instances will appear in the inverted hash.

-

Since I wrote the original comment I tried this for common use cases I've established with 3.5 and 4 and it's still a joke. Overall OpenAI is clearly dominating this space in a way I think people are downplaying out of hope.



Thank you very much!


There's a great episode of the podcast "Reply All" which digs into some of these questions: https://gimletmedia.com/shows/reply-all/6nh3wk/


> How is that turning out for everyone?

Dramatically increased life expectancy, reduced childhood mortality, etc.

There are problems with the modern health system, but it does seem to produce much better outcomes than what came before.


> It would be pretty hard to express the sentiment the ¯\_(ツ)_/¯ emoji can, and even if you put the effort into writing it, you'd lose the immediacy.

"meh"


Funnily, I have no clue what "meh" means.

1) The emoji has several possible interpretations/meanings depending on context, such as "I don't know", "I don't care", "indifference" or "shrug". There's this saying, "a picture says a thousand words". It applies here (nobody said the words couldn't be a few words in hundreds of different languages ;)).

2) The emoji generally does not require translation to different languages. It isn't universal, but its more accessible, and some emojis are certainly universal (such as :) which is a facial expression my 3 month old understands).


> emoji generally does not require translation to different languages

Really good point. I don't find watching a keynote speeches about emoji at all exciting, either. But I work on a mixed-language engineering team with a lot of (extremely smart, highly literate) people, and we use emoji all the time.

Whether it's cold-sweat-face or thinking-face really helps me understand the nuance of my colleague's Japanese comments (which, btw, as a native English speaker with only fair Japanese ability, gives me a free opportunity to experience 'basic or lower literacy').

I know that adding emoji characters helps them in the same way, so I use them frequently.


I read that as "who knows?"


From the article:

> The 2017 call records tally remained far less than an estimated billions of records collected per day under the NSA’s old bulk surveillance system, which was exposed by former U.S. intelligence contractor Edward Snowden in 2013.


Oh I read it. I just don't believe it.

After learning of their liberal use of the English language and how they have "re-defined" common words to suit their agenda, I believe very little of anything they say.


They've redefined nothing. See section 2 of https://www.dni.gov/files/documents/Minimization%20Procedure.... All the definitions seem reasonable.

The definitions you're thinking of came from conspiracy theory blogs in the aftermath of the Snowden leaks, which proliferated because the numbers didn't add up when taken together with Greenwald's mistaken assertion that PRISM is a full-take program.


You may be thinking of http://newsdiffs.org

Here's the page for the article in question: http://newsdiffs.org/article-history/https%3A/www.nytimes.co...


If you found this interesting, you might also like this classic Neal Stephenson piece for Wired, "Mother Earth, Motherboard": https://www.wired.com/1996/12/ffglass/



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: