I'm trying to get Ciao running in my revised Programming Language Shootout (http://shootout.alioth.debian.org). Unfortunately, I'm having trouble handling input from the command line.
Here's a simple (naive) Fibonacci implementation:
:- module(fibo,[main/1],[]).
:- use_module(library(write)).
fibo(0,1). fibo(1,1). fibo(N,Val) :- nonvar(N),!,integer(N),N > 0, N1 is N - 1, fibo(N1,Val1), N2 is N - 2, fibo(N2,Val2), Val is Val1 + Val2.
main(Argv) :- run_list(Argv).
run_list([Arg|Args]) :- fibo(Arg,Val), write(Val), nl, halt.
I compile this like so:
# ciaoc -o fibo fibo.pl {Reading /opt/shootout/shootout/bench/fibo/fibo.pl WARNING: (lns 17-20) [Args] - singleton variables in run_list/1 } # ./fibo 3 {Program ended with failure} #
Any idea what I'm doing wrong? I added in the various type checks based on the fibonacci.pl example in the distribution, but I'm not having much luck. What am I overlooking?
Version: Ciao-Prolog 1.9 #351: Sun Jun 27 19:50:42 PDT 2004
Thanks,
-Brent
============================================================================== Message: Address: Action: help majordomo(a)clip.dia.fi.upm.es Info. on useful commands subscribe ciao-users-request(a)clip.dia.fi.upm.es Subscribe to this list unsubscribe ciao-users-request(a)clip.dia.fi.upm.es Unsubscribe from this list <whatever> ciao-users(a)clip.dia.fi.upm.es Send message to list ----------------------------------------------------------------------------- Archived messages: http://www.clip.dia.fi.upm.es/Mail/ciao-users/ -----------------------------------------------------------------------------