Search results

  1. A

    Simple python script not resulting in correct result

    Currently, types of class's member variables must be specified inside class definition (not inside __init__!), i.e.: class Test: number : int def __init__(self, number: int): self.number = number ...
  2. A

    Main differences

    The random.randrange(a, b) function, which returns a random number n in the range a <= n < b, and the random.randint(a, b) function, which returns a number in the range a <= n <= b, have been combined into a single function which takes one argument of type "range" (in 11l the range for a <= n <=...
  3. A

    F-string support

    So, I decided to proceed the second way if possible {because it is possible in many cases, including your code}, and proceed the third way otherwise.
  4. A

    My thoughts on UFCS

    "Explicit is better than implicit." ( : The Zen of Python : )
  5. A

    My thoughts on UFCS

    Also parentheses-less methods can replace properties' getters (just like in Ruby): T Value . String val F int_val=(Int new_val) // setter .val = String(new_val) F int_val // getter R Int(.val) Value val val.int_val = 10 // implicit call of `int_val=()` (setter)...
  6. A

    F-string support

    Also I think that f-strings in this code are slightly overused. For example, f"{brackets[0]}" can be written as str(brackets[0]), or just brackets[0].
  7. A

    My thoughts on UFCS

    Can you elaborate on what you mean by this? UFCS feature in itself? Or my statement that this should be denoted explicitly? Or my proposed syntax? Mostly I agree with you, but there are some rare cases when this feature can be useful. Particularly, for extremely short functions, which call...
  8. A

    F-string support

    As I can see, there are no format specifiers in this code at all. Can you look through all of your code, which you wish to compile with Python → 11l → C++ transpiler, and say are there any format specifiers inside f-strings? [Format specifier is a part of replacement field (expression delimited...
  9. A

    My thoughts on UFCS

    [This post is inspired by this article.] This feature is nice, but I strongly believe that this should be denoted explicitly, i.e. if you want to call evenNumbers like this: evenNumbers([1, 2, 3, 4]) then declare it such way: F evenNumbers(Array[Int] arr) R arr.filter(n -> n % 2 == 0)...
  10. A

    F-string support

    Can you bring some examples (maybe links to the source code, if it's open-source)? Currently, Python → 11l transpiler supports Python % formatting (e.g. '%02d: %s' % (1, 's')) and str.format (e.g. '{:02}: {}'.format(1, 's') or '{n:02}: {s}'.format(n = 1, s = 's'), which translates into ‘#02...
  11. A

    Lists with multiple types inside

    You can write something like this:
  12. A

    Основные отличия

    Функция random.randrange(a, b), которая возвращает случайное число n в диапазоне a <= n < b, и функция random.randint(a, b), которая возвращает число в диапазоне a <= n <= b, были объединены в одну функцию, которая принимает один аргумент типа "диапазон" (а диапазон для a <= n <= b в 11l...
  13. A

    Использование транспайлера Python → 11l → C++ при решении олимпиадных задач по программированию

    Эта тема форума предназначена для обсуждения данной статьи. Авторская версия статьи прикреплена к этому сообщению.
  14. A

    How to trans this code to cpp?

    In 9th line of your Python code you assign a list of ints to variable l. But in 40th line l[i] is assigned to input(), which type is str. A similar problem is in lines 43 and 45 with list t. Here is a fixed Python code.
  15. A

    Type cast

    You need not explicitly cast regular expression match to Bool to check if there was any match. Here is an example from here: I re:‘^[a-z]{3,10}’.match(s) words.append(s) And of course you can write this: V match = re:‘^[a-z]{3,10}’.match(s) I match...
  16. A

    Type cast

    Currently, only Python-like explicit type casts are supported (e.g. Int("54") or String(54)). Why do you need this? explicit operator bool() is a replacement of the old safe bool idiom, and it is called in if (match) ... (and in if ((bool)match) ... of course, but it makes no sense to write...
  17. A

    Documentation suggestions

    Ok. I agree.
  18. A

    Documentation suggestions

    Yes, of course. Ok. I accept this suggestions. Ok. I added a new section (‘Built-in global variables’). The documentation of 11l was intentionally made a super brief and a little puzzling. Because I believe that when you guess something by yourself, then it will be remembered much better...
  19. A

    Supported modules

    I have updated transpiler Python → 11l → C++, and made some modifications to exs2sfz.py file, so it can be successfully compiled. Also I performed some performance tests. Here is the results for NaturalKit.exs: Time (in milliseconds) Factor (relative to CPython) CPython 238 1x...
  20. A

    Supported modules

    It prints [when trying to convert BLUTHNER.exs]: RuntimeError: Couldn't locate sample bluthner f c0.6.wav! And RuntimeError: Couldn't locate sample natural_b0_35.wav! for NaturalKit.exs
Top