Here is another tech telegram channel for yall.
I think he mainly does ios stuff,
Checkout his channel
@storyOfXcode
I think he mainly does ios stuff,
Checkout his channel
@storyOfXcode
Frectonz
Photo
In my experience golang is a pretty meh language but no variable shadowing thing annoys me a lot.
Go needs to implement variable shadowing.
While you are programming you have some mental model of the data you're working on, let's say it's a list of numbers and you wanna sum them up.
Ok so the flow of the program is
1. You ask the user to provide the numbers. Let's say that the numbers are separated by commas.
You store the numbers in a variable you called
2. You split the input you got on commas, to extract the individual numbers you got.
Here's where things go wrong in a programming language that doesn't have variable shadowing. Ideally you would be able to do this
That's why variable names are helpful, they name the higher order way we think about the data.
If go had variable shadowing we would still be able to call the array of strings we got after splitting it,
There is a reason why I am using the word "shadowing" here. You might be asking why not just re-assign the variable, like what we do in dynamic languages. That's not what I am talking about, re-assigning the variable would only change the data it's holding on to, shadowing would let you change both the data and type.
In vscode terms when I hover on
3. At this point you would iterate over the
With variable shadowing, you would still call this
Without variable shadowing, you would be forced to come up with a new variable name like
4. In the last step you would just sum up numbers.
Go needs to implement variable shadowing.
While you are programming you have some mental model of the data you're working on, let's say it's a list of numbers and you wanna sum them up.
Ok so the flow of the program is
1. You ask the user to provide the numbers. Let's say that the numbers are separated by commas.
You store the numbers in a variable you called
numsnums := getInput()This will be holding our numbers as a comma separated string.
getInput is not a function in go, I just forgot how you read from stdin in go.2. You split the input you got on commas, to extract the individual numbers you got.
Here's where things go wrong in a programming language that doesn't have variable shadowing. Ideally you would be able to do this
nums := getInput()Instead you have to do this
nums := strings.Split(nums, ",")
nums := getInput()So what's the big deal, notice when I was talking about the "numbers" I was calling them "numbers" all the time, no matter what kind of data type they happen to be at the current stage. Notice how they were transformed from a comma separated string, into an array of strings, but we would still refer to them as "numbers".
numsSplit := strings.Split(nums, ",")
That's why variable names are helpful, they name the higher order way we think about the data.
If go had variable shadowing we would still be able to call the array of strings we got after splitting it,
nums and we wouldn't have needed to come up with the name numsSplit.There is a reason why I am using the word "shadowing" here. You might be asking why not just re-assign the variable, like what we do in dynamic languages. That's not what I am talking about, re-assigning the variable would only change the data it's holding on to, shadowing would let you change both the data and type.
In vscode terms when I hover on
nums from the first step, I should see string, in the second step nums would be []string.3. At this point you would iterate over the
nums and convert them from a string to an int. With variable shadowing, you would still call this
nums but now it would be holding on to a []int (an array of ints).Without variable shadowing, you would be forced to come up with a new variable name like
numsArray or even numsAsInts or sth like that.4. In the last step you would just sum up numbers.
Frectonz
Capitalism is the only economic system that ensures human progress. It is one of the true super powers of humanity. It holds societies together. It even aligns nations to prosper together. It is magnificent.
Telegram
Frectonz
This is especially true in Ethiopia, this notion is strongly woven into our society. I think the main source of this sentiment is this phrase from the Bible.
“Blessed Are the Meek, for They Will Inherit the Earth"
Screenshot from a Paul Graham article called…
“Blessed Are the Meek, for They Will Inherit the Earth"
Screenshot from a Paul Graham article called…
Frectonz
I've completed "Scratchcards" - Day 4 - Advent of Code 2023 I did this one in golang. Part 2 took me way too long to figure out. [Part 1 Solution] [Part 2 Solution]
Only manged to do part 1 today.
I couldn't get part 2 to work, maybe i will try it again in the weekends or sth.
I did today's puzzle in Rust.
[Part 1 Solution] [Unfinished Part 2 Solution]
I couldn't get part 2 to work, maybe i will try it again in the weekends or sth.
I did today's puzzle in Rust.
[Part 1 Solution] [Unfinished Part 2 Solution]
👍1
Frectonz
Only manged to do part 1 today. I couldn't get part 2 to work, maybe i will try it again in the weekends or sth. I did today's puzzle in Rust. [Part 1 Solution] [Unfinished Part 2 Solution]
I did part 2 after watching this video. It is still the bruteforce solution but i used rayon to parallelise it, and used indicatif to show a progress bar.
YouTube
Day 05 - Advent of Code
Advent of Code day 05 in Rustlang
A bunch of new crates get introduced today. nom_supreme, tracing, rayon, and indicatif!
GitHub: https://github.com/ChristopherBiscardi/advent-of-code/tree/8dfb5eff0c8a07f1ad9eaf7a3943bfa2e2d38e95/2023/rust/day-04/src
*…
A bunch of new crates get introduced today. nom_supreme, tracing, rayon, and indicatif!
GitHub: https://github.com/ChristopherBiscardi/advent-of-code/tree/8dfb5eff0c8a07f1ad9eaf7a3943bfa2e2d38e95/2023/rust/day-04/src
*…
Frectonz
Jeff Dean on Gemini
YouTube
This is changing the way scientists research | Gemini
Gemini — Google’s newest and most capable AI model.
200,000 scientific papers with crucial science information gets read, understood, and filtered by Gemini all in one lunch break. Join DeepMind Research Scientist Sebastian Nowozin and Software Engineer…
200,000 scientific papers with crucial science information gets read, understood, and filtered by Gemini all in one lunch break. Join DeepMind Research Scientist Sebastian Nowozin and Software Engineer…
Frectonz
https://youtu.be/sPiOP_CB54A
YouTube
Using AI to solve complex problems | Gemini
Watch as AI solves complex problems with Google DeepMind Research Engineer Gabriela Surita – using Gemini’s advanced coding abilities, including quickly prototyping a web app to explore London’s train stations. Gemini is Google’s newest and most capable AI…
👍1
Frectonz
https://youtu.be/UIZAiXYceBI
YouTube
Personalized AI for you | Gemini
Google’s newest and most capable AI model – Gemini.
Join Google Research Engineering Director Palash Nandy as he showcases Gemini’s advanced reasoning and coding abilities, all while exploring ideas for a birthday party.
The model understands his intent…
Join Google Research Engineering Director Palash Nandy as he showcases Gemini’s advanced reasoning and coding abilities, all while exploring ideas for a birthday party.
The model understands his intent…