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(prml). | |
-compile(export_all). | |
%% fn, calc | |
make_fn(VarArg, Body) -> {VarArg, Body}. | |
map_var_arg(VarBinding, VarArg) -> | |
[lookup_dom_val(Var, VarBinding) || Var <- VarArg]. |
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
import Data.List | |
import Data.Maybe | |
-- **************************************************************** | |
-- * data type definition | |
-- **************************************************************** | |
type VarName = String |
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
f <- function(x){x**2} | |
fgen <- function(k){ | |
k # for forcing arg k | |
return(function(x){ | |
f(k*x) | |
}) | |
} | |
generatedfuncs <- lapply(c(1:4),fgen) |
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
from __future__ import division | |
def pderiv(f, i): | |
e = 1e-10 | |
init_h = 0.1 | |
def deriv_exp(arg, h): | |
return(f(*arg_h(arg, h)) - f(*arg)) / h |
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
opt <- options(warn=-1) | |
## ------------------------------------------------------------ | |
## Test | |
## ------------------------------------------------------------ | |
## > rm(list=ls()); source("Eval.R") | |
## > repl() | |
## rlisp > (<- make.counter (function (c) (function () (<<- c (+ c 1))))) |
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
library(scatterplot3d) | |
p <- function(n) { | |
m <- matrix(0, ncol=n, nrow=n*6) | |
m[1:6, 1] <- 1/6 | |
val <- function(i, j) if(i < 1) 0 else m[i,j] | |
for (j in 2:n) { |
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
from __future__ import division | |
import numpy as np | |
class _callableArray(np.ndarray): | |
def __call__(self, *arg): | |
return np.array([f(*arg) for f in self]) | |
def carray(funcs): |
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
#include <string> | |
#include <iostream> | |
#include <fstream> | |
#include <cstdlib> | |
// usage: | |
// time ./a.out [1G|1M|default] filename > /dev/null | |
void error(const char* p, const char* p2 = "") | |
{ |
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
from __future__ import division | |
from parser import read, ParseError | |
from util import * | |
from obj import * | |
def eval(exp, env): | |
global visible | |
visible = True |
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
# > source("typedFunction.R") | |
# | |
# > cat(src) | |
# double calcPiLoop_typed() { | |
# int circle_in; | |
# int i; | |
# double l; | |
# | |
# circle_in = 0; |
OlderNewer