Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,20 @@
|
|||
go =>
|
||||
L = 1..10,
|
||||
|
||||
% Using map/2 in different ways
|
||||
println(L.map(fun)),
|
||||
println(map(L,fun)),
|
||||
println(map(fun,L)),
|
||||
|
||||
% List comprehensions
|
||||
println([fun(I) : I in L]),
|
||||
|
||||
% Using apply/2
|
||||
println([apply(fun,I) : I in L]),
|
||||
|
||||
% And using list comprehension with the function directly.
|
||||
println([I*I : I in L]),
|
||||
nl.
|
||||
|
||||
% Some function
|
||||
fun(X) = X*X.
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
go2 =>
|
||||
L = 1..10,
|
||||
|
||||
% Define the predicate _in the bp space_.
|
||||
bp.assert( $(fun2(X,Y) :- Y is X*X) ),
|
||||
|
||||
% Use bp.fun2 to call the function.
|
||||
println([B : A in L, bp.fun2(A,B)]),
|
||||
nl.
|
||||
Loading…
Add table
Add a link
Reference in a new issue