This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ConstrainedTypes = | |
open System | |
// General hints on defining types with constraints or invariants | |
// | |
// Just as in C#, use a private constructor | |
// and expose "factory" methods that enforce the constraints | |
// | |
// In F#, only classes can have private constructors with public members. | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(** | |
Talk given by Rizo Isrof | |
- https://pusher.com/sessions/meetup/the-realtime-guild/realtime-stream-processing-with-coroutines | |
- https://www.reddit.com/r/ocaml/comments/66pe0s/stream_processing_with_coroutines_from_c_to_ocaml/ | |
*) | |
# empty ;; | |
- : ('a, 'b, unit) pipe = Ready () | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type DSL<'next> = | |
| Get of string * (string -> 'next) | |
| Set of string * string * 'next | |
| End | |
with static member fmap f = function | |
| Get (k, c) -> Get (k, f << c) | |
| Set (k, v, c) -> Set (k, v, f c) | |
| End -> End | |
type FreeDSL<'a> = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lorenz.py | |
# 5 March 2016 | |
# | |
# Copyright 2016 Jason Milldrum | |
# | |
# Draw the Lorenz system in a GTK window | |
# See https://en.wikipedia.org/wiki/Lorenz_system | |
import math | |
import gi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Ejemplos de código en C# | |
*/ | |
//32 for | |
using System; | |
public class Monaso{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Gtk; | |
using WebKit; | |
namespace monobrowser { | |
class coolbrowser { | |
public static void Main () { | |
Application.Init (); | |
Window window = new Window ("a browser in 13 lines..."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Gtk; | |
public partial class MainWindow: Gtk.Window | |
{ | |
public MainWindow () : base (Gtk.WindowType.Toplevel) | |
{ | |
Window myWin = new Window ("My first GTK# Application!"); | |
myWin.Resize (200, 200); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AndroidDesignerView.cs | |
// | |
// Author: | |
// Lluis Sanchez <[email protected]> | |
// | |
// Copyright (c) 2011 Xamarin Inc | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Gtk; | |
namespace builder | |
{ | |
class MainWin | |
{ | |
[Gtk.Builder.Object("window1")] Window window1; | |
public void OnToggled(object sender, EventArgs args) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.kafecho.learning.monad | |
import java.util.UUID | |
/** My attempt at implementing the Reader Monad concept. | |
* The Reader Monad encapsulates a computation which: | |
* - requires a dependency of type D | |
* - produces values of type A. | |
*/ | |
case class Reader[D, A](computation: D => A) { |