{"id":341988,"date":"2022-12-01T03:00:05","date_gmt":"2022-12-01T03:00:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=341988"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=341988","title":{"rendered":"<span>NFun \u2014 expression evaluator \u0434\u043b\u044f .Net<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: <a href=\"https:\/\/github.com\/tmteam\/NFun\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/tmteam\/NFun<\/a><\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f: <a href=\"https:\/\/github.com\/tmteam\/NFun\/blob\/master\/README.md\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/tmteam\/NFun\/blob\/master\/README.md<\/a><\/p>\n<h3>\u0427\u0442\u043e \u0435\u0441\u0442\u044c &#171;Expression evaluator&#187; ?<\/h3>\n<p>Expression evaluator \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<ul>\n<li>\n<p><code>12*3<\/code> \u044d\u0442\u043e 36<\/p>\n<\/li>\n<li>\n<p><code>[1,2,3].reverse()<\/code> \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 [3,2,1]<\/p>\n<\/li>\n<li>\n<p><code>'Kate'.reverse()<\/code> \u044d\u0442\u043e &#171;etaK&#187;<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445:<\/p>\n<ul>\n<li>\n<p><code>10*x + 4<\/code> \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>x<\/code>. <\/p>\n<\/li>\n<li>\n<p><code>'My name is {userName}. Age is {2022-birthYear}'<\/code> \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 <code>userName<\/code> \u0438 <code>birthYear<\/code>.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1d9\/3c6\/a72\/1d93c6a722d2a38902e56e249319e00e.png\" alt=\"Nfun \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 scada - \u0441\u0438\u0441\u0442\u0435\u043c\u044b Sonica\" title=\"Nfun \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 scada - \u0441\u0438\u0441\u0442\u0435\u043c\u044b Sonica\" width=\"1092\" height=\"312\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1d9\/3c6\/a72\/1d93c6a722d2a38902e56e249319e00e.png\"\/><figcaption>Nfun \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 scada &#8212; \u0441\u0438\u0441\u0442\u0435\u043c\u044b Sonica<\/figcaption><\/figure>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043a\u0438\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439:<\/p>\n<pre><code class=\"python\">x = Vx*t y = Vy*t  distance = sqrt(x**2 + y**2) average = (x+y)\/2<\/code><\/pre>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Nfun \u0432\u0435\u0437\u0434\u0435, \u0433\u0434\u0435 \u0440\u0430\u043d\u044c\u0448\u0435 \u0432\u044b \u0445\u0440\u0430\u043d\u0438\u043b\u0438, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u043b\u0438 \u0438\u043b\u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043b\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0438\u0436\u0435, \u043c\u044b \u0444\u043e\u0440\u043c\u0443\u043b\u044c\u043d\u043e \u0437\u0430\u0434\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043d\u0430\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0431\u043e\u043d\u0443\u0441\u043e\u0432<\/p>\n<pre><code class=\"json\">\/\/ ...`settings.json`... {     \"offset\": \"25\",     \"timeOffset\": \"3* 60 * 60 * 24 #sec\",     \"condition\": \"if (age>18) isEmpty(orders) else isEmpty(parent.orders)\",     \"bonus\": \"(min(max(order.price, 20.0), 100) + prevBonus)\/ordersCount\" }<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>Backend: \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>Embeded: \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043b\u043e\u044f\u043b\u044c\u043d\u043e\u0441\u0442\u0438: \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0431\u043e\u043d\u0443\u0441\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/p>\n<\/li>\n<li>\n<p>\u0420\u043e\u0431\u043e\u0442\u043e\u0442\u0435\u0445\u043d\u0438\u043a\u0430: \u043a\u0438\u043d\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c. \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0439<\/p>\n<\/li>\n<li>\n<p>Low-code \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<h3>\u0427\u0442\u043e  \u0443\u043c\u0435\u0435\u0442 NFun<\/h3>\n<p>Nfun \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0438\u0434\u0435\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/github.com\/sklose\/NCalc2\" rel=\"noopener noreferrer nofollow\">Ncalc<\/a>, \u043d\u043e \u0434\u043b\u044f \u0431\u043e\u0433\u0430\u0442\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0442\u0438\u043f\u043e\u0432<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b &#8212; <code>byte<\/code>, <code>u16<\/code>, <code>u32<\/code>, <code>u64<\/code>, <code>i16<\/code>, <code>i32<\/code>, <code>i64<\/code>, <code>real<\/code>, <code>bool<\/code>, <code>ip<\/code>, <code>char<\/code>, <code>text<\/code>, <code>any<\/code><\/p>\n<\/li>\n<li>\n<p>\u041c\u0430\u0441\u0441\u0438\u0432\u044b, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043b\u044f\u043c\u0431\u0434\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 Linq<\/p>\n<\/li>\n<li>\n<p>\u0410\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435, \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435, \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b, \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u043b\u043e\u0432\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>if<\/code><\/p>\n<\/li>\n<li>\n<p>\u0418\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044f \u0441\u0442\u0440\u043e\u043a<\/p>\n<\/li>\n<li>\n<p>\u0418\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u0421\u0442\u0440\u043e\u0433\u0430\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f \u0441 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u0442\u0438\u043f\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0438<\/p>\n<\/li>\n<\/ul>\n<h2>Playground<\/h2>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 nuget \u043f\u0430\u043a\u0435\u0442 <code>NFun<\/code> <\/p>\n<p><code>PM> Install-Package NFun<\/code><\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043a\u043b\u0430\u0441\u0441\u0438\u043a\u0438!<\/p>\n<pre><code class=\"cs\">var a = Funny.Calc(\"'Hello world'\"); Console.WriteLine(a);<\/code><\/pre>\n<p>\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/p>\n<pre><code class=\"cs\">bool   b = Funny.Calc&lt;bool>(\"false and (2 > 1)\"); \/\/ false of bool   double d = Funny.Calc&lt;double>(\" 2 * 10 + 1 \"); \/\/ 21  of double   int    i = Funny.Calc&lt;int>(\" 2 * 10 + 1 \"); \/\/ 21 of int<\/code><\/pre>\n<p>\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 <\/p>\n<pre><code class=\"cs\">class User { public string Age {get;set;} public string Name {get;set;} }  var inputUser = new User{ Age = 42; Name = \"Ivan\"; }  string userAlias =      Funny.Calc&lt;User,string> (          \"if(age &lt; 18) name else 'Mr. {name}' \",          inputUser);   <\/code><\/pre>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u0440\u0435\u0436\u0438\u043c \u0445\u0430\u0440\u0434\u043a\u043e\u0440\u0430. \u042d\u0442\u043e\u0442 \u0440\u0435\u0436\u0438\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c, \u0438 \u043a \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044e \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u043d\u0438\u0437\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435<\/p>\n<pre><code class=\"cs\">var runtime = Funny.Hardcore.Build(     \"y = a-b; \" +     \"out = 2*y\/(a+b)\" ); \/\/ Set inputs runtime[\"a\"].Value = 30; runtime[\"b\"].Value = 20; \/\/ Run script runtime.Run(); \/\/ Get outputs Assert.AreEqual(0.4, runtime[\"out\"].Value); <\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c &#8230;<\/summary>\n<div class=\"spoiler__content\">\n<h4>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445<\/h4>\n<pre><code class=\"cs\">\/\/ Assume we have some \u0421# model \/*     class SomeModel {         public SomeModel(int age, Car[] cars) {             Age = age;             Cars = cars;         }         public int Age { get; }    \/\/Used as input         public Car[] Cars { get; } \/\/Used as input         public bool Adult { get; set; }   \/\/Used as output         public double Price { get; set; } \/\/Used as output     } *\/  var context =  new SomeModel(   age:42,    cars: new []{ new Car{ Price = 6000 }, new Car{ Price = 6200 }} );  \/\/ then we can set the 'Adult' and 'Price' properties based on the value of the 'Age' and 'Cars' properties Funny.CalcContext(     @\"           adult = age>18         price = cars.sum(rule it.price)     \",     context); Assert.AreEqual(true, context.Adult); Assert.AreEqual(12200, context.Price); \/\/ So input values and output values are properties of the same object<\/code><\/pre>\n<h4>\u041a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<p>Nfun \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u0438 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0438 \u043f\u043e\u0434 \u0432\u0430\u0448\u0438 \u043d\u0443\u0436\u0434\u044b<br \/> &#8212; \u0417\u0430\u043f\u0440\u0435\u0442 \u0438\u043b\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 if-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439<br \/> &#8212; Decimal \u0438\u043b\u0438 Double \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430<br \/> &#8212; Integer overflow \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f<br \/> &#8212; \u0417\u0430\u043f\u0440\u0435\u0442 \u0438\u043b\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<br \/> &#8212; \u0422\u0438\u043f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442<\/p>\n<pre><code class=\"cs\">var uintResult = Funny         .WithDialect(integerOverflow: IntegerOverflow.Unchecked)         .Calc&lt;uint>(\"0xFFFF_FFFF + 1\");     Assert.AreEqual((uint)0, uintResult);   \/\/now you cannot launch script with such an expression var builder = Funny.WithDialect(IfExpressionSetup.Deny); Assert.Throws&lt;FunnyParseException>(   () => builder.Calc(\"if(2&lt;1) true else false\"));<\/code><\/pre>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442<\/h4>\n<pre><code class=\"cs\">\/\/assume we have custom function (method or Func&lt;...>) Func&lt;int, int, int> myFunctionMin = (i1, i2) => Math.Min(i1, i2);  object a = Funny             .WithConstant(\"foo\", 42)             .WithFunction(\"myMin\", myFunctionMin)             \/\/ now you can use 'myMin' function and 'foo' constant in script!             .Calc(\"myMin(foo,123) == foo\"); Assert.AreEqual(true, a);<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441<\/h2>\n<p>Nfun \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043e\u0434\u043d\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/p>\n<pre><code class=\"python\">12 * x**3 - 3<\/code><\/pre>\n<p>\u041c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/p>\n<pre><code class=\"cs\">nameStr = 'My name is: \"{name}\"' ageStr = 'My age is {age}' result = '{nameStr}. {ageStr}'<\/code><\/pre>\n<p>\u0418 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <\/p>\n<pre><code class=\"python\">maxOf3(a,b,c) = max(max(a,b),c)  y = maxOf3(1,2,3) # 3<\/code><\/pre>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0437\u0430\u0434\u0430\u0447\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u044d\u0442\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441<\/summary>\n<div class=\"spoiler__content\">\n<h4>\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b<\/h4>\n<pre><code class=\"python\"># Arithmetic operators: + - * \/ % \/\/ **  y1 = 2*(x\/\/2 + 1) \/ (x % 3 -1)**0.5  # Bitwise:     ~ | &amp; ^ &lt;&lt; >> y2 = (x | y &amp; 0xF0FF &lt;&lt; 2) ^ 0x1234  # Discreet:    and or not > >= &lt; &lt;= == != y3 = x and false or not (y>0)<\/code><\/pre>\n<h4>If-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/h4>\n<pre><code class=\"python\">simple  = if (x>0) x else if (x==0) 0 else -1 complex = if (age>18)             if (weight>100) 1             if (weight>50)  2             else 3         if (age>16) 0         else       -1<\/code><\/pre>\n<h4>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u0430\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430<\/h4>\n<pre><code class=\"python\">sum3(a,b,c) = a+b+c #define generic user function sum3  r:real = sum3(1,2,3)  i:int  = sum3(1,2,3)<\/code><\/pre>\n<h4>\u041c\u0430\u0441\u0441\u0438\u0432\u044b<\/h4>\n<pre><code class=\"python\"># \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f a:int[] = [1,2,3,4]      # [1,2,3,4]  type: int[] b = ['a','b','foo']# ['a','b','foo'] type: text[] c = [1..4]    # [1,2,3,4]  type: int[] d = [1..7 step 2]      # [1,3,5,7]  type: int[]  # \u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 In a = 1 in [1,2,3,4]# true  # \u0427\u0442\u0435\u043d\u0438\u0435 c = (x[5]+ x[4])\/3  # \u0421\u0440\u0435\u0437\u044b y = [0..10][1:3] #[1,2,3] y = [0..10][7:]  #[7,8,9,10] y = [0..10][:2]  #[0,1,2] y = [0..10][1:5 step 2] #[1,3,5]  # \u0424\u0443\u043d\u043a\u0446\u0438\u0438 # concat, intersect, except, unite, unique, find, max, min, avg, median, sum, count, any, sort, reverse, chunk, fold, repeat<\/code><\/pre>\n<h4>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b<\/h4>\n<pre><code class=\"python\"># initialization user = {     age = 12,      name = 'Kate'     cars = [ # array of structures         { name = 'Creta',   id = 112, power = 140, price = 5000},         { name = 'Camaro', id = 113, power = 353, price = 10000}      ] } userName = user.name # field access<\/code><\/pre>\n<h4>\u0421\u0442\u0440\u043e\u043a\u0438<\/h4>\n<pre><code class=\"python\">a =  ['one', 'two', 'three'].join(', ') # \"one, two, three\" of String  # Interpolation: x = 42 out = '21*2= {x}, arr = {[1,2,x]}'  #\"21*2= 42, arr = [1,2,42]\" of String<\/code><\/pre>\n<h4>Linq (\u043b\u044f\u043c\u0431\u0434\u044b)<\/h4>\n<pre><code class=\"python\">[1,2,3,4]     .filter(rule it>2)     .map(rule it**3)     .max() # 64   <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0421\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0430<\/h2>\n<p>Nfun \u0441\u0442\u0440\u043e\u0433\u043e \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d &#8212; \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0432\u044b\u0437\u043e\u0432\u043e\u043c, \u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u0447\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0432 C#, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 \u043e\u0448\u0438\u0431\u043e\u043a. \u041e\u0434\u043d\u0430\u043a\u043e, \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u044f\u0437\u044b\u043a\u043e\u0432 \u0441\u043e \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043b\u043e\u0436\u043d\u0435\u0435. <\/p>\n<p>\u0427\u0442\u043e \u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u044f \u043e\u043f\u0438\u0440\u0430\u043b\u0441\u044f \u043d\u0430 \u043f\u043e\u0441\u0442\u0443\u043b\u0430\u0442: <\/p>\n<blockquote>\n<p>\u0412\u0441\u0435, \u0447\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 (\u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430\/\u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0438) &#8212; \u0434\u043e\u043b\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f<\/p>\n<\/blockquote>\n<p>\u0418\u043b\u0438, \u0431\u043e\u043b\u0435\u0435 \u0444\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e<\/p>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u0441\u043b\u0430\u0431\u043e-\u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a, \u0437\u043d\u0430\u0447\u0438\u0442 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0442\u0438\u043f\u044b.   <\/p>\n<p>\u041b\u0438\u0431\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<\/blockquote>\n<p>\u042d\u0442\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u044f \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0430 \u044f\u0437\u044b\u043a\u0430. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u044d\u0442\u043e\u0433\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0432\u0441\u0435\u043c\u0435\u0441\u0442\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Generic-\u043e\u0432.<\/p>\n<p> \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0438\u0436\u0435 &#8212; \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u0438 \u0434\u0430\u0436\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b &#8212; \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 (\u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 <code>int32<\/code>, <code>uint32<\/code>, <code>int64<\/code>, <code>uint64<\/code>, <code>real<\/code>). \u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0431 \u044d\u0442\u043e\u043c<\/p>\n<pre><code class=\"cs\">var expr = @\"   # generic function   inc(a) = a + 1      # generic calculation   out = 42.inc().inc() \"; double d = Funny.Calc&lt;double>(expr); \/\/ 44  of double   int    i = Funny.Calc&lt;int>(expr); \/\/ 44 of int<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0442\u0438\u043f\u044b \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u0441\u0445\u043e\u0434\u044f\u0442\u0441\u044f &#8212; \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0442\u0438\u043f\u044b \u043d\u0435 \u0441\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0441 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u043c\u0438 C# \u0442\u0438\u043f\u0430\u043c\u0438 &#8212; \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c <\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0434\u043b\u044f \u043d\u0435\u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f!<\/p>\n<h2>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438<\/h2>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a Nfun \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u044d\u0442\u043e &#8212; &#171;\u043f\u043e\u0447\u0442\u0438 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f&#187;, \u0442\u043e \u0435\u0433\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430. \u041d\u0435 \u0431\u0443\u0434\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0435\u0435 \u0437\u0434\u0435\u0441\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e, \u043e\u0431 \u044d\u0442\u043e\u043c \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0435\u0439.<\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0438\u0442\u0430\u0446\u0438\u044e \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u0430\u043f\u043e\u0432:<\/p>\n<p>1. \u0422\u043e\u043a\u0435\u043d\u0438\u0437\u0430\u0446\u0438\u044f (\u043b\u0435\u043a\u0441\u0435\u0440). <\/p>\n<p>\u0421\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u044b\u0439 \u043b\u0435\u043a\u0441\u0435\u0440 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u0442 \u0432\u0445\u043e\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0430 \u0442\u043e\u043a\u0435\u043d\u044b, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 \u0441\u0442\u0440\u043e\u043a.<\/p>\n<p>2. \u041f\u0430\u0440\u0441\u0438\u043d\u0433<\/p>\n<p>\u0420\u0430\u0437\u0431\u043e\u0440 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0432 \u0434\u0435\u0440\u0435\u0432\u043e AST. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0435\u0440.  \u0421\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u043e\u043f\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u044f\u0437\u044b\u043a\u0430 (\u0438 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432). \u0424\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0430 \u043d\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0430.<\/p>\n<p>3. \u0412\u044b\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432<\/p>\n<p>\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439, \u0433\u0440\u0430\u0444\u043e\u0432\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432, \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043d\u0435\u044f\u0432\u043d\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u0442\u0438\u043f\u0430\u043c\u0438. <\/p>\n<p>\u041d\u044e\u0430\u043d\u0441\u044b:<\/p>\n<ul>\n<li>\n<p>\u0426\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f &#171;\u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u043c\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430\u043c\u0438&#187;<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">one() = 1 # returns T, where byte -> T -> real   y:int  = one() # 1 of int z:real = one() # 1.0 of real<\/code><\/pre>\n<ul>\n<li>\n<p>\u0422\u0438\u043f \u0443\u0437\u043b\u0430 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c, \u043a\u0430\u043a \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e, \u0442\u0430\u043a \u0438 \u043e\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">y = 1 # y:real, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u0435 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 x:real = 1\/y<\/code><\/pre>\n<ul>\n<li>\n<p>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a-\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u044b, \u043a\u0430\u043a \u0441\u0432\u0435\u0440\u0445\u0443 (\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435, \u0442\u0438\u043f \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0439), \u0442\u0430\u043a \u0438 \u0441\u043d\u0438\u0437\u0443 ( \u043f\u043e\u0442\u043e\u043c\u043e\u043a, \u0442\u0438\u043f, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043a \u0434\u0430\u043d\u043d\u043e\u043c\u0443)<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">sum(a,b) = a+b  x:int  = 1 + 2  # x = 3 of int y:real = 1 + 2 # y = 3.0 of real z:byte = 1 + 2 # error! operator '+' is defined for (uint16|int16)-> T -> real                # so it cannot return 'byte'<\/code><\/pre>\n<p>4. \u0421\u0431\u043e\u0440\u043a\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 (\u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430)<\/p>\n<p>\u0418\u0437  \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0438 Ast-\u0434\u0435\u0440\u0435\u0432\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439.<\/p>\n<ol start=\"5\">\n<li>\n<p>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f CLR-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 Nfun <\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432 CLR \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<\/ol>\n<p>\u042f \u0441\u043e\u0437\u043d\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b Csharp-expression-tree, \u0442\u0430\u043a \u043a\u0430\u043a, \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0438\u0445 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0435\u0432 \u0431\u044b\u043b\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c &#171;one-time-shot&#187;. \u0422\u043e \u0435\u0441\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0430, \u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0441\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u0438 \u0434\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<h2>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h2>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 \u0433\u043e\u0442\u043e\u0432 \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u0433\u043e\u0434\u0430 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 scada-\u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043f\u043e\u043a\u0440\u044b\u0442 6000+ \u0442\u0435\u0441\u0442\u0430\u043c\u0438, \u043a \u043d\u0435\u043c\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f, \u0438..  \u0434\u0430\u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0432\u0435\u0437\u0434\u043e\u0447\u0435\u043a \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431\u0435 (\u0434\u0430-\u0434\u0430, \u044d\u0442\u043e call to action!). \u041f\u043e\u0447\u0442\u0438 \u0443\u0441\u043f\u0435\u0445!<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041a\u043e\u0433\u0434\u0430 \u044f \u043d\u0430\u0447\u0438\u043d\u0430\u043b Nfun, \u044f \u043c\u0435\u0447\u0442\u0430\u043b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0438 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u044b\u0439 \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441-\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u042f \u0445\u043e\u0442\u0435\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438\u0434\u0435\u0438 \u0438 \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0435\u043c\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432, \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435&#8230;<\/p>\n<p>\u041f\u043e \u0438\u0442\u043e\u0433\u0443, Nfun \u0441\u0442\u043e\u0438\u043b \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0438\u043b, \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0438\u043d\u0432\u0435\u0441\u0442\u0438\u0433\u0430\u0446\u0438\u0439. \u042f \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043b\u044e\u0434\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u044d\u0442\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c! \u0418 \u043f\u0438\u0441\u0430\u043b\u0438 \u0442\u0438\u043a\u0435\u0442\u044b, \u0434\u0430 \u0440\u0435\u043a\u0432\u0435\u0441\u0442\u044b \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431. \u041d\u0443, \u0438\u043b\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043f\u043e\u0434 \u044d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442 \ud83d\ude09<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/698190\/\"> https:\/\/habr.com\/ru\/post\/698190\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: <a href=\"https:\/\/github.com\/tmteam\/NFun\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/tmteam\/NFun<\/a><\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f: <a href=\"https:\/\/github.com\/tmteam\/NFun\/blob\/master\/README.md\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/tmteam\/NFun\/blob\/master\/README.md<\/a><\/p>\n<h3>\u0427\u0442\u043e \u0435\u0441\u0442\u044c &#171;Expression evaluator&#187; ?<\/h3>\n<p>Expression evaluator \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<ul>\n<li>\n<p><code>12*3<\/code> \u044d\u0442\u043e 36<\/p>\n<\/li>\n<li>\n<p><code>[1,2,3].reverse()<\/code> \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 [3,2,1]<\/p>\n<\/li>\n<li>\n<p><code>'Kate'.reverse()<\/code> \u044d\u0442\u043e &#171;etaK&#187;<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445:<\/p>\n<ul>\n<li>\n<p><code>10*x + 4<\/code> \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>x<\/code>. <\/p>\n<\/li>\n<li>\n<p><code>'My name is {userName}. Age is {2022-birthYear}'<\/code> \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 <code>userName<\/code> \u0438 <code>birthYear<\/code>.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><figcaption>Nfun \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 scada &#8212; \u0441\u0438\u0441\u0442\u0435\u043c\u044b Sonica<\/figcaption><\/figure>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043a\u0438\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439:<\/p>\n<pre><code class=\"python\">x = Vx*t y = Vy*t  distance = sqrt(x**2 + y**2) average = (x+y)\/2<\/code><\/pre>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Nfun \u0432\u0435\u0437\u0434\u0435, \u0433\u0434\u0435 \u0440\u0430\u043d\u044c\u0448\u0435 \u0432\u044b \u0445\u0440\u0430\u043d\u0438\u043b\u0438, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u043b\u0438 \u0438\u043b\u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043b\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0438\u0436\u0435, \u043c\u044b \u0444\u043e\u0440\u043c\u0443\u043b\u044c\u043d\u043e \u0437\u0430\u0434\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043d\u0430\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0431\u043e\u043d\u0443\u0441\u043e\u0432<\/p>\n<pre><code class=\"json\">\/\/ ...`settings.json`... {     \"offset\": \"25\",     \"timeOffset\": \"3* 60 * 60 * 24 #sec\",     \"condition\": \"if (age>18) isEmpty(orders) else isEmpty(parent.orders)\",     \"bonus\": \"(min(max(order.price, 20.0), 100) + prevBonus)\/ordersCount\" }<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>Backend: \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>Embeded: \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043b\u043e\u044f\u043b\u044c\u043d\u043e\u0441\u0442\u0438: \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0431\u043e\u043d\u0443\u0441\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/p>\n<\/li>\n<li>\n<p>\u0420\u043e\u0431\u043e\u0442\u043e\u0442\u0435\u0445\u043d\u0438\u043a\u0430: \u043a\u0438\u043d\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c. \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0439<\/p>\n<\/li>\n<li>\n<p>Low-code \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<h3>\u0427\u0442\u043e  \u0443\u043c\u0435\u0435\u0442 NFun<\/h3>\n<p>Nfun \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0438\u0434\u0435\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/github.com\/sklose\/NCalc2\" rel=\"noopener noreferrer nofollow\">Ncalc<\/a>, \u043d\u043e \u0434\u043b\u044f \u0431\u043e\u0433\u0430\u0442\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0442\u0438\u043f\u043e\u0432<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b &#8212; <code>byte<\/code>, <code>u16<\/code>, <code>u32<\/code>, <code>u64<\/code>, <code>i16<\/code>, <code>i32<\/code>, <code>i64<\/code>, <code>real<\/code>, <code>bool<\/code>, <code>ip<\/code>, <code>char<\/code>, <code>text<\/code>, <code>any<\/code><\/p>\n<\/li>\n<li>\n<p>\u041c\u0430\u0441\u0441\u0438\u0432\u044b, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043b\u044f\u043c\u0431\u0434\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 Linq<\/p>\n<\/li>\n<li>\n<p>\u0410\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435, \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435, \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b, \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u043b\u043e\u0432\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>if<\/code><\/p>\n<\/li>\n<li>\n<p>\u0418\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044f \u0441\u0442\u0440\u043e\u043a<\/p>\n<\/li>\n<li>\n<p>\u0418\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u0421\u0442\u0440\u043e\u0433\u0430\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f \u0441 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u0442\u0438\u043f\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0438<\/p>\n<\/li>\n<\/ul>\n<h2>Playground<\/h2>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 nuget \u043f\u0430\u043a\u0435\u0442 <code>NFun<\/code> <\/p>\n<p><code>PM> Install-Package NFun<\/code><\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043a\u043b\u0430\u0441\u0441\u0438\u043a\u0438!<\/p>\n<pre><code class=\"cs\">var a = Funny.Calc(\"'Hello world'\"); Console.WriteLine(a);<\/code><\/pre>\n<p>\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/p>\n<pre><code class=\"cs\">bool   b = Funny.Calc&lt;bool>(\"false and (2 > 1)\"); \/\/ false of bool   double d = Funny.Calc&lt;double>(\" 2 * 10 + 1 \"); \/\/ 21  of double   int    i = Funny.Calc&lt;int>(\" 2 * 10 + 1 \"); \/\/ 21 of int<\/code><\/pre>\n<p>\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 <\/p>\n<pre><code class=\"cs\">class User { public string Age {get;set;} public string Name {get;set;} }  var inputUser = new User{ Age = 42; Name = \"Ivan\"; }  string userAlias =      Funny.Calc&lt;User,string> (          \"if(age &lt; 18) name else 'Mr. {name}' \",          inputUser);   <\/code><\/pre>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u0440\u0435\u0436\u0438\u043c \u0445\u0430\u0440\u0434\u043a\u043e\u0440\u0430. \u042d\u0442\u043e\u0442 \u0440\u0435\u0436\u0438\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c, \u0438 \u043a \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044e \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u043d\u0438\u0437\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435<\/p>\n<pre><code class=\"cs\">var runtime = Funny.Hardcore.Build(     \"y = a-b; \" +     \"out = 2*y\/(a+b)\" ); \/\/ Set inputs runtime[\"a\"].Value = 30; runtime[\"b\"].Value = 20; \/\/ Run script runtime.Run(); \/\/ Get outputs Assert.AreEqual(0.4, runtime[\"out\"].Value); <\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c &#8230;<\/summary>\n<div class=\"spoiler__content\">\n<h4>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445<\/h4>\n<pre><code class=\"cs\">\/\/ Assume we have some \u0421# model \/*     class SomeModel {         public SomeModel(int age, Car[] cars) {             Age = age;             Cars = cars;         }         public int Age { get; }    \/\/Used as input         public Car[] Cars { get; } \/\/Used as input         public bool Adult { get; set; }   \/\/Used as output         public double Price { get; set; } \/\/Used as output     } *\/  var context =  new SomeModel(   age:42,    cars: new []{ new Car{ Price = 6000 }, new Car{ Price = 6200 }} );  \/\/ then we can set the 'Adult' and 'Price' properties based on the value of the 'Age' and 'Cars' properties Funny.CalcContext(     @\"           adult = age>18         price = cars.sum(rule it.price)     \",     context); Assert.AreEqual(true, context.Adult); Assert.AreEqual(12200, context.Price); \/\/ So input values and output values are properties of the same object<\/code><\/pre>\n<h4>\u041a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<p>Nfun \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u0438 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0438 \u043f\u043e\u0434 \u0432\u0430\u0448\u0438 \u043d\u0443\u0436\u0434\u044b<br \/> &#8212; \u0417\u0430\u043f\u0440\u0435\u0442 \u0438\u043b\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 if-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439<br \/> &#8212; Decimal \u0438\u043b\u0438 Double \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430<br \/> &#8212; Integer overflow \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f<br \/> &#8212; \u0417\u0430\u043f\u0440\u0435\u0442 \u0438\u043b\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<br \/> &#8212; \u0422\u0438\u043f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442<\/p>\n<pre><code class=\"cs\">var uintResult = Funny         .WithDialect(integerOverflow: IntegerOverflow.Unchecked)         .Calc&lt;uint>(\"0xFFFF_FFFF + 1\");     Assert.AreEqual((uint)0, uintResult);   \/\/now you cannot launch script with such an expression var builder = Funny.WithDialect(IfExpressionSetup.Deny); Assert.Throws&lt;FunnyParseException>(   () => builder.Calc(\"if(2&lt;1) true else false\"));<\/code><\/pre>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442<\/h4>\n<pre><code class=\"cs\">\/\/assume we have custom function (method or Func&lt;...>) Func&lt;int, int, int> myFunctionMin = (i1, i2) => Math.Min(i1, i2);  object a = Funny             .WithConstant(\"foo\", 42)             .WithFunction(\"myMin\", myFunctionMin)             \/\/ now you can use 'myMin' function and 'foo' constant in script!             .Calc(\"myMin(foo,123) == foo\"); Assert.AreEqual(true, a);<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441<\/h2>\n<p>Nfun \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043e\u0434\u043d\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/p>\n<pre><code class=\"python\">12 * x**3 - 3<\/code><\/pre>\n<p>\u041c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/p>\n<pre><code class=\"cs\">nameStr = 'My name is: \"{name}\"' ageStr = 'My age is {age}' result = '{nameStr}. {ageStr}'<\/code><\/pre>\n<p>\u0418 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <\/p>\n<pre><code class=\"python\">maxOf3(a,b,c) = max(max(a,b),c)  y = maxOf3(1,2,3) # 3<\/code><\/pre>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0437\u0430\u0434\u0430\u0447\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u044d\u0442\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441<\/summary>\n<div class=\"spoiler__content\">\n<h4>\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b<\/h4>\n<pre><code class=\"python\"># Arithmetic operators: + - * \/ % \/\/ **  y1 = 2*(x\/\/2 + 1) \/ (x % 3 -1)**0.5  # Bitwise:     ~ | &amp; ^ &lt;&lt; >> y2 = (x | y &amp; 0xF0FF &lt;&lt; 2) ^ 0x1234  # Discreet:    and or not > >= &lt; &lt;= == != y3 = x and false or not (y>0)<\/code><\/pre>\n<h4>If-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/h4>\n<pre><code class=\"python\">simple  = if (x>0) x else if (x==0) 0 else -1 complex = if (age>18)             if (weight>100) 1             if (weight>50)  2             else 3         if (age>16) 0         else       -1<\/code><\/pre>\n<h4>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u0430\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430<\/h4>\n<pre><code class=\"python\">sum3(a,b,c) = a+b+c #define generic user function sum3  r:real = sum3(1,2,3)  i:int  = sum3(1,2,3)<\/code><\/pre>\n<h4>\u041c\u0430\u0441\u0441\u0438\u0432\u044b<\/h4>\n<pre><code class=\"python\"># \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f a:int[] = [1,2,3,4]      # [1,2,3,4]  type: int[] b = ['a','b','foo']# ['a','b','foo'] type: text[] c = [1..4]    # [1,2,3,4]  type: int[] d = [1..7 step 2]      # [1,3,5,7]  type: int[]  # \u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 In a = 1 in [1,2,3,4]# true  # \u0427\u0442\u0435\u043d\u0438\u0435 c = (x[5]+ x[4])\/3  # \u0421\u0440\u0435\u0437\u044b y = [0..10][1:3] #[1,2,3] y = [0..10][7:]  #[7,8,9,10] y = [0..10][:2]  #[0,1,2] y = [0..10][1:5 step 2] #[1,3,5]  # \u0424\u0443\u043d\u043a\u0446\u0438\u0438 # concat, intersect, except, unite, unique, find, max, min, avg, median, sum, count, any, sort, reverse, chunk, fold, repeat<\/code><\/pre>\n<h4>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b<\/h4>\n<pre><code class=\"python\"># initialization user = {     age = 12,      name = 'Kate'     cars = [ # array of structures         { name = 'Creta',   id = 112, power = 140, price = 5000},         { name = 'Camaro', id = 113, power = 353, price = 10000}      ] } userName = user.name # field access<\/code><\/pre>\n<h4>\u0421\u0442\u0440\u043e\u043a\u0438<\/h4>\n<pre><code class=\"python\">a =  ['one', 'two', 'three'].join(', ') # \"one, two, three\" of String  # Interpolation: x = 42 out = '21*2= {x}, arr = {[1,2,x]}'  #\"21*2= 42, arr = [1,2,42]\" of String<\/code><\/pre>\n<h4>Linq (\u043b\u044f\u043c\u0431\u0434\u044b)<\/h4>\n<pre><code class=\"python\">[1,2,3,4]     .filter(rule it>2)     .map(rule it**3)     .max() # 64   <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0421\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0430<\/h2>\n<p>Nfun \u0441\u0442\u0440\u043e\u0433\u043e \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d &#8212; \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0432\u044b\u0437\u043e\u0432\u043e\u043c, \u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0433\u0430\u0440\u043c\u043e\u043d\u0438\u0447\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0432 C#, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 \u043e\u0448\u0438\u0431\u043e\u043a. \u041e\u0434\u043d\u0430\u043a\u043e, \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u044f\u0437\u044b\u043a\u043e\u0432 \u0441\u043e \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043b\u043e\u0436\u043d\u0435\u0435. <\/p>\n<p>\u0427\u0442\u043e \u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u044f \u043e\u043f\u0438\u0440\u0430\u043b\u0441\u044f \u043d\u0430 \u043f\u043e\u0441\u0442\u0443\u043b\u0430\u0442: <\/p>\n<blockquote>\n<p>\u0412\u0441\u0435, \u0447\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 (\u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430\/\u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0438) &#8212; \u0434\u043e\u043b\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f<\/p>\n<\/blockquote>\n<p>\u0418\u043b\u0438, \u0431\u043e\u043b\u0435\u0435 \u0444\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e<\/p>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u0441\u043b\u0430\u0431\u043e-\u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a, \u0437\u043d\u0430\u0447\u0438\u0442 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0442\u0438\u043f\u044b.   <\/p>\n<p>\u041b\u0438\u0431\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<\/blockquote>\n<p>\u042d\u0442\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u044f \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0430 \u044f\u0437\u044b\u043a\u0430. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u044d\u0442\u043e\u0433\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0432\u0441\u0435\u043c\u0435\u0441\u0442\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Generic-\u043e\u0432.<\/p>\n<p> \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0438\u0436\u0435 &#8212; \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u0438 \u0434\u0430\u0436\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b &#8212; \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 (\u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 <code>int32<\/code>, <code>uint32<\/code>, <code>int64<\/code>, <code>uint64<\/code>, <code>real<\/code>). \u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0431 \u044d\u0442\u043e\u043c<\/p>\n<pre><code class=\"cs\">var expr = @\"   # generic function   inc(a) = a + 1      # generic calculation   out = 42.inc().inc() \"; double d = Funny.Calc&lt;double>(expr); \/\/ 44  of double   int    i = Funny.Calc&lt;int>(expr); \/\/ 44 of int<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0442\u0438\u043f\u044b \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u0441\u0445\u043e\u0434\u044f\u0442\u0441\u044f &#8212; \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0442\u0438\u043f\u044b \u043d\u0435 \u0441\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0441 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u043c\u0438 C# \u0442\u0438\u043f\u0430\u043c\u0438 &#8212; \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c <\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0434\u043b\u044f \u043d\u0435\u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f!<\/p>\n<h2>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438<\/h2>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a Nfun \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u044d\u0442\u043e &#8212; &#171;\u043f\u043e\u0447\u0442\u0438 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f&#187;, \u0442\u043e \u0435\u0433\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430. \u041d\u0435 \u0431\u0443\u0434\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0435\u0435 \u0437\u0434\u0435\u0441\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e, \u043e\u0431 \u044d\u0442\u043e\u043c \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0435\u0439.<\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0438\u0442\u0430\u0446\u0438\u044e \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u0430\u043f\u043e\u0432:<\/p>\n<p>1. \u0422\u043e\u043a\u0435\u043d\u0438\u0437\u0430\u0446\u0438\u044f (\u043b\u0435\u043a\u0441\u0435\u0440). <\/p>\n<p>\u0421\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u044b\u0439 \u043b\u0435\u043a\u0441\u0435\u0440 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u0442 \u0432\u0445\u043e\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0430 \u0442\u043e\u043a\u0435\u043d\u044b, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 \u0441\u0442\u0440\u043e\u043a.<\/p>\n<p>2. \u041f\u0430\u0440\u0441\u0438\u043d\u0433<\/p>\n<p>\u0420\u0430\u0437\u0431\u043e\u0440 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0432 \u0434\u0435\u0440\u0435\u0432\u043e AST. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0435\u0440.  \u0421\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u043e\u043f\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u044f\u0437\u044b\u043a\u0430 (\u0438 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432). \u0424\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0430 \u043d\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0430.<\/p>\n<p>3. \u0412\u044b\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432<\/p>\n<p>\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439, \u0433\u0440\u0430\u0444\u043e\u0432\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432, \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043d\u0435\u044f\u0432\u043d\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u0442\u0438\u043f\u0430\u043c\u0438. <\/p>\n<p>\u041d\u044e\u0430\u043d\u0441\u044b:<\/p>\n<ul>\n<li>\n<p>\u0426\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f &#171;\u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u043c\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430\u043c\u0438&#187;<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">one() = 1 # returns T, where byte -> T -> real   y:int  = one() # 1 of int z:real = one() # 1.0 of real<\/code><\/pre>\n<ul>\n<li>\n<p>\u0422\u0438\u043f \u0443\u0437\u043b\u0430 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c, \u043a\u0430\u043a \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e, \u0442\u0430\u043a \u0438 \u043e\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">y = 1 # y:real, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u0435 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 x:real = 1\/y<\/code><\/pre>\n<ul>\n<li>\n<p>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a-\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u044b, \u043a\u0430\u043a \u0441\u0432\u0435\u0440\u0445\u0443 (\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435, \u0442\u0438\u043f \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0439), \u0442\u0430\u043a \u0438 \u0441\u043d\u0438\u0437\u0443 ( \u043f\u043e\u0442\u043e\u043c\u043e\u043a, \u0442\u0438\u043f, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043a \u0434\u0430\u043d\u043d\u043e\u043c\u0443)<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">sum(a,b) = a+b  x:int  = 1 + 2  # x = 3 of int y:real = 1 + 2 # y = 3.0 of real z:byte = 1 + 2 # error! operator '+' is defined for (uint16|int16)-> T -> real                # so it cannot return 'byte'<\/code><\/pre>\n<p>4. \u0421\u0431\u043e\u0440\u043a\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 (\u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430)<\/p>\n<p>\u0418\u0437  \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0438 Ast-\u0434\u0435\u0440\u0435\u0432\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439.<\/p>\n<ol start=\"5\">\n<li>\n<p>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f CLR-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 Nfun <\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432 CLR \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<\/ol>\n<p>\u042f \u0441\u043e\u0437\u043d\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b Csharp-expression-tree, \u0442\u0430\u043a \u043a\u0430\u043a, \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0438\u0445 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0435\u0432 \u0431\u044b\u043b\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c &#171;one-time-shot&#187;.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-341988","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/341988","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=341988"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/341988\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=341988"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=341988"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=341988"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}