2 people like it.

Simple F# Expression to Java compiler

Compiles simple F# quoted expressions (literals, values, operators, ifs and for loops) to Java code.

1: 
2: 
3: 
4: 
5: 
6: 
7: 
namespace Translators

module List2 =
    let setminus a b = List.filter (fun x -> not (List.contains x b)) a
    let repeat a l = List.map (fun _ -> a) l

type Position = { line: int; col: int }
val setminus : a:'a list -> b:'a list -> 'a list (requires equality)
val a : 'a list (requires equality)
val b : 'a list (requires equality)
Multiple items
module List

from Microsoft.FSharp.Collections

--------------------
type List<'T> =
  | ( [] )
  | ( :: ) of Head: 'T * Tail: 'T list
    interface IReadOnlyList<'T>
    interface IReadOnlyCollection<'T>
    interface IEnumerable
    interface IEnumerable<'T>
    member GetReverseIndex : rank:int * offset:int -> int
    member GetSlice : startIndex:int option * endIndex:int option -> 'T list
    member Head : 'T
    member IsEmpty : bool
    member Item : index:int -> 'T with get
    member Length : int
    ...
val filter : predicate:('T -> bool) -> list:'T list -> 'T list
val x : 'a (requires equality)
val not : value:bool -> bool
val contains : value:'T -> source:'T list -> bool (requires equality)
val repeat : a:'a -> l:'b list -> 'a list
val a : 'a
val l : 'b list
val map : mapping:('T -> 'U) -> list:'T list -> 'U list
type Position =
  { line: int
    col: int }
Position.line: int
Multiple items
val int : value:'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
Position.col: int

More information

Link:http://fssnip.net/l3
Posted:9 months ago
Author:Phillip Trelford
Tags: java , compiler