How to use Shen Prolog's findall?

112 views
Skip to first unread message

deech

unread,
Jun 2, 2016, 10:10:49 PM6/2/16
to Shen
Hi all,
I was playing around with `findall` using the example in the test suite but I'm running into behavior I don't understand:
(15-) (prolog? (findall [X Y] [app X Y [1 2 3 4 5]] Z) (return Z))
[[[] [1 2 3 4 5]]]

Shouldn't it return:
[[[1] [2 3 4 5]] [[1 2] [3 4 5]] ...]

Thanks!
-deech

Mark Tarver

unread,
Jun 3, 2016, 4:36:40 PM6/3/16
to Shen
Looks like a bug;  I'll look into it.

Mark

Bruno Deferrari

unread,
Oct 3, 2016, 4:29:33 PM10/3/16
to qil...@googlegroups.com
Do you still have this problem? Because I cannot reproduce it:

Shen, copyright (C) 2010-2015 Mark Tarver
www.shenlanguage.org, Shen 19.2
running under Scheme, implementation: chibi-scheme
port 0.14 ported by Bruno Deferrari


(0-) (defprolog app
  [] X X <--;
  [X | Y] W [X | Z] <-- (app Y W Z);)
app

(1-) (prolog? (findall [X Y] [app X Y [1 2 3 4 5]] Z) (return Z))
[[[1 2 3 4 5] []] [[1 2 3 4] [5]] [[1 2 3] [4 5]] [[1 2] [3 4 5]] [[1] [2 3 4 5]] [[] [1 2 3 4 5]]]

(2-)

--
You received this message because you are subscribed to the Google Groups "Shen" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qilang+unsubscribe@googlegroups.com.
To post to this group, send email to qil...@googlegroups.com.
Visit this group at https://groups.google.com/group/qilang.
For more options, visit https://groups.google.com/d/optout.



--
BD

Mark Tarver

unread,
Oct 7, 2016, 6:35:49 AM10/7/16
to Shen
Do you still have this problem? Because I cannot reproduce it:

Me neither.

Shen, copyright (C) 2010-2015 Mark Tarver
www.shenlanguage.org, Shen Professional Edition 10
running under Common Lisp, implementation: SBCL
port 2.1 ported by Mark Tarver
commercially licensed to Mark Tarver



(0-) (defprolog app
  [] X X <--;
  [X | Y] W [X | Z] <-- (app Y W Z);)
app

(1-) (prolog? (findall [X Y] [app X Y [1 2 3 4 5]] Z) (return Z))
[[[1 2 3 4 5] []] [[1 2 3 4] [5]] [[1 2 3] [4 5]] [[1 2] [3 4 5]] [[1] [2 3 4 5]] [[] [1 2 3 4 5]]]

(2-)

I haven't tried the OS version but the kernel is 99% identical.

Mark
Reply all
Reply to author
Forward
0 new messages