Public
Edited
Jul 29, 2023
Fork of Coffeescript
1 fork
Insert cell
md`# Coffeescript ...EDITED
`
Insert cell
Insert cell
//import {__,add,compose,equals,flip,modulo} from '@christer/ramda'
Insert cell
//S = Object.freeze({a, b, c, sq})
S = ({a, b, c, sq, tf})
Insert cell
Insert cell
//a=matrix
a=va
Insert cell

b=vb
Insert cell
Insert cell
sq = cs`(x) => x*x`
Insert cell
a.add(a).toString()
Insert cell
gg = //await
cs`(S) ->
{a,b,c,sq, tf} = S
a .add a

a
.dot b
.equal 11 ;
a .dot b
.equal (
a .mul b
.sum()
)
a .dot b
.equal (
a .mul b
.sum() )

tf.equal (
(a .dot b )
,a .mul b
.sum()
)
`
Insert cell
gg(S).toString()
Insert cell
gg.toString()
Insert cell
g = cs`(S) =>
{a,b,c,sq} = S
#sq add a, add b,c
a .abs() .toString()
#a .add a .toString()
(a .add a ).toString()
((a .add a ).abs() ).toString()
(a .add a .abs() ).toString()
a .add a
.add a
.add a
.toString()

(117)
#.toExponential()
.toExponential()
#(a .dot b) .equal (a .mul b
# .sum () )
(a .add a .abs() ).toString()


`
Insert cell
g(S)
Insert cell
-----------
# edit
Insert cell
va=tf.tensor1d([1,2])
Insert cell
vb=tf.tensor1d([3,4])
Insert cell
yg
Insert cell
// Construct a 2x2 matrix.
matrix = tf.tensor2d(
[[1, 2],
[3, -184]]);

Insert cell
// Tensors have a 'data()' method which resolves with the underlying values.
// data = await matrix.data();
matrix.abs().toString()
Insert cell

// Tensors also have a 'shape', a 'dtype', and a 'rank';
({data, shape: matrix.shape, dtype: matrix.dtype, rank: matrix.rank})

Insert cell
Math.sqrt(8)
Insert cell
(117).toExponential()
Insert cell
x=17 //{a:['asd']}
Insert cell
({a:'d'}).
Insert cell
Object.get({})
Insert cell
cs`

//#// matrix = tf.tensor2d(
# // [[1, 2],
# // [3, -84]]);

Math .sqrt 8
# matrix.abs().toString()

`
Insert cell
//cs`
//${s}
//`
Insert cell
cs([s])
Insert cell
csf( [ f.toString()] )
Insert cell
s=''+f.toString() //+'()'
Insert cell
f('')
Insert cell
ff=(function() {
return 545
})
Insert cell
//f=(()=> 545)
f=(() -> 545)
Insert cell
cs`
even = modulo __,2
map even, [3,4,54,6]
`
Insert cell
cs`
odd = compose(
equals 1
flip(modulo) 2
)
map odd, [3,4,5,6]
`
Insert cell
mod = flip(modulo)
Insert cell
isOdd = compose(equals(1),modulo(__,2))
Insert cell
isOdd(7)
Insert cell
isOdd(8)
Insert cell
Insert cell
CS = require('coffeescript')
Insert cell
cscs = (code) => ('"use strict"\nreturn (' + code[0].trim() + ')')
Insert cell
csf = (code) => CS.run('"use strict"\nreturn (' + code[0].trim() + ')()')
Insert cell
cs = (code) => CS.run('"use strict"\nreturn (' + code[0].trim() + ')')
Insert cell
//R = require('ramda')
Insert cell
//Object.assign(window,R)
Insert cell
//////window.R = R
Insert cell
Insert cell
////tf = require('@tensorflow/tfjs@0.8.0')
tf = require('@tensorflow/tfjs@4.9.0/dist/tf.min.js')
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more