Forwarded from Aliester Crowley
Stroustrup: Actually, I was thinking about those days, just before you arrived. Do you remember? Everyone was writing 'C' and, the trouble was, they were pretty damn good at it. Universities got pretty good at teaching it, too. They were turning out competent - I stress the word 'competent' - graduates at a phenomenal rate. That's what caused the problem.
Interviewer: Problem?
Stroustrup: Yes, problem. Remember when everyone wrote COBOL?
Interviewer: Of course. I did, too.
Stroustrup: Well, in the beginning, these guys were like demi-gods. Their salaries were high, and they were treated like royalty.
Interviewer: Those were the days, eh?
Stroustrup: Right. So what happened? IBM got sick of it, and invested millions in training programmers, till they were a dime a dozen.
Interviewer: That's why I got out. Salaries dropped within a year, to the point where being a journalist actually paid better.
Stroustrup: Exactly. Well, the same happened with 'C' programmers.
Interviewer: I see, but what's the point?
Stroustrup: Well, one day, when I was sitting in my office, I thought of this little scheme, which would redress the balance a little. I thought 'I wonder what would happen, if there were a language so complicated, so difficult to learn, that nobody would ever be able to swamp the market with programmers? ...'
Interviewer: You're kidding?
Stroustrup: Not a bit of it.
Interviewer: Problem?
Stroustrup: Yes, problem. Remember when everyone wrote COBOL?
Interviewer: Of course. I did, too.
Stroustrup: Well, in the beginning, these guys were like demi-gods. Their salaries were high, and they were treated like royalty.
Interviewer: Those were the days, eh?
Stroustrup: Right. So what happened? IBM got sick of it, and invested millions in training programmers, till they were a dime a dozen.
Interviewer: That's why I got out. Salaries dropped within a year, to the point where being a journalist actually paid better.
Stroustrup: Exactly. Well, the same happened with 'C' programmers.
Interviewer: I see, but what's the point?
Stroustrup: Well, one day, when I was sitting in my office, I thought of this little scheme, which would redress the balance a little. I thought 'I wonder what would happen, if there were a language so complicated, so difficult to learn, that nobody would ever be able to swamp the market with programmers? ...'
Interviewer: You're kidding?
Stroustrup: Not a bit of it.
Understanding Futures in Rust
https://www.viget.com/articles/understanding-futures-is-rust-part-2/?amp=true
https://www.viget.com/articles/understanding-futures-is-rust-part-2/?amp=true
https://www.viget.com
Understanding Futures in Rust -- Part 2 | Viget
Futures make async programming in Rust easy and readable. Learn how to use futures by building them from scratch. Part 2 focuses on combinators.
Forwarded from Awesome Rust
Common data structures and algorithms in Rust
https://github.com/EbTech/rust-algorithms
https://github.com/EbTech/rust-algorithms
GitHub
GitHub - EbTech/rust-algorithms: Common data structures and algorithms in Rust
Common data structures and algorithms in Rust. Contribute to EbTech/rust-algorithms development by creating an account on GitHub.
Forwarded from Evgeni Nabokov
Добавляйтесь в союзники www.codewars.com/r/VjZ5EA (а может и в один клан :) )
Codewars
Codewars: Train your coding skills
Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential.
Forwarded from Viacheslav S
Кстати, я вчера нашел ответ на мой вопрос. Если кому интересно, вот тут небольшая док про кастомные типы в nom https://github.com/Geal/nom/blob/master/doc/custom_input_types.md
GitHub
Geal/nom
Rust parser combinator framework. Contribute to Geal/nom development by creating an account on GitHub.
Forwarded from Viacheslav S
А тут пример реализации на списке токенов https://github.com/Rydgel/monkey-rust/blob/master/lib/parser/mod.rs
GitHub
monkey-rust/lib/parser/mod.rs at master · Rydgel/monkey-rust
An interpreter for the Monkey programming language written in Rust - Rydgel/monkey-rust
Forwarded from nvkv
композабельность в общем случае делается за счет того, что функции принимают аргументы и возвращают значения
Forwarded from The Wacky Yellow Dog
Нет, за счёт того, что вызов функции ты всегда безопасно можешь заменить её результатом
Forwarded from Αλεχ Zhukovsky
только ты его весь прочитать не сможешь, а еще он обычно копипастный из-за чего у тебя постоянно ошибки "тут заменили - там забыли"
Forwarded from red75prime
"Über".bytes().map(|b| b as char).collect::<String>() = "Ã\u{9c}ber"https://t.iss.one/rust_offtopic/67685
Alex Zhukovsky:
вместо методов ToList/ToArray/ToHashSet/... можно было бы сделать один метод To<>
Но из-за того, что List/Array/HashSet/... сами по себе генерики ты не можешь, т.к. тебе надо сделать To<List<>>
а шарп так не разрешает
Alex Zhukovsky:
вместо методов ToList/ToArray/ToHashSet/... можно было бы сделать один метод To<>
Но из-за того, что List/Array/HashSet/... сами по себе генерики ты не можешь, т.к. тебе надо сделать To<List<>>
а шарп так не разрешает
public static T<A> To<T>(this IEnumerable<A> xs)
where T : <>, new(), ICollection<>
{
var ta = new T<A>();
foreach(var x in xs) {
ta.Add(x);
}
return ta;
}
...
{
var data = Enumerable.Range(0, 20);
var set = data.To<HashSet<>>(); // sorcery!
var linkedList = data.To<LinkedList<>>();
var list = data.To<List<>>();
}
Коротко об "удобстве" сишарпаTelegram
Alex Zhukovsky in rust_offtopic
public static T<A> To<T>(this IEnumerable<A> xs)
where T : <>, new(), ICollection<>
{
var ta = new T<A>();
foreach(var x in xs) {
ta.Add(x);
}
return ta;
}
...
{
var data = Enumerable.Range(0, 20);
var set = data.To<HashSet<>>();…
where T : <>, new(), ICollection<>
{
var ta = new T<A>();
foreach(var x in xs) {
ta.Add(x);
}
return ta;
}
...
{
var data = Enumerable.Range(0, 20);
var set = data.To<HashSet<>>();…
Forwarded from Αλεχ Zhukovsky
1. Следствие того, что выражать мысли на ФП можно гораздо более точно. Это аргументация гошников, что им простыня на 100 строк кода иф-элсов понятнее, чем какие-нибудь более серьезные абстракции вроде макрософ и генериков. См статью про сравнение го и Д. То что в 1 стрчоку можно сделать то что на сишарпе делается в 50 - это хорошо, а не плохо.
2. Это сишный синтаксис инопланетный, просто ты к нему привык. Детям в 5 классе в штатах дают хачкель вместо плюсов и они прекрасно его пережеыввают. Потом не понимают что в сишной программе происходит
2. Это сишный синтаксис инопланетный, просто ты к нему привык. Детям в 5 классе в штатах дают хачкель вместо плюсов и они прекрасно его пережеыввают. Потом не понимают что в сишной программе происходит
Forwarded from Αλεχ Zhukovsky
interface (Applicative f, VerifiedFunctor f) => VerifiedApplicative (f : Type -> Type) where
applicativeMap : (x : f a) -> (g : a -> b) ->
map g x = pure g <*> x
applicativeIdentity : (x : f a) ->
pure Basics.id <*> x = x
applicativeComposition : (x : f a) -> (g1 : f (a -> b)) -> (g2 : f (b -> c)) ->
((pure (.) <*> g2) <*> g1) <*> x = g2 <*> (g1 <*> x)
applicativeHomomorphism : (x : a) -> (g : a -> b) ->
(<*>) {f} (pure g) (pure x) = pure {f} (g x)
applicativeInterchange : (x : a) -> (g : f (a -> b)) ->
g <*> pure x = pure (\g' : (a -> b) => g' x) <*> g