169 похожих чатов

Господа, я только начал изучать typescript (к слову javascript знаю

крайне поверхностно, так как сразу после C++ начал изучать typescript), конкретно для того, чтоб делать игры на Cocos Creator. А вопросы у меня такие: 1) Есть ли в Typescript ассоциативный массив? Какой это тип? Это map? 2) Как делать выборку из коллекции наподобие LINQ в С# или наподобие прокси-итераторов в C++ (то есть допустим, есть коллекция фамилий, мне надо получить такой итератор, чтоб он выдавал только те фамилии, в которых есть окончание "ский", и при этом приставлял бы приставку Фон. В C++ я бы сделал прокси итератор, который из коллекции смотрит по функции-предикату какая фамилия подходит и если она подходит, то прибавлял бы приставку Фон. В C# аналогичное можно сделать через Linq. А как такое делать в typescript?

20 ответов

25 просмотров

Please send me C++ code.

The Pressbraker- Автор вопроса
Jey Holand
Please send me C++ code.

http://www.math.rs/files/ivan-cukic-phd.pdf See 2.3.1.6 Proxy iterators. They are for transform values "on fly", so you put normal iterator to proxy-iterator and also put transform function that will be use inside proxy iterator to change inputting values to outputing values on the fly

The Pressbraker
http://www.math.rs/files/ivan-cukic-phd.pdf See ...

class TransformIterator<Iter, Func> { constructor(private m_iterator: Iter, private m_func: Func) {} [Symbol.iterator]() { return this; } next() { const value = this.m_func(this.m_iterator.next().value); return { value, done: false }; } } function transform<Iter, Func>(iter: Iter, func: Func) { return new TransformIterator(iter, func); } In TypeScript, we can implement an iterator by defining a class with a next method, which returns the next value in the sequence. The Symbol.iterator and next methods are used to make the iterator iterable. The TransformIterator class takes two generic parameters (Iter and Func) representing the type of the input iterator and the transformation function, respectively. It encapsulates the input iterator and the transformation function, and implements the iterator protocol. The transform function takes an iterator (iter) and a function (func) as parameters, and returns a new instance of the TransformIterator class. Please note that TypeScript does not have a direct equivalent for the std::invoke function in C++. In this code, the transformation function m_func is directly invoked with the value from the input iterator m_iterator.

The Pressbraker- Автор вопроса
Jey Holand
where are u from?

I am from Russia. Between Moscow and Vladimir there is small Orehovo-Zouevo town. I am here now. But my work requiring a lot traveling. So very often I am on road because I am field service man in cnc machine tools area (repairing).

The Pressbraker- Автор вопроса
Jey Holand
What is your skill?

I am repairman of cnc machines like pressbrakes and punch presses ans so on

The Pressbraker- Автор вопроса
Jey Holand
Why do you study TypeScript?

I have to make the game with Cocos Creator game engine. It requires typescript only. Before I was thinking to use Unity, but changed to Cocos Creator (very similar to Unity, but open sourced and no fees against Unity).

The Pressbraker- Автор вопроса
Jey Holand
How much have you tasks?

A little bit. To get learned myself and after to teach my son.

The Pressbraker- Автор вопроса
Jey Holand
I understood. Could you get the task?

It's hard for me to say in advance without knowing what the task is

The Pressbraker
It's hard for me to say in advance without knowing...

I want to earn the money. So I need to development web site or web project.

The Pressbraker- Автор вопроса
Jey Holand
I want to earn the money. So I need to development...

I don't know well react or angular yet. I am sorry. It seems I am not ready for your task at the moment. But you can touch me later!

The Pressbraker- Автор вопроса
Jey Holand
class TransformIterator<Iter, Func> { construc...

Function.prototype.call is pretty much the same as std::invoke, isn't it?

Jey Holand
class TransformIterator<Iter, Func> { construc...

next() { const result = this.m_iterator.next(); if (result.done) { return { value: undefined, done: true }; } const value = this.m_func(result.value); return { value, done: false }; }

Похожие вопросы

Обсуждают сегодня

а зачем этот вопрос для удаления из чата?
Mёdkinson Medvezhkin
63
Всем привет! Подскажите. Я написал приложение на Delphi 10.2 Tokyo под Windows 10. И передо мной стал вопрос о том чтобы сделать это приложение кроссплатформенным (под Linux и...
Дмитрий Завгородний
24
Привет всем. Подскажите где можно посмотреть, какая версия электрон, поддерживает версии windows? Некий changelog. Мне бы желательно, поддержку 7,8,10... latest, как понимаю и...
Anonym Squad
21
Портфолио: Зовут меня Александр, мне 36 лет. Город Пушкино. Общий рабочий стаж: ~14 лет Уровень квалификации: Senior Full-stack developer Где прочесть мой код? https://github....
Magic
10
Не ну фпц - это уже просто троллинг какой-то. Элементарный код нельзя собрать. ЧЯДНТ? program Project1; {$mode delphi} uses SysUtils, Classes, Generics.Collections; var...
Peter
4
а где есть mysql cloud кроме яндекс-клауд?
Oleg Nosov
13
Есть ли смысл устраиваться на 1с ? Даст это плюс в дальнейшем трудоустройстве на php? Просто у меня в городе вакансий на пхп нету. Или лучше удаленно искать. Опыта работы нету...
Azamat
13
hi im a cs student. i need some advice from people who have enough experience in Embedded Software. I need to know whether this profession is suitable for me. I have watched s...
Sahand 🏔️
8
А кто-нибудь запихивал сборку перловых модулей/образов с perl приложениями в окружения без интернета (в специализированном CI/CD)? У меня сейчас есть ряд cpanfile, которые н...
Andrey Smirnov / 𝓪𝓵𝓵𝓽𝓮𝓻 /
14
Кстати а покупал кто-нибудь ЭЦП для подписи кода? А то у меня на некоторых компах и ОС иногда SmartScreen винды программу за вирус принимал. Если купить такую ЭЦП и подписыват...
Дмитрий Завгородний
15
Карта сайта