maxProfit :: [Int] -> Int
maxProfit (p:ps) = fst . foldl go (0, p) $ ps
where
go :: (Int, Int) -> Int -> (Int, Int)
go (profit, minPrice) price = ( max profit (price-minPrice)
, min minPrice price)
vs
class Solution {
public:
int maxProfit(vector<int>& prices) {
auto [profit, price] = std::accumulate(
prices.begin()+1, prices.end(),
std::make_pair(0, prices[0]),
[](std::pair<int, int> acc, int price) {
return std::make_pair(
std::max(acc.first, price-acc.second),
std::min(acc.second, price)
);
}
);
return profit;
}
};CPP is an absolute nightmare
Haskell has so so so good type-system and even crazy AI can write a project in a seconds 👻
Origin: Garbage collection was invented by American computer scientist John McCarthy around 1959.
Language: It was specifically designed for the Lisp programming language to automate the management of memory for its characteristic list-based data structures.
Functional programming languages are GOAT I think
https://intellij-support.jetbrains.com/hc/en-us/community/posts/35329154803346-Goland-UI-on-MacOS
😒😒😒
😒😒😒
IDEs Support (IntelliJ Platform) | JetBrains
Goland UI on MacOS
When app is open long enough, on macOS this is happening. After restart all works again.Build #GO-261.22158.291, built on March 26, 2026Runtime version: 25.0.2+10-b329.72 aarch64 (JCEF 137.0.17-26...
https://github.com/abdivasiyev/telegram-teams-server
Telegram to Microsoft Teams bridge
vibe coded by expensive tokens
Telegram to Microsoft Teams bridge
vibe coded by expensive tokens
GitHub
GitHub - abdivasiyev/telegram-teams-server: A bridge to forward telegram messages into Microsoft Teams private channel via webhook
A bridge to forward telegram messages into Microsoft Teams private channel via webhook - abdivasiyev/telegram-teams-server
😁1
λ
Photo
Early years of my career, I was interested in writing articles, doing streams. But now everyone will use LLM instead of searching and learning something. LLM is developing reduced attention span among engineers as like TikTok, Instagram does. Hope everything should be ok🫠
And I do not have any ideas what about to write
And I do not have any ideas what about to write
Using primitive types is shooting yourself in the foot. One missing check and you will loose your all logic🤧🤧🤧
Even with Haskell or Rust's strong type system, you will end up with dynamic language (JS or PHP) like result.
So, parse, do not validate guys
Even with Haskell or Rust's strong type system, you will end up with dynamic language (JS or PHP) like result.
So, parse, do not validate guys
For example:
Can you predict which argument is used as id of the user? Or what for responsible another arguments?
In Go's idiom, there are usual two ways:
– using a struct to pass these arguments. But there is a problem. How do you require to fill all fields of struct? Will you return runtime error? So you will end up production failure in your services.
– using named arguments. Kind of works, but you will not read always any documentation or function definition, so messing up with this also easy.
So, let's add third way to our idiom:
In the last solution, a caller can not misuse any arguments, they will get compile time error whenever they changed order of the arguments. But there is a trick again thanks to Go's explicit type casting😐. You just easily convert
package users
type Repo interface {
GetByID(context.Context, int, int, int) (User, error)
}
Can you predict which argument is used as id of the user? Or what for responsible another arguments?
In Go's idiom, there are usual two ways:
– using a struct to pass these arguments. But there is a problem. How do you require to fill all fields of struct? Will you return runtime error? So you will end up production failure in your services.
– using named arguments. Kind of works, but you will not read always any documentation or function definition, so messing up with this also easy.
So, let's add third way to our idiom:
// types package
package types
// phantom types
type (
User struct{}
Customer struct{}
)
type constraint interface {
User | Customer
}
type ID [T constraint] int64
type Offset [T constraint] int64
type Limit [T constraint] int64
// users package
package users
type Repo interface {
GetByID(context.Context, types.ID[types.User], types.Offset[types.User], types.Limit[types.User]) (User, error)
}
In the last solution, a caller can not misuse any arguments, they will get compile time error whenever they changed order of the arguments. But there is a trick again thanks to Go's explicit type casting😐. You just easily convert
types.ID into types.Offset because of their underlying data types. For this, one can use a struct instead of int64 as underlying type. But it will be so overcomplicated.