Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
.DS_STORE |
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
div.tooltip { | |
position: absolute; | |
text-align: right; | |
z-index:9999; | |
width: 6px; | |
height: 18px; |
############################################################################### | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. |
fun is_older (day1 : int*int*int, day2 : int*int*int) = | |
if (#1 day1) < (#1 day2) | |
then true | |
else if (((#2 day1) < (#2 day2)) andalso ((#1 day1) = (#1 day2))) | |
then true | |
else if (((#3 day1) < (#3 day2)) andalso ((#2 day1) = (#2 day2)) andalso ((#1 day1) = (#1 day2))) | |
then true | |
else false | |
####################################################### | |
# Evaluating Quandl Data Quality | |
# | |
# thertrader@gmail.com - Nov 2013 | |
####################################################### | |
library(quantmod) | |
library(Quandl) | |
library(Rbbg) | |
library(XML) |
// Homework 1 | |
// Color to Greyscale Conversion | |
//A common way to represent color images is known as RGBA - the color | |
//is specified by how much Red, Grean and Blue is in it. | |
//The 'A' stands for Alpha and is used for transparency, it will be | |
//ignored in this homework. | |
//Each channel Red, Blue, Green and Alpha is represented by one byte. | |
//Since we are using one byte for each color there are 256 different |
#load @"..\packages\Deedle.0.9.12\Deedle.fsx" | |
#load @"..\packages\FSharp.Charting.0.90.5\FSharp.Charting.fsx" | |
// Please note that I had to use FSharp.Data.2.0.0-alpha as current stable version 1.1.10 | |
// has a bug in CSV provider that disallows to load from more than 2 sources in one execution | |
#r @"..\packages\FSharp.Data.2.0.0-alpha2\lib\net40\FSharp.Data.dll" | |
#r @"..\packages\MathNet.Numerics.FSharp.2.6.0\lib\net40\MathNet.Numerics.FSharp.dll" | |
#r @"..\packages\MathNet.Numerics.2.6.2\lib\net40\mathnet.numerics.dll" | |
open Deedle | |
open System |
#r @"\\psf\Home\Desktop\GitHub\eulersfsharp\src\Euler\bin\Debug\FSharp.Data.dll" | |
#r @"\\psf\Home\Desktop\GitHub\eulersfsharp\src\packages\MSDN.FSharpChart.dll.0.60\lib\MSDN.FSharpChart.dll" | |
#r "System.Windows.Forms.DataVisualization.dll" | |
open FSharp.Data | |
open MSDN.FSharp.Charting | |
open System.Windows.Forms | |
open System.Drawing | |
open System.Windows.Forms.DataVisualization.Charting |
// This code is based on matlab code provided through the course "Monte Carlo Methods in Finance". | |
// https://iversity.org/my/courses/monte-carlo-methods-in-finance/ | |
// and Olaf Smits's Python conversion | |
// http://nbviewer.ipython.org/github/olafSmits/MonteCarloMethodsInFinance/blob/master/Week%201.ipynb?create=1 | |
open System | |
open Deedle | |
open FSharp.Charting | |
let readFrame (stock:string) = |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!