Skip to content

Instantly share code, notes, and snippets.

giuliohome

Block or report user

Report or block giuliohome

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@isaacabraham
isaacabraham / io-monad.fsx
Last active May 28, 2019
F# port of the first half of John De Goes "FP to the max" (https://www.youtube.com/watch?v=sxudIMiOo68)
View io-monad.fsx
#load @".paket\load\net452\FSharpPlus.fsx"
open FSharpPlus
open System
[<AutoOpen>]
module rec IO =
let run (IO computation) = computation()
type IO<'T> =
View Differ.fs
type DifferenceType<'TKey, 'T> =
| Added of 'TKey * 'T
| Removed of 'TKey * 'T
| Modified of 'TKey * 'T * 'T * seq<string * (string * string)> with
member this.Key =
match this with
| Added (key, _)
| Removed (key, _)
| Modified (key, _, _, _) -> key
@CarstenKoenig
CarstenKoenig / Hylo.fs
Last active Feb 19, 2018
Factorial using a Hylomorphism in F#
View Hylo.fs
type List<'i,'r> = Nil | Cons of 'i*'r
type FixList<'i> = FixList of List<'i,FixList<'i>>
let rec fmap (f : 'a -> 'b) (l : List<'i,'a>) : List<'i,'b> =
match l with
| Nil -> Nil
| Cons (x, tail) -> Cons (x, f tail)
// you can express hylo directly without using ana and cata (by either following the
@vjeux
vjeux / x.md
Last active Jun 19, 2019
Ocaml / functional programming
View x.md

I'm taking down this post. I just posted this as a side comment to explain a sentence on my latest blog post. This wasn't meant to be #1 on HN to start a huge war on functional programming... The thoughts are not well formed enough to have a huge audience. Sorry for all the people reading this. And please, don't dig through the history...

@decisionmechanics
decisionmechanics / spark_random_forest.R
Created Mar 21, 2017
Predicting wine quality using a random forest classifier in SparkR
View spark_random_forest.R
library(readr)
library(dplyr)
url <- "https://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-white.csv"
df <-
read_delim(url, delim = ";") %>%
dplyr::mutate(taste = as.factor(ifelse(quality < 6, "bad", ifelse(quality > 6, "good", "average")))) %>%
dplyr::select(-quality)
@battermann
battermann / io.fsx
Last active Jul 3, 2018
IO Monad in F#
View io.fsx
[<AutoOpen>]
module IO =
type IO<'a> =
private
| Return of (unit -> 'a)
| Suspend of (unit -> IO<'a>)
let rec run x =
match x with
| Return v -> v()
View Applied-FP-with-Scala.md

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@robert-claypool
robert-claypool / app_offline.htm
Created Jul 21, 2015
A simple "app offline" template for ASP.NET
View app_offline.htm
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Offline</title>
</head>
<body style="margin:3em;font-family:sans-serif">
<h2>Offline</h2>
<p>This site is offline for maintenance.</p>
<!--
@ArthurHub
ArthurHub / ClipboardHelper.cs
Last active May 23, 2019
Helper class for setting HTML and plain text formatting to clipboard (http://theartofdev.com/2014/06/12/setting-htmltext-to-clipboard-revisited/)
View ClipboardHelper.cs
/// <summary>
/// Helper to encode and set HTML fragment to clipboard.<br/>
/// See http://theartofdev.com/2014/06/12/setting-htmltext-to-clipboard-revisited/.<br/>
/// <seealso cref="CreateDataObject"/>.
/// </summary>
/// <remarks>
/// The MIT License (MIT) Copyright (c) 2014 Arthur Teplitzki.
/// </remarks>
public static class ClipboardHelper
{
@dgfitch
dgfitch / simple_wcf.fs
Created Nov 3, 2010
A sample WCF host and client in F#, extremely simple but a starting point
View simple_wcf.fs
open System
open System.ServiceModel
open System.ServiceModel.Description
[<ServiceContract(ConfigurationName = "PublishService", Namespace = "http://xyz.gov/PublishService")>]
[<ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession)>]
type IPublishService =
[<OperationContract(Name="TestMethod")>]
abstract member TestMethod : name:string -> string
You can’t perform that action at this time.