Linker Unsafe
220 subscribers
182 photos
24 videos
18 files
859 links
Собираю ржавые и лямбдообразные новости, прикольные цитатки с форумов, ссылки на статьи и всё такое. В-общем, сюда я тащу такие крупицы, которые мне будет жаль потерять в цифровой бездне. Возможно, они покажутся интересными и вам.

Фи сюда: @nlinker
Download Telegram
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.
Forwarded from Viacheslav S
Кстати, я вчера нашел ответ на мой вопрос. Если кому интересно, вот тут небольшая док про кастомные типы в nom https://github.com/Geal/nom/blob/master/doc/custom_input_types.md
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<>>

а шарп так не разрешает


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<>>();
}

Коротко об "удобстве" сишарпа
Forwarded from Αλεχ Zhukovsky
1. Следствие того, что выражать мысли на ФП можно гораздо более точно. Это аргументация гошников, что им простыня на 100 строк кода иф-элсов понятнее, чем какие-нибудь более серьезные абстракции вроде макрософ и генериков. См статью про сравнение го и Д. То что в 1 стрчоку можно сделать то что на сишарпе делается в 50 - это хорошо, а не плохо.
2. Это сишный синтаксис инопланетный, просто ты к нему привык. Детям в 5 классе в штатах дают хачкель вместо плюсов и они прекрасно его пережеыввают. Потом не понимают что в сишной программе происходит
Forwarded from Jack
Forwarded from Oleg Andreev
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