Changes

Jump to navigation Jump to search
3,707 bytes added ,  05:24, 5 March 2024
no edit summary
Line 1: Line 1:     
<pre>
 
<pre>
  −
a1=LAMBDACALCULUS(
  −
function lc(){
  −
return(B(COS,SIN))
  −
}
  −
);
  −
a1(34)
      
a1=LAMBDACALCULUS(
 
a1=LAMBDACALCULUS(
Line 14: Line 7:  
a1(23)
 
a1(23)
   −
//b(sin)(cos) etc?
+
b(sin)(cos) etc?
    
// this works
 
// this works
Line 58: Line 51:  
SIN(COS(45deg))
 
SIN(COS(45deg))
   −
// Amar Shah talk on functional combinators etc
+
Parts(1..100,20Parts(1..100,20))
//fog Over Atop Compositions
  −
//Case Convert
  −
//Unique Mask
  −
 
  −
Parts(1..100,20)
  −
Parts(1..100,20)
      
[1..10].zip([11..20])
 
[1..10].zip([11..20])
//seems different from  
+
seems different from  
 
Zip([1..10],[11..20])
 
Zip([1..10],[11..20])
 
Shuffle(1..10)
 
Shuffle(1..10)
Line 81: Line 68:       −
//should we combinatorial argument Parts?
+
should we combinatorial argumment Parts?
    
Length(1..10)  
 
Length(1..10)  
Line 177: Line 164:     
"testings fasdf asdf asd sdf"#[/[a-g]/]
 
"testings fasdf asdf asd sdf"#[/[a-g]/]
 +
 +
    
𓈰=|3,4,[4]|;
 
𓈰=|3,4,[4]|;
Line 202: Line 191:     
1..100.pieces(2..3)
 
1..100.pieces(2..3)
   
1..100.pieces(2..3,SUM)
 
1..100.pieces(2..3,SUM)
   
1..100.pieces(2..3,[SUM,AVG])
 
1..100.pieces(2..3,[SUM,AVG])
   
1..100.pieces(2..3,[SUM,AVG],0..1)
 
1..100.pieces(2..3,[SUM,AVG],0..1)
   
1..100.fullpieces(2..3)
 
1..100.fullpieces(2..3)
 
(Zip@(Parts.curry(2)))(1..100) // does it work?
 
(Zip@(Parts.curry(2)))(1..100) // does it work?
    
1..100|x^2|
 
1..100|x^2|
 +
    
//https://www.youtube.com/watch?v=59vAjBS3yZM&t=113
 
//https://www.youtube.com/watch?v=59vAjBS3yZM&t=113
   
('ssf454562631426'#).buckets()
 
('ssf454562631426'#).buckets()
    
https://www.youtube.com/watch?v=JELcdZLre3s
 
https://www.youtube.com/watch?v=JELcdZLre3s
 +
// Composition Intuition
   −
// Composition Intuition
      +
(1..100)|+|;
 +
(1..100)|+|;
 +
SUM(1..100)
    
1..10|..|1..10
 
1..10|..|1..10
Line 264: Line 252:  
 
    +
function DisplayDataHint(anyhint,SomeStayOn, KeepCaseSensitive)
 +
SomeStayOn // gives dark css for tooltip
    +
 +
(1..10)#/3/
    
(1..10)#3
 
(1..10)#3
Line 271: Line 263:  
(1..10)#[0]
 
(1..10)#[0]
 
(1..10)#0..5
 
(1..10)#0..5
//((1..10)#"shuffle")() // should this work?
+
(1..10)#3..5
 +
// now gives dates
 +
((1..10)#"shuffle")()
 +
// should this work?
 
 
// #a-z stopped working. now ok.
+
(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/
 
(#a-z)
 
(#a-z)
Line 291: Line 330:  
cars=
 
cars=
 
{
 
{
name:"andrew",
+
name:"lyla",
 
age:25
 
age:25
 
 
Line 300: Line 339:  
cars#/nam/
 
cars#/nam/
 
cars#((x,i)=>25==x)
 
cars#((x,i)=>25==x)
cars#((x,i)=>"andrew"==x)
+
cars#((x,i)=>"lyla"==x)
    
cars=
 
cars=
 
{
 
{
name:"andrew",
+
name:"lyla",
 
age:25,
 
age:25,
 
namaste:true
 
namaste:true
Line 316: Line 355:  
∏|4|#  
 
∏|4|#  
 
∏|4,2,3,5,1..10|#  
 
∏|4,2,3,5,1..10|#  
∏|4,2,3,5,1..10|#1
+
∏|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)
    
</pre>
 
</pre>
2,824

edits

Navigation menu