An attempt at a simplest possible functional programming syntax for simulation model specification using the Fay embedded domain specific language (EDSL) and Javascript compiler.
For want of a better starting place, here is a mystery 5 minute example of what looks like Zero-Dimension EBM code which I found I’d written more than a year ago.
I have no idea where these parameters came from, it’s merely for illustrative purposes.
testCO2 = temp 4.3
temp f = (-f)/totalF where
lambda0 = 3.2 :: Double -- Plank
totalF = avLambda - lambda0
avLambda = (maxSumF - minSumF)/2
minSumF = foldl (+) 0 (fmap fst lambda)
maxSumF = foldl (+) 0 (fmap snd lambda)
lambda = [waterVapour,lapseRate,clouds,albedo]
waterVapour = (1.48,2.14)
lapseRate = (-0.41,-1.27)
clouds = (0.18,1.18)
albedo = (0.07,0.34)