Couldn't we just consider every integer to be a function instead of +, -, etc? That way we do not need special syntax or weird mindfucking prefix notations do just add two integers. Consider: (1 + (2 * ((3 + 1) + 4))
* and + are just symbols passed into the functions (could as well be (define + '+) (define - '-))
3 + 1 = 4 4 + 4 = 8 2 * 8 = 16 1 + 16 = 17
Why does no language do this?
Name:
Anonymous2016-02-10 2:33
Read SICP
Name:
Anonymous2016-02-10 3:17
Why does no language do this?
Look at this ignorant fuck who's never heard of Smalltalk.
>>9 Anybody who knows anything about how computers actually run high level languages thinks in ASTs. Infix is shit that must be swizzled into proper computational form first, which is equivalent to s-expressions.
Name:
Anonymous2016-02-11 19:03
In a language that supports currying this would be even better and easier. (define (+ a b) (...)) (define (N op) (op N))
>>16 Really? I thought it was the other way around.
Name:
Anonymous2016-02-16 20:27
>>6 : 1 1 swap execute ; ok see 1 1 ( 004CABB0 8BD3 ) MOV EDX, EBX ( 004CABB2 BB01000000 ) MOV EBX, 00000001 ( 004CABB7 FFD2 ) CALL EDX ( 004CABB9 C3 ) NEXT, ( 10 bytes, 4 instructions ) ok 2 ' + 1 . 3 ok 2 ' - 1 . 1 ok You can modify NUMBER so it will compile to such a function and you'll have it for every number.