Rank (0)
- Floor
- Ceiling
- Decrement (_1&+)
- Increment ( 1&+)
- Open ( unbox )
- Conjugate ( complex Numbers)
- Signum
- Neg ( *&_1 )( Negate )
| use std::{ops::*,cmp::PartialEq}; | |
| #[derive(Debug,Clone,Copy,PartialEq)] pub struct Complex(f64,f64); | |
| type C=Complex; | |
| impl Add for C{ type Output = C; fn add(self, rhs: Self) -> Self::Output { Complex(self.0+rhs.0,self.1+rhs.1)}} | |
| impl Sub for C{ type Output = C; fn sub(self, rhs: Self) -> Self::Output { Complex(self.0-rhs.0,self.1-rhs.1)}} | |
| impl Neg for C{ type Output = C; fn neg(self ) -> Self::Output { Complex(-self.0,-self.1)}} | |
| impl Mul for C{ type Output = C; fn mul(self, rhs: Self) -> Self::Output { Complex((self.0*rhs.0)-(self.1*rhs.1), (self.0*rhs.1)+(self.1*rhs.0))}} | |
| impl Div for C{ type Output = C; fn div(self, rhs: Self) -> Self::Output { |
| Bluebird : B : \abc.a(bc) : S(KS)K : | |
| Blackbird : B1 : \abcd.a(bcd) : BBB : | |
| Bunting : B2 : \abcde.a(bcde) : B(BBB)B : B B1 B | |
| Becard : B3 : \abcd.a(b(cd)) : B(BB)B : BDB | |
| Cardinal : C : \abc.acb : S(BBS)(KK) : | |
| Dove : D : \abcd.ab(cd) : BB : | |
| Dickcissel : D1 : \abcde.abc(de) : B(BB) : BD | |
| Dovekies : D2 : \abcde.a(bc)(de) : BB(BB) : DD | |
| Eagle : E : \abcde.ab(cde) : B(BBB) : B B1 | |
| Bald Eagle : E^ : \abcdefg.a(bcd)(efg) : B(BBB)(B(BBB)) : EE |
| fn main() { | |
| let x1 = vec![1_u8]; | |
| let r1 = &x1[..]; // 'l1 | |
| let ret = { | |
| let x2 = vec![2_u8]; | |
| let r2 = &x2[..]; // 'l2 | |
| let mut y2 = Holder(r2);// Holder<'l2> |
| fn fib (input:usize)->usize{ | |
| const KIBI : usize = {let (mut x, mut times) = (2,0); loop{if times == 10 {break x} times+=1; x*=2}}; | |
| const MEBI : usize = KIBI*KIBI; | |
| const WORD_SIZE : usize = core::mem::size_of::<usize>(); | |
| const TRUE : usize = true as usize; | |
| const FALSE : usize = false as usize; | |
| const INST_REG : usize = 7; | |
| const STACK_REG : usize = 6; |
| NB. for reference ( https://code.jsoftware.com/wiki/Guides/Lexical_Closure ) | |
| coclass 'Unique' | |
| lines =. {{ <;._2 m }} | |
| NB. format : 'ref proof' =: input Unique message | |
| NB. on drop no proof is returned | |
| proof =.{{)n | |
| 'message own'=. y |
| #![allow(redundant_semicolons)] | |
| /// The current continuation | |
| type Cont<S,O> = (S, fn(S)->Process<S,O>); | |
| /// The State of a Process | |
| enum Process<S,O> | |
| { Continue(Cont<S,O>) | |
| , Complete(O) | |
| } |
| mod doubly_linked_list | |
| { | |
| extern crate core; | |
| extern crate alloc; | |
| use | |
| { core:: | |
| { ptr | |
| , marker::PhantomData | |
| , option::Option::{self, *} | |
| , iter::{Iterator, IntoIterator, DoubleEndedIterator} |
| #[derive(Debug)] | |
| enum Switchy<A,B> | |
| { Nil | |
| , Cons(A, Box<Switchy<B,A>>) | |
| } | |
| impl<A,B> Switchy<A,B> | |
| { fn cons(t : A, tail : Switchy<B,A>)->Self | |
| { Self::Cons(t, Box::new(tail)) } | |
| } |
| fn call_later<T:Fn(&G),G>(_ : &T) -> unsafe fn(*const(), *const()) | |
| { | |
| |p : *const (), g : *const()| | |
| { unsafe { (&*(p as *const T))(&*(g as *const G)) } | |
| } | |
| } |