Skip to content

Instantly share code, notes, and snippets.

@andruby
andruby / my_lib.erl
Created November 23, 2009 23:53
[Erlang] lists:seq for floats
%% This lets you do stuff like
1> my_lib:seq_float(10.01,10.13,0.02).
[10.01,10.03,10.05,10.07,10.09,10.11,10.13]
/*********************************************
* OPL 5.0 Model
* Author: Andrew Fecheyr Lippens
* Creation Date: 9/05/2009 at 23:49
*********************************************/
// Setup
int horizon = 60*24*21-1; // Number of minutes in a week
int blocktime = 5;
CREATE OR REPLACE FUNCTION r_scatter(title text, sql text)
RETURNS text AS
$BODY$
str <- pg.spi.exec (sql);
pdf('/tmp/scatter_plot.pdf');
plot(str,main=title,cex=0.3, pch=20,col=rgb(255,0,0,2,maxColorValue=255),ylim=c(0,100));
dev.off();
print('done');
$BODY$
LANGUAGE 'plr' VOLATILE;