File: vecstr.kl1

package info (click to toggle)
klic 3.003-1.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 7,068 kB
  • ctags: 6,333
  • sloc: ansic: 101,584; makefile: 3,395; sh: 1,321; perl: 312; exp: 131; tcl: 111; asm: 102; lisp: 4; sed: 1
file content (22 lines) | stat: -rw-r--r-- 459 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
:- module main.

main :- klicio:klicio([stdout(Res)]),
	check_stream(Res).

check_stream(normal(St)) :-
	St = [putt(V),nl,putt(S),nl],
	test(500,{a,b,c},V),
	test(500,string#"abc",S).
check_stream(abnormal).

test(0,V,R) :- R=V.
test(K,V,R) :- K>0 |
	K1 := K-1,
	generic:element(V,0,E0),
	generic:set_element(V,0,E0,V1),
	generic:element(V1,1,E1),
	generic:set_element(V2,2,E2,V),
	generic:element(V2,2,E2),
	generic:set_element(V1,1,E1,V2),
	test(K1,V2,R).