>>8
I can assure you, Google has in fact found S&A, it is you who was unable to find it. What you should be saying is "I am incapable of finding things myself and would prefer it for /prog/ to find it for me."
>>16
I posted the link as proof that google didn't find me S&A. I tried many queries but none did.
Name:
Anonymous2009-05-21 20:09
>>5 twofibs(0, 1, 0).
twofibs(N, F1, F0) :-
atomic(N), N > 0,
Q is N >> 1, R is N /\ 1, twofibs(Q, A, B),
X is A * A + B * B, Y is B * (A << 1 + B),
( R =:= 0 -> F1 is X, F0 is Y; F1 is Y, F0 is X + Y ).
fib(N, F) :-
A is abs(N),
S is sign(N),
R is N /\ 1,
twofibs(A, _, F0),
((S =:= -1, R =:= 0) -> F is -F0; F is F0).
and here's a prime sieve for you: :- use_module(library(chr)).
:- chr_constraint prime/1.
prime(X) \ prime(Y) <=> 0 is Y mod X | true.
primes(1). primes(N) :- prime(N), succ(M,N), primes(M).
Having compile-time constant function values is only part of first-class functions -- and even then pointer to member is not the same as pointer to function. boost::bind and friends sweep some of this under the carpet with compile-time metaprogramming.
Name:
Anonymous2009-05-23 12:33
>>43 compile-time metaprogramming
Is there run-time metaprogramming? E. g. (eval (defmacro ...))
Name:
Anonymous2009-05-23 13:13
>>43 Having compile-time constant function values is only part of first-class functions
By all means elaborate.
>>44
That's a library issue, not a language issue.