Wip022024

From ZCubes Wiki
Jump to navigation Jump to search

WIP Feb 2024




// actual
SIN(COS(45))

SIN(COS(45deg))

Parts(1..100,20Parts(1..100,20))

[1..10].zip([11..20])
seems different from 
Zip([1..10],[11..20])
Shuffle(1..10)
Size(1..10)
Size([1..10])
Tail([1,2,3,4,4,5,5,5])

Equal(1..10,1..10)
Parts(1..10,5)

Pieces("test test etest seret es ",4)
// strings are split and treated as arrays.


should we combinatorial argumment Parts?

Length(1..10) 
a=1..100;
Length(a)

a=[1..100];
Size(a)

// did not work

Explode([1,2,3,])

SIN((1..120)<>deg)

//try aming parts function.
1..10.parts(2..5)
|3,4,5,1..10|.parts(2..5)


Length("t4s"#) 
"This is a test of the EMS"#["s"]

a1="This is a test of the EMS"#[3]
a1="This is a test of the EMS"#[3,2]
a1="This is a test of the EMS"#[3,"s"]
a1="This is a test of the EMS"#[3,/\s/]
a1="This is a test of the EMS"#[3,Length]
a1="This is a test of the EMS"#[3,Length@SIN]
a1="This is a test of the EMS"#





B=A=1..10;
B|==|A

B=A=1..10;
B|x==y|A


MOPWITHEQ(1..10,1..10); // issues as fn returns.

why the following gives true?
ISLAMBDAEQUATION("LT")
MOPWITHEQ(1..10,1..10);

MOPWITHEQ(1..10,1..10);
eq=MOPWITHEQ


𐎲 = MOPWITHEQ;
𐎲(1..10,1..10);


𓈃 = MOPWITHEQ;
Σ(𓈃("RRGW"#,"RGGW"#))

𓃌 
𓃊
𓃍
𓎎


// Pointfree APL Code.
𓈃 = MOPWITHEQ;
(𓈃@Σ)("RRGWRR"#,"RBBWWW"#)


Length("testings fasdf asdf asd sdf")


("testings fasdf asdf asd sdf"#["s"]) ~

"testings fasdf asdf asd sdf"#[/[a-g]/]



𓈰=|3,4,[4]|;
𓈰|*|3443


Chunks(1..100,4)|/|45

1..100.pieces(2..3)
1..100.pieces(2..3,SUM)
1..100.pieces(2..3,[SUM,AVG])
1..100.pieces(2..3,[SUM,AVG],0..1)
1..100.fullpieces(2..3)
(Zip@(Parts.curry(2)))(1..100) // does it work?

1..100|x^2|


//https://www.youtube.com/watch?v=59vAjBS3yZM&t=113
('ssf454562631426'#).buckets()

https://www.youtube.com/watch?v=JELcdZLre3s
// Composition Intuition


(1..100)|+|;
(1..100)|+|;
SUM(1..100)

1..10|..|1..10

1..10|.|1..10

(1..100)|↧|

(1..100)|↥|
(1..100)|↧|;
(1..100)|↥|;	
(1..100)|↥|50;
(1..100)|<|50	

(1..100)|.+|;
1..100n)|.*|;
(1..100)|./|;
(1..100)|.^|2;
(1..100)|.==|;
(1..100)|.==|(1..100);
(1..100)|.==|
(1..10)|.%|
(1..10)|.^|null
(1..10)|.^| // will use 2 so as not to break old code.

(MS(9)#)|*|
(1..10)#1 breaks right has to be an array or fromtoadv breaks on parsing


(1..10)±

a=-5..10;
∑±a;
∑±a;

// https://www.youtube.com/watch?v=a7CSK7HNEWQ
a=[-2,-3,4,5,-3,4];
∏±a;
	
a=[-2,3,4,5,-3,4];
∏±a;
	

function DisplayDataHint(anyhint,SomeStayOn, KeepCaseSensitive)
SomeStayOn // gives dark css for tooltip


(1..10)#/3/

(1..10)#3
(1..10)#
(1..10)#[3]
(1..10)#[0]
(1..10)#0..5
(1..10)#3..5
	// now gives dates
((1..10)#"shuffle")()
	// should this work?
	
(1..10)#[3,[0,1]]
(1..10)#[3,[SIN,COS]]
(1..10)#[SIN,COS]
// important distinction.
(1..10)#[SIN,COS] 
	// calling function at first level is for *filtering* like ISNUM etc predicate function.
(1..10)#[3,[SIN]]
	// calling function at first level is for computing.
(1..10)#[3,[x=>x>4]] 
(1..10)#(x=>x>4)

(1..10)#[3,[x=>x>4]] // here predicate function will use entire left array.	
(1..10)#[x=>x>4]	 // this is predicate application
(1..10)#(x=>x>4)	// straight evaluation of function.	In this case will give false true masks.
(1..10)#(SIN)		// straight evaluation of function.	

(1..10)#(x=>x>4)  	// true false mask flags
(1..10)#[x=>x>4]	// filters by function as predicate	
(1..10)#[[x=>x>4]]	// applied to entire left array.

(1..10)#[[x=>x^3]]
(1..10)#(x=>x^3)


// note the way predicates and functions are applied intelligently based on how the arrays are loaded to do the application
(1..10)#[/[3,4]/]
(1..10)#[/[3,4]/]
(1..10)#[/\d/]
(1..10)#[/^\d$/]
(1..100)#[/^\d\d$/]
(1..100)#(fn:=x>34)
(1..100)#([fn:=x>34])
(1..100)#(fn:=x>34)
(1..100)#[[fn:=x>34]]
(1..100)#/^\d\d$/	// flags of predicate or fn application on left. on each element.




fn:=x+45;
fn(34)


	
#a-z stopped working.	
(#a-z)#/a/
(#a-z)
(#a-z)#0
(#a-z)#[0,6]
"abcd"#
"abcd"#/c/  
	//split with c
"abcd"#'d'
"abcd"#[1,2]
"abcd"#[2]
"abcd"#[2,1]
"abcdefghijklmnop"#[5,1]
"abcdefghijklmnop"#[5,2]
"abcdefghijklmnop"#[6,2]

cars=
	{
		name:"lyla",
		age:25
		
	};
cars#"name";
cars#["name","age"];
cars#;
cars#/nam/
cars#((x,i)=>25==x)
cars#((x,i)=>"lyla"==x)

cars=
	{
		name:"lyla",
		age:25,
		namaste:true
		
	};
cars#((x,i)=>/nam/) 
// why?

// reciprocal
1..100|1/x|
∏|4|# 
∏|4,2,3,5,1..10|# 
∏|4,2,3,5,1..10|#1 


// (EQ@Σ)("RRGWRR"#,"RBBWWW"#)

[1,2,3]|*|[[2],[3],[4]]

1..10@[SIN,COS,"x^2"];

03/01/2024



// did not parse
("RRGWRR"#)|x==y|("RBBWWW"#)
("RRGWRR"#)|.==|("RBBWWW"#)

// works
("RRGWRR"#)|MATRIXEQUAL|("RBBWWW"#)




//new adds

MS(3)|++|MS(3)

(1..10)#[0]
(1..10)#[1,2]
(1..10)#[[1,2]]


// https://thecodest.co/blog/power-of-functional-programming-in-javascript-part-2-combinators/
// combinators
// function trains

//eval([COS,SIN,TAN,SUM].$fnx())(45)
[COS,SIN,TAN,SUM].$fnx()
[COS,SIN,TAN,SUM].$fnx()(45)
[COS,SIN,TAN,SUM].$atop()(45)

[COS,SIN].$atop()


[COS,SIN,TAN,SUM].$atop()(45)
[COS,SIN,TAN,SUM].$atop()(22..45)
[COS,SIN,TAN].$atop()(22..45)
[SUM,[SIN,TAN]].$atop()(22..45)
[[SIN,TAN],SUM].$atop()(22..45) // more like the way to operate

[[SIN,TAN],SUM].$fnx()(22..45) 
([[SIN,TAN],SUM].$fnx())+""

([[SIN,TAN],SUM].$fnx())(45..90)

([[[SIN],[TAN]],SUM].$fnx())(45..90)
([[[SIN],[TAN]],SUM].$fnx())(49,39)
([[[SIN],[TAN]],SUM].$fnx())(49,34)

([[[SIN],TAN],SUM].$fnx())(49,34)
([[[SIN],TAN],SUM].$fnx())+""
([[[SIN],TAN,[COS]],SUM].$fnx())+""
([[[SIN],[TAN],[COS]],SUM].$fnx())+""
([[SIN,TAN,[COS]],SUM].$fnx())+""

[DIVIDE,SUM,Length].$fork()

[DIVIDE,SUM,Length].$fork()(1..100)
[DIVIDE,SUM,Length].$fork()([5, 3, 2, 8, 4, 2])

$Fork([DIVIDE,Length,SUM])([2,3,4,5])

[DIVIDE,SUM,Length].$fork()([5, 3, 2, 8, 4, 2])

[SIN,COS,TAN].$sequence()(1..10)
	// does not have to return values. just need to run them in sequence, no array result expected.
	// if needed, could have a wrap functionality to fnx with an array member doing that.
	
[SIN,COS,TAN].$pipe()(1..10)
[SIN,COS,TAN].$compose()(1..10)	

[SIN,COS,TAN].$tap()(1..10)	
	// done: with itself call in parallel.
	// (function(a){return(ITSELF(TAN(COS(SIN(a)))))})
	// how to reflect ITSELF a in this. Maybe another indicator to capture and reflect?
	// and how do we wrap a set into an array?

[SIN,COS,TAN].$tap()(10)

[x=>x>4?1,x=>x>8?2,x=>x>14?3].$alternation()(10)

[x=>x>4?1,x=>x>8?2,x=>x>14?3].$alternation()(10)
 
[x=>x>4?1,x=>x>8?2,x=>x>14?3].$alternation()+""
 
[x=>x<4?1,x=>x<8?2,x=>x<14?3].$alternation()(10)


[].$combinators()



[SIN,COS].$combinators("B")(3)

// display message was on editor.on handler.
[SIN,COS].$combinators("B")(3)
[].$combinators("I")(3)
[SIN,COS].$combinators("K")(3) // gives SIN as it ignore COS etc. constant
[3,43].$combinators("K")


[DIVIDE,SUM,Length].$combinators("Φ")(1..10)

// errors on this one.
[DIVIDE,SUM].$combinators("Σ")(1..10)

// not working. as a is not generating a function.
[SIN,COS].$combinators("Σ")(1..10)