Exemple #1
0
        public Either <IError, CreateLambdaDto> CreateLambda(CreateLambdaDto createlambda)
        {
            var memoryStream = new MemoryStream();

            createlambda.File.OpenReadStream().CopyTo(memoryStream);


            Message <LambdaMessage> message = new Message <LambdaMessage>("CreateLambda")
            {
                Data = new LambdaMessage()
                {
                    Name    = createlambda.Name,
                    Trigger = createlambda.Trigger,
                    Runtime = createlambda.Runtime,
                    OwnerId = "",
                    ImageId = "",
                    Guid    = ""
                },
                Bytes = new NetMQFrame(memoryStream.ToArray())
            };

            NetMQMessage response = RequestSocketFactory.SendRequest(message.ToNetMQMessage());

            string responseTopic = response.First.ConvertToString();

            if (responseTopic == "Response")
            {
                Message <LambdaMessage> successMessage = new Message <LambdaMessage>(response);
                return(new Right <IError, CreateLambdaDto>(LambdaConverter.LambdaMessageToDto(successMessage.Data)));
            }

            return(new Left <IError, CreateLambdaDto>(GetError(response)));
        }
Exemple #2
0
        public async Task <IEnumerable <UserViewModel> > Get(string keyValues)
        {
            var lymbdaExpression = LambdaConverter.Convert <User>(keyValues);
            var users            = await GetUserViewModelOperation.ExecuteAsync(lymbdaExpression);

            return(users);
        }
        public async Task <IEnumerable <DriverViewModel> > Get(string keyValues)
        {
            var expression = LambdaConverter.Convert <Driver>(keyValues);
            var drivers    = await GetDriverViewModelOperation.ExecuteAsync(expression);

            return(drivers);
        }
Exemple #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            prepareViews();

            calendarSizeDisposable = CalendarContainer.AddObserver(boundsKey, NSKeyValueObservingOptions.New, onCalendarSizeChanged);

            source                  = new ReportsTableViewSource(ReportsTableView);
            source.OnScroll        += onReportsTableScrolled;
            ReportsTableView.Source = source;

            var areThereEnoughWorkspaces = new LambdaConverter <IDictionary <string, IThreadSafeWorkspace>, bool>(workspaces => workspaces.Count > 1);
            var isWorkspaceNameTooLong   = new LambdaConverter <string, bool>(workspaceName =>
            {
                var attributes = new UIStringAttributes {
                    Font = WorkspaceLabel.Font
                };
                var size = new NSString(workspaceName).GetSizeUsingAttributes(attributes);
                return(size.Width >= maximumWorkspaceNameLabelWidth);
            });

            var bindingSet = this.CreateBindingSet <ReportsViewController, ReportsViewModel>();

            bindingSet.Bind(source).To(vm => vm.Segments);
            bindingSet.Bind(titleButton).To(vm => vm.ToggleCalendarCommand);
            bindingSet.Bind(titleButton)
            .For(v => v.BindTitle())
            .To(vm => vm.CurrentDateRangeString);

            bindingSet.Bind(source)
            .For(v => v.ViewModel)
            .To(vm => vm);

            bindingSet.Bind(ReportsTableView)
            .For(v => v.BindTap())
            .To(vm => vm.HideCalendarCommand);

            bindingSet.Bind(WorkspaceButton)
            .For(v => v.BindVisible())
            .To(vm => vm.Workspaces)
            .WithConversion(areThereEnoughWorkspaces);

            bindingSet.Bind(WorkspaceButton)
            .For(v => v.BindTap())
            .To(vm => vm.SelectWorkspace);

            bindingSet.Bind(WorkspaceLabel)
            .To(vm => vm.WorkspaceName);

            bindingSet.Bind(WorkspaceFadeView)
            .For(v => v.FadeRight)
            .To(vm => vm.WorkspaceName)
            .WithConversion(isWorkspaceNameTooLong);

            bindingSet.Apply();
        }
Exemple #5
0
        static void Main(string[] args)
        {
            var input = File.ReadLines("test.in").First();

            File.WriteAllLines("test.out", new string[] { new Reducer().FullReduce(Lambda.Parse(input)).ToString() });

            Console.WriteLine(LambdaConverter.LambdaToUInt32(new Reducer().FullReduce(new Application(new Application(GetL(2), GetL(2)), GetL(2)))));

            return;

            var lambda = Lambda.Parse(@" (\n.\f.\x.f(n f x))(\f.\x.f x) ");

            /* var number = Lambda.Parse(@"\f.\x.x");
             * var increment = Lambda.Parse(@"(\n.\f.\x.f(n f x))");
             * while (true)
             * {
             *   var func = new Application(increment, number);
             *   number = new Reducer().FullReduce(func);
             *   Console.WriteLine(LambdaConverter.LambdaToUInt32(number));
             * }*/

            //Console.WriteLine(LambdaConverter.LambdaToUInt32(new Reducer().FullReduce(Add(53, 51))));

            Console.WriteLine(new Reducer().FullReduce(Lambda.Parse(@"(\y.(\x.x y) y) (\x.x x)")));
            int x = 5;

            Console.WriteLine(new Reducer().FullReduce(Lambda.Parse(@"((\l0.((\l1.((\l2.((\l3.((\l4.((\l5.((\l6.((\l7.((\l8.((\l9.((\l10.(l10 (\l11.(\l12.(l11 (l11 (l11 (l11 (l11 (l11 (l11 (l11 (l11 (l11 (l11 (l11 (l11 l12))))))))))))))))) (\l10.((l0 (\l11.(\l12.(\l13.(\l14.((\l15.(((l1 (l8 l15)) (\l16.(\l17.(l16 l17)))) ((l6 (((l11 l15) ((l11 (\l16.(\l17.(l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 l17))))))))))))))))))))))))))))))))))))))))))))))))))))) (\l16.(\l17.l17)))) (l11 (\l16.(\l17.(l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 l17))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) (((l11 (l4 l15)) (((l11 (\l16.(\l17.(l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 l17))))))))))))))))))))))))))))))))))))))))))) (\l16.(\l17.l17))) (\l16.(\l17.l17)))) (((l11 (\l16.(\l17.(l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 (l16 l17))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) (\l16.(\l17.l17))) (\l16.(\l17.l17))))))) (l4 l12))))))) l10)))) (l0 (\l9.(\l10.(\l11.((\l12.((\l13.(((l1 l12) l13) (((l1 l13) l12) ((l9 (l4 l10)) (l4 l11))))) (l8 l11))) (l8 l10)))))))) (\l8.((l8 (\l9.l3)) l2)))) (\l7.(\l8.((l8 l4) l7))))) (\l6.(\l7.((l6 l5) l7))))) (\l5.(\l6.(\l7.((l5 l6) (l6 l7))))))) (\l4.(\l5.(\l6.(((l4 (\l7.(\l8.(l8 (l7 l5))))) (\l7.l6)) (\l7.l7))))))) (\l3.(\l4.l4)))) (\l2.(\l3.l2)))) (\l1.(\l2.(\l3.((l1 l2) l3)))))) (\l0.((\l1.(l0 (l1 l1))) (\l1.(l0 (l1 l1))))))")));
            // Console.WriteLine(LambdaConverter.LambdaToUInt32(new Reducer().FullReduce(new Application(GetL(2), GetL(5)))));

            ///
            /// \f.(\x.(f (\f.(\x.(x)) f) x))
            ///
            ///
            ///



            /* Console.WriteLine(lambda.GetNotation());
             * Console.WriteLine(lambda);
             * Console.WriteLine(new Reducer().Reduce(lambda));
             * var two = new Reducer().FullReduce(lambda);
             * Console.WriteLine(two);
             * Console.WriteLine(lambda);
             * Console.WriteLine(LambdaConverter.UInt32ToLambda(2).GetNotation());
             *
             * Console.WriteLine(LambdaConverter.LambdaToUInt32(two));
             * Console.WriteLine(new Reducer().FullReduce(new Application(new Application(two, two),two)));*/
            //Console.WriteLine(LambdaConverter.LambdaToUInt32(Lambda.Parse(@"((\3.((\4.((3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 (3 4)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))")));
        }
Exemple #6
0
 static LambdaExpression GetL(uint t)
 {
     return(LambdaConverter.UInt32ToLambda(t));
 }