ChatGPT stuff 

tl;dr: it seems likely ChatGPT took advice meant for Python or MATLAB, and substituted Julia’s name in their place because it considers them “close enough”.

1 isn’t wrong, but makes no mention of type stability, which is at least as important as its (more generic, applicable many languages) suggestion.

2 is also generic advice that’s good to have, but isn’t specific (but I consider this one a success)

3 rates as kinda okayish advice. One could argue that for a beginner, the base functions offer a solid place to start, if we assume they’re gonna write badly optimized code (but then teaching them how not to do that - as the prompt asked - is a better way to solve that). But since this is Julia, it’s not uncommon that simple custom code you write beats the obvious ways using built-ins. So I’d consider this potentially misleading.

4 is likely the smoking gun here - the repeated mentions of vectorization and asking to use techniques to “vectorize your code” seems to suggest that this whole thing was taken from guides written for Python or MATLAB, which are at this point more numerous than those for Julia, and then the Language Model substituted Julia in the language name’s place because it considers them similar. (A previous answer said “there are a number of programming languages that are commonly used for numerical and scientific computing, including Python, Julia, MATLAB, R, and others” - so it knows they’re in the same category.)

Show thread

ChatGPT stuff 

I asked “What is the secret to make Julia code fast?” (just to see if it picks up anything from Jakob Nissen’s excellent guide viralinstruction.com/posts/opt or the many other optimization guides online).

The answer turned out to be good example of the model’s ability to be subtly misleading while not being entirely wrong.

(Thread, with ChatGPT’s reply as the next post.)

I just completed Day 12 of in .

Hard day with little time for AoC, but I managed to squeeze it in - and the problem was interesting enough to be rewarding, to make it feel worth it. Got to explore Julia’s typing and multiple dispatch a little bit along the way.

I just completed “Adapter Array” - Day 10 - Advent of Code 2020 adventofcode.com/2020/day/10 in .

  • I was surprised to learn there’s no “count unique values” function in base Julia (equivalent to uniq -c in shell). The StatsBase downloadable package is needed for that.
  • How have I never used sort in Vim before?! I always thought I’d need to use the shell’s sort command since that’s the Unix-y way, but :sort n works like a charm.
  • One thing Advent of Code does better than other coding challenges is state the problem very clearly. Good examples, clear question text, and every assumption made explicit.

I just completed “Handheld Halting” - Day 8 - Advent of Code 2020 adventofcode.com/2020/day/8 in .

Spent way too long on Part 2 thinking there must be an interesting non-bruteforce way to solve it. reddit also seems to be concluding there’s no neater way of solving it, just straight up try everything, which is disappointing.

I just completed “Handy Haversacks” - Day 7 - Advent of Code 2020 adventofcode.com/2020/day/7 in .

I wanted to do something interesting using Julia’s multiple dispatch, making each outer bag a function and the inner bags the parameters, but it would have needed too much macro munchkinry and ended up in the “too clever for its own good” type code. I’m not trying to be Mel the Real Programmer after all.

I just completed “Custom Customs” - Day 6 - Advent of Code 2020 adventofcode.com/2020/day/6 in .

Every day, while implementing Part 2, I end up with a more elegant neater way of doing Part 1. Never occurs to me while doing Part 1 itself - probably because I come up with an idea while reading the question and rush to implement it, not stopping to think of other ways of doing it .

toy prog challenge solution 

Did the subset sum challenge today, in . Code here. I used to get stuck with dynamic programming problems, finding them hard to reason about, so it was pleasant to find that with this one the logic flowed nice and easy. Typing in the test cases and getting the test setup going took up more time than actually solving the problem itself!

Show thread

I just completed “Toboggan Trajectory” - Day 3 - Advent of Code 2020 adventofcode.com/2020/day/3 using

Lessons (re-)learnt:

  • did you know that example data is also data? I’d forgotten it! Using that for testing made things easier - when I finally thought of it - since it’s so much smaller and easier to eyeball.
  • Julia’s dynamism came back to bite in the usual way it does - since there’s no variable declarations required, when I messed up a variable name change and left the old name in in some places, Julia was happy to treat those as two separate variables and end up with weird results.
  • Repl.it has a decent mode, but is otherwise a pain to use; it messes with outputs and makes error messages so much harder to read.
  • Good practices are good practices for a reason. Magic numbers and baked-in literals are fertile grounds for bugs, even in little one-off projects like this.
  • Naming things is hard!

I just completed “Password Philosophy” - Day 2 - Advent of Code 2020 adventofcode.com/2020/day/2 using .

Day 2 was kind of a letdown. The problems felt particularly pointless, and there was no thinking or creative problem solving required; just look up some functions in your language’s manual and then it’s just nitty gritty work.
Let’s hope Day 3 has something fresh and interesting!

Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.