________________________________________________________________________

This file is part of Logtalk <https://logtalk.org/>  
Copyright 1998-2018 Paulo Moura <pmoura@logtalk.org>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
________________________________________________________________________


% start by loading the example:

| ?- logtalk_load(lambdas_compiled(loader)).
...


% the following lambda benchmarks are so far only available when using
% SWI-Prolog, XSB, or YAP as the Logtalk back-end compilers:

?- lambda_benchmarks::bench1.
Using map/2 with a closure for testing less(0, X) with X in [1..100000]:
% 200,002 inferences, 0.030 CPU in 0.024 seconds (123% CPU, 6666733 Lips)
Using map/2 with a lambda for testing less(0, X) with X in [1..100000]:
% 300,002 inferences, 0.010 CPU in 0.017 seconds (60% CPU, 30000200 Lips)
true.

?- lambda_benchmarks::bench2.
Adding 1 to every integer in the list [1..100000] using a local add1/2 predicate:
% 100,002 inferences, 0.020 CPU in 0.020 seconds (101% CPU, 5000100 Lips)
Adding 1 to every integer in the list [1..100000] using map/3 with the integer::plus/3 predicate:
% 300,003 inferences, 0.100 CPU in 0.102 seconds (98% CPU, 3000030 Lips)
Adding 1 to every integer in the list [1..100000] using map/3 with a lambda argument with a is/2 goal:
% 200,002 inferences, 0.020 CPU in 0.025 seconds (80% CPU, 10000100 Lips)
true.
