крайне поверхностно, так как сразу после C++ начал изучать typescript), конкретно для того, чтоб делать игры на Cocos Creator. А вопросы у меня такие: 1) Есть ли в Typescript ассоциативный массив? Какой это тип? Это map? 2) Как делать выборку из коллекции наподобие LINQ в С# или наподобие прокси-итераторов в C++ (то есть допустим, есть коллекция фамилий, мне надо получить такой итератор, чтоб он выдавал только те фамилии, в которых есть окончание "ский", и при этом приставлял бы приставку Фон. В C++ я бы сделал прокси итератор, который из коллекции смотрит по функции-предикату какая фамилия подходит и если она подходит, то прибавлял бы приставку Фон. В C# аналогичное можно сделать через Linq. А как такое делать в typescript?
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
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.
What is your skill?
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).
I am repairman of cnc machines like pressbrakes and punch presses ans so on
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).
How much have you tasks?
A little bit. To get learned myself and after to teach my son.
I understood. Could you get the task?
It's hard for me to say in advance without knowing what the task is
I want to earn the money. So I need to development web site or web project.
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!
No, You can develop with me and learn from me.
Write me a private message, please.
Function.prototype.call is pretty much the same as std::invoke, isn't it?
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 }; }
Обсуждают сегодня