regex.sh

regex.sh

Elixir's `Enum.transpose/1` written by ChatGPT?

So I was going back and forward with ChatGPT about Elixir and tried making something using only GPT (it seems to be hot topic rn). Anyhow, suddenly ChatGPT gave me advice to use Enum.transpose. And when I told him that doesn’t exist, he continued to hallucinate. So I went down the rabbit hole and got this :smiley:
Any thoughts about implementing/adding this new function into the Enum module? :nerd_face:

Most Liked

LostKobrakai

LostKobrakai

[
  [1, 2, 3],
  [4, 5, 6],
  [7, 8, 9]
]
|> Enum.zip_with(& &1)
# [
#   [1, 4, 7], 
#   [2, 5, 8], 
#   [3, 6, 9]
# ]
lucaong

lucaong

This is a good reminder that, as impressive as they are, models like GPT are great at producing plausible content, not correct one :slight_smile:

Slight detour: I even think that it would be great if GPT-like models could express uncertainty in their output. Right now they sound like an overconfident but ultimately mistaken person that knows some stuff but is far from really understanding the topic.

Anyway, my opinion is that transpose is a special purpose function that only makes sense if the enumerable is representing a matrix as a collection of rows. As such, I don’t think that such a special case has its right place in Enum. In fact, depending on what the enumerable is, there are more efficient ways to do that.

lucaong

lucaong

Yeah this sounds like a recipe for trouble :slight_smile:

Where Next?

Popular in Discussions Top

mmport80
I have put far too much effort into Dialyzer over the last year or so - and basically - I doubt it’s worth the effort. It’s not as easy ...
New
mmmrrr
Just saw that dhh announced https://hotwire.dev/ Is it just me or is this essentially live view? :smiley: Although I like the “iFrame-e...
New
AstonJ
If a newbie asked you about Phoenix Contexts, how would you explain the basics to them? Feel free to be as concise or in-depth as you li...
New
nburkley
AWS re:Invent is on at the moment with some interesting announcements. One new feature in particular is the Lambda Runtime API for AWS La...
New
sergio
There’s a new TIOBE index report that came out that shows Elixir is still not in the top 50 used languages. It also goes on to call Elix...
New
tomekowal
Hey guys! I want to create a toy project that shows a chart of temperature over time and updates every 5 seconds. I feel LiveView is per...
New
wmnnd
The Go vs Elixir thread got me thinking: Would it be too hard to implement a simple mechanism for creating Go-style static app binaries f...
New
MarioFlach
Hello, I want to share a project I’ve been working on for a while: https://github.com/almightycouch/gitgud Background Some time ago I ...
New
kostonstyle
Hi all How can I compare haskell with elixir, included tools, webservices, ect. Thanks
New
paulanthonywilson
I like Umbrella projects and pretty much always use them for personal Elixir stuff, especially Nerves things. But I don’t think this is ...
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29603 241
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 127089 1222
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement