nemerle

Infix format for Nemerle macro

孤街浪徒 提交于 2019-12-23 22:37:51
问题 Say I need some very special multiplication operator. It may be implemented in following macro: macro @<<!(op1, op2) { <[ ( $op1 * $op2 ) ]> } And I can use it like def val = 2 <<! 3 And its work. But what I really want is some 'english'-like operator for the DSL Im developing now: macro @multiply(op1, op2) { <[ ( $op1 * $op2 ) ]> } and if I try to use it like def val = 2 multiply 3 compiler fails with 'expected ;' error What is the problem? How can I implement this infix-format macro? 回答1:

WriteProcessMemory

北战南征 提交于 2019-12-10 10:53:16
问题 Ok... I want to make win32api WriteProcessMemory works. ( Just for learning winAPI on .Net platforms ! ^___^ ) I'm using Nemerle but the syntax is similar C# and I can read C# code sure. So here is my steps : 1) get win api function [DllImport("kernel32.dll",SetLastError = true)] public static extern WriteProcessMemory (hProcess : IntPtr, lpBaseAddress : int, lpBuffer : array[byte], nSize : int, lpNumberOfBytesWritten : out int) : bool; 2) Open process, Get debug privileges ^_^ and ... call

How to hide console after creating form in console application

故事扮演 提交于 2019-12-07 17:43:38
问题 I want to hide my console after creating a from in my console application. And then show it again after closing form :) or somewhere when I want ... Console.Hide??? Application.Run(nForm()); Console.Show??? 回答1: I think you'll need to delve into the FindWindow and ShowWindow API calls. For example: [DllImport("user32.dll")] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

F# match with ->

寵の児 提交于 2019-12-07 12:44:37
问题 I want to make something like it (Nemerle syntax) def something = match(STT) | 1 with st= "Summ" | 2 with st= "AVG" => $"$st : $(summbycol(counter,STT))" on F# so is it real with F#? 回答1: If I understand you correctly, you'd like to assign some value to a variable as part of the pattern. There is no direct support for this in F#, but you can define a parameterized active pattern that does that: let (|Let|) v e = (v, e) match stt with | Let "Summ" (st, 1) | Let "AVG" (st, 2) -> srintf "%s ..."

How to avoid writing repetitive code for different numeric types in .NET

假装没事ソ 提交于 2019-12-07 12:04:07
问题 I am trying to write generic Vector2 type which would suite float, double, etc. types and use arithmetical operations. Is there any chance to do it in C#, F#, Nemerle or any other more or less mature .NET language? I need a solution with (1)good performance (same as I would have writing separate Vector2Float, Vector2Double, etc. classes), (2)which would allow code to look nice (I do not want to emit code for each class in run-time) (3)and which would do as much compile time checking as

WriteProcessMemory

眉间皱痕 提交于 2019-12-06 15:57:12
Ok... I want to make win32api WriteProcessMemory works. ( Just for learning winAPI on .Net platforms ! ^___^ ) I'm using Nemerle but the syntax is similar C# and I can read C# code sure. So here is my steps : 1) get win api function [DllImport("kernel32.dll",SetLastError = true)] public static extern WriteProcessMemory (hProcess : IntPtr, lpBaseAddress : int, lpBuffer : array[byte], nSize : int, lpNumberOfBytesWritten : out int) : bool; 2) Open process, Get debug privileges ^_^ and ... call function def WriteToMem(ProcessHandle : IntPtr, BaseAddress : int, NewVal : array[byte]) : bool {

How to hide console after creating form in console application

时光总嘲笑我的痴心妄想 提交于 2019-12-06 02:15:46
I want to hide my console after creating a from in my console application. And then show it again after closing form :) or somewhere when I want ... Console.Hide??? Application.Run(nForm()); Console.Show??? I think you'll need to delve into the FindWindow and ShowWindow API calls. For example: [DllImport("user32.dll")] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); static void Main(string[] args) { Console.Title = "ConsoleApplication1"; IntPtr h=FindWindow(null,

Comparison Of Nemerle and F# For Functional On .Net

[亡魂溺海] 提交于 2019-12-05 13:09:30
问题 Community Wiki Question: Pursuant to this question: What are the benefits of using Scala in .Net? another question comes to mind. Can anyone lay out the comparative advantages (and disadvantages) of Nemerle and F# for functional development on the .Net platform? I've just looked at Nemerle in passing. It sounds like it kind of plays in the same ballpark as F# so I was wondering what differences there are other than the obvious syntax differences and the big advantage F# has of being backed by

Comparison Of Nemerle and F# For Functional On .Net

我们两清 提交于 2019-12-04 00:11:46
Community Wiki Question: Pursuant to this question: What are the benefits of using Scala in .Net? another question comes to mind. Can anyone lay out the comparative advantages (and disadvantages) of Nemerle and F# for functional development on the .Net platform? I've just looked at Nemerle in passing. It sounds like it kind of plays in the same ballpark as F# so I was wondering what differences there are other than the obvious syntax differences and the big advantage F# has of being backed by Microsoft. desco I’ve touched both these languages and my impressions on Nemerle are briefly the