Better HN
topnewbestaskshowjobs
Log inSign up

sumeetdas

34 karma · joined Dec 26, 2018 (7y ago) · 5 submissions

Submissions

comment 1y ago · link · parent

The first typed programming language where I've seen pipe operator |> in action was in F#. You can write something like:

  sum 1 2
  |> multiply 3

and it works because |> pushes the output of the left expression as the last parameter into the right-hand function. multiply has to be defined as:

  let multiply b c = b \* c

so that b becomes 3, and c receives the result of sum 1 2.

RHS can also be a lambda too:

  sum 1 2 |> (fun x -> multiply 3 x)

|> is not a syntactic sugar but is actually defined in the standard library as:

  let (|>) x f = f x

For function composition, F# provides >> (forward composition) and << (backward composition), defined respectively as:

  let (>>) f g x = g (f x)
  let (<<) f g x = f (g x)

We can use them to build reusable composed functions:

  let add1 x = x + 1
  let multiply2 x = x \* 2
  let composed = add1 >> multiply2 

F# is a beautiful language. Sad that M$ stopped investing into this language long back and there's not much interest in (typed) functional programming languages in general.

comment 4y ago · link · parent

- Its based on type theory, and thus supports data types like tuples, records, and sum types. Those are explained in the specs.

- Does not use quotes to describe property names. Has a unique syntax for large property names.

- It allows for setting a nested property value directly.

- Its also a language to describe the data schema.

- Its syntax is similar to F# and OCaml, so users with some background in functional programming languages should feel it easy to work with.

3.

FUML – a new data serialization language based on type theory(github.com ↗)

1 points · by sumeetdas · 4y ago · 2 comments

4.

Show HN: Bleeter – Twitter UI built using F#(sumeetdas.me ↗)

2 points · by sumeetdas · 4y ago · discuss

5.

Show HN: Generate-Resume: Node CLI to Generate Resume in HTML and PDF from XML(github.com ↗)

4 points · by sumeetdas · 7y ago · discuss