|
|
java-forums.org
- 2012-07-19 06:05:37
- Similar
- Report/Block
In one java application that uses jpl.jar to interact with swi-Prolog, I want to be able to restart the prolog engine. An as example, in my application I use a feature such as assert(term). Now, I want to connect again swi-prolog, or restart swi-Prolog, so that my data is at first in swi-prolog. How do I use?...
|
|
|
stackoverflow.com
- 2010-11-25 21:21:58
- Similar
- Report/Block
I have built an expert system in Prolog . Is there a way I can incorporate the Prolog code into my Android application so that the application takes arguments passes them to the Prolog expert system, and the expert system returns the answer to the Android application?...
|
|
|
stackoverflow.com
- 2012-05-05 19:31:52
- Similar
- Report/Block
So I'm both new to Prolog and Ruby. Learning Prolog at university and Ruby at my own. And I was thinking if there is a "don't care" or "trow away" variable in Ruby as there is in Prolog. I just opened irb and just did this (supposing underscore was the "don't care" sign) 1.9.2-p290 :003 > _, b, c = [1,2,3] => [1, 2, 3] 1.9.2-p290 :...
|
|
|
|
stackoverflow.com
- 2012-04-11 07:28:04
- Similar
- Report/Block
Tree traversal refers to the process of visiting each node in a tree data structure in a systematic way. The preorder traversal in the following image Sorted_binary_tree returns F, B, A, D, C, E, G, I, H (root, left, right). This is the Prolog code: preorder(tree(X,L,R),Xs) :- preorder(L,Ls), preorder(R,Rs), append([X|Ls],Rs,Xs). preorder...
|
|
|
stackoverflow.com
- 2011-03-30 10:45:52
- Similar
- Report/Block
Are there any parsers written in Prolog for either the TSPLIB or the suggested satisfiability format (The second link is to a PostScript file)...
|
|
|
stackoverflow.com
- 2013-03-18 09:10:47
- Similar
- Report/Block
Are Hilog terms (i.e. compounds having as functors arbitrary terms) still regarded as a powerful feature in XSB Prolog (or any other Prolog) ? Are there many XSB projects currently using this feature ? which of them for example ? I ask since as far as I understand higher order programming is equally possible using the ISO built-in call/N.
|
|
|
stackoverflow.com
- 2013-04-09 04:57:02
- Similar
- Report/Block
I am trying a code that adds a value to a list which is initially empty. program keeps going to infinite loop or out of stack, when using append. I am using SWI Prolog and I am new to Prolog. getcardvalueList([],[_]). getcardvalueList([H|Ts],[_]):- getcardvalue(H,Val), append([_],[Val],Vl), getcardvalueList(Ts,Vl). append([X|Y],Z,[X|W]...
|
|
|
|
stackoverflow.com
- 2013-03-21 02:13:46
- Similar
- Report/Block
I have been reading this tutorial about Prolog list, and how to get specific element from a list, and I came across this example: ?- [_,X,_,Y|_] = [[], dead(z), [2, [b, c]], [], Z]. X = dead(z) Y = [] Z = _9593 what I don't understand is, where do they get the value _9593 for the variable Z?...
|
|
|
stackoverflow.com
- 2013-02-22 10:36:13
- Similar
- Report/Block
Can anyone help me to write a program using stack concept in PROLOG to convert an arithmetic expression from postfix(reverse polish notation) to prefix form. The arithmetic expression may contain the 4 arithmetic operators + , - , / , * and the unary functions : sin, cos, tan, exp, log and sqrt.
|
|
|
stackoverflow.com
- 2012-03-24 02:35:22
- Similar
- Report/Block
So i have been stumped for 3 hours now on this problem, I need to find the index of (A,B,C) where A is the index positions of B in list C (or -1 if not on the list). This is what i have so far, indexof(A,0,[A|_]). indexof(A,B,[_|C]):- Y is B-1, indexof(A,Y,C). it gives the element at the index spot B, which is not what i want. I am horrib...
|
|
|
stackoverflow.com
- 2012-03-13 23:59:03
- Similar
- Report/Block
The creole of Paradise Island has 14 words: "abandon", "abalone", "ana- gram", "boat", "boatman", "child", "connect", "elegant", "enhance", "is- land", "man", "sand", "sun", and "woman". The Paradise Times have published this crossword: http://i.stack.imgur.com/q5wmk.png The crossword contains some of the 14 words but no other words. Writ...
|
|
|
stackoverflow.com
- 2012-04-22 05:04:20
- Similar
- Report/Block
I'm trying to write a recursive function in prolog that computes R = (2*X + Y)^N without using the exponent operator. I've written a recursive function with if-else statements and I get the error: ") or operator expected." It looks to me like I have the syntax correct, but I must be missing something. The code is below. expbar(R, X, Y, N)...
|
|
|
|
stackoverflow.com
- 2012-04-15 23:04:25
- Similar
- Report/Block
I am testing tuProlog in Android. I have an Activity TuProlog, class Parser to interact with prolog code and data.pl which contains prolog code. I can run it fine as a java project with output to console but I am facing trouble doing so as an Android project. For Android I get FileNotFoundException even though my file data.pl is copied in...
|
|
|
stackoverflow.com
- 2012-03-31 13:11:10
- Similar
- Report/Block
I've got a problem. I must solve a riddle in Prolog, but I haven't got any idea how to do this. Maybe can you help me, give me some hint or something. First I haven't real name of this riddle, it's calld simply "ABC". At the beggining they give me size of board (n x m) and n, m = (1,10) and one letter, for example C, so I can use in ma so...
|
|
|
stackoverflow.com
- 2012-03-30 07:13:00
- Similar
- Report/Block
I am working on solving the classic Missionaries(M) and Cannibals(C) problem, the start state is 3 M and 3 C on the left bank and the goal state is 3M, 3C on the right bank. I have complete the basic function in my program and I need to implemet the search-strategy such as BFS and DFS. Basically my code is learn from the Internet. So far...
|
|
|
stackoverflow.com
- 2011-11-24 06:22:49
- Similar
- Report/Block
i wrote the below program, but when it goes ot the XPath classes it gives [Fatal Error] :1:1: Content is not allowed in prolog. i tried to figure it out but couldnt make it.is there any clue to fix this problem? package xpath; import com.sun.org.apache.xalan.internal.xsltc. trax.SAX2DOM; import java.io.IOException; import java.io.InputStr...
|
|
|
stackoverflow.com
- 2012-06-07 05:24:38
- Similar
- Report/Block
I already made a working generalized verbal arithmetic solver in Prolog but it's too slow. It takes 8 minutes just to run the simple expression S E N D + M O R E = M O N E Y. Can someone help me to make it run faster? /* verbalArithmetic(List,Word1,Word2,Word3) where List is the list of all possible letters in the words. The SEND+MORE =...
|
|
|
stackoverflow.com
- 2012-03-24 03:21:40
- Similar
- Report/Block
I am using the maven docbook plugin (com.agilejava.docbkx), and I am using a custom xsl file to override some properties, and it looks like: <?xml version='1.0' encoding='UTF-8'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Tr ansform"> <xsl:attribute-set name="section.title.properties"> <...
|
|
|
|
stackoverflow.com
- 2010-11-18 00:52:31
- Similar
- Report/Block
I'm new to using groovy and have started to use it to test some REST services. I'm having an issue parsing my XML response from our service due to 'Content not allowed in prolog.' After awhile searching I came across a post saying there might be a Byte Order Marker at the beginning. To compensate I followed their approach to trim the char...
|
|
|
stackoverflow.com
- 2012-05-25 14:43:50
- Similar
- Report/Block
I have a problem passing the input type="hidden" form with the CGI library of SWI-Prolog. Specifically I do: <form id="frmCGIPrologIni" name="frmCGIPrologIni" method="post" action="http://localhost/cgi-bin/x.pl"&g t; <p><input type="hidden" name="initial" value="ini" /> <input class="submit" type="submit" value="Start" /&...
|
|
|
cyberforum.ru
- 2013-03-25 18:49:45
- Similar
- Report/Block
Всем здрасте, помогите плиз написать экспертную систему на swi prolog, хотя бы пример маленький привести как это делать, очень надо.:(...
|
|
|
|
cyberforum.ru
- 2013-04-12 07:59:34
- Similar
- Report/Block
С Lisp немного разобрался, а вот с Visual Prolog никак. Прошу помощи в решении лаб. Готов заплатить. ЛР8 - Задание №3 Кликните здесь для просмотра всего текста на всякий случай icq: 222209166 Вложения LabWork7.pdf (156.0 Кб) LabWork8.pdf (77.0 Кб)...
|
|
|
cyberforum.ru
- 2013-04-22 18:55:50
- Similar
- Report/Block
Здравствуйте. Вот тут тема http://www.cyberforum.ru/prolog/thread84 4881.html Половину задачи решил, но не могу до конца добить.. Может кто помочь?...
|
|
|
cyberforum.ru
- 2013-04-22 14:23:41
- Similar
- Report/Block
Помогите пожалуйста.Создайте предикат,проверяющий,является ли входной список множеством.
|
|
|
|
cyberforum.ru
- 2013-05-01 21:21:17
- Similar
- Report/Block
Помогите, пожалуйста, решить: 1. Правая рекурсия (итерация). Вычислите и напечатайте первый член арифмитической прогрессии a[SUB]n[/SUB]=3+4n, больший заданного числа K, число K вводится с клавиатуры. 2. Левая рекурсия. Напишите рекурсивную процедуру вычисления степени с натуральным показателем X[SUP]n[/SUP].
|
|
|
cyberforum.ru
- 2013-05-03 13:00:58
- Similar
- Report/Block
Помогите с формулой возведения в степень числа. Степень положительная turbo prolog 5.2 A- число N - степень Код: predicates nondeterm stepen(real, integer, real) clauses stepen(_, 0, 1). stepen(A, N, Y):- N mod 2 = 0, % для чётной степени N <> 0, % степень не равна нулю N1 = 2 * N, % (2*n) stepen(A, N1, Y1), ??? Y1 = N1 * A + Y.
|
|
|
cyberforum.ru
- 2013-03-17 21:03:23
- Similar
- Report/Block
не обходимо написати програму пошуку мінімального елементу списку і його порядкового номера в цьому списку. Для вирішення завдання використовуйте тринарный предикат minimum(type_of_elements, integer, list). Перший аргумент в цьому предикаті задає мінімальний елемент списку, другий, – індекс цього елементу в списку, третій, – список, в яко...
|
|
|
|
cyberforum.ru
- 2013-04-08 17:18:15
- Similar
- Report/Block
Нужно записать S(n)=SUMM(from k=1 to n)*([SUP]K[/SUP])! То есть чтобы Сумма и Факториал работали в одной рекурсии. Задачка выполняется в SWI-Prolog Код: factorial(N,FactN):- fact(N,FactN,1,1). fact(N,FactN,I,P):- /* накопитель I - аналог счетчика */ Все на что хватило знаний. Добавлено через 1 час 37 минут S(n)=∑(от k=1 до n)*(k²)! хоть п...
|
|
|
cyberforum.ru
- 2013-05-04 11:53:23
- Similar
- Report/Block
Скажите пожалуйста как работать в SWI Prolog...я работал на турбопролог, вот например есть там решенная задачка: Код: PREDICATES window menu click(char) CLAUSES window:-makewindow(1,4,10,"Main Wondow",0,0,10,20), write("Tsar"),nl,write("Tsarevich"),nl,w rite("Korol"),nl, write("Korolevich"),nl,write("Sapoznik") ,nl, write("Portnoi"),...
|
|
|
cyberforum.ru
- 2013-03-03 23:29:59
- Similar
- Report/Block
Если не сложно может кто поправить мой код, чтоб я разобрался. В задаче нужно найти сумму целых чисел в интервале от N до M хвостовой рекурсией. Пишу на Visual Prolog 7.3. Код: implement sum open core, console constants className = "sum". classVersion = "". clauses classInfo(className, classVersion). class predicates sum:(integer...
|
|
|
|
cyberforum.ru
- 2013-04-20 19:19:37
- Similar
- Report/Block
Здравствуйте! Помогите пожалуйста с заданием на Strawberry Prolog: вычисление позиции минимального элемента в списке. Код на вычисление минимального элемента есть, а вот с определением позиции проблемы, не могу понять как делать. Буду очень благодарна :) Код: min([],M):- write(M),!. min([H|T],M):- integer(H),M > H,!, min(T,H). min([H|T],M...
|
|
|
cyberforum.ru
- 2013-04-18 14:42:22
- Similar
- Report/Block
Доброго времени суток, помогите разобраться и решить 2 задачки на языке Visual Prolog. А то я только начал разбираться в нем. Задача №1: На произвольном множестве точек декартовой плоскости, задаваемых своими координатами, например point(1,1). point(1,2). point(1,4). point(2,1). point(2,2). point(2,4). point(3,2). point(4,1). point(4,3).
|
|
|
cyberforum.ru
- 2012-10-11 10:15:06
- Similar
- Report/Block
Здравствуйте, помогите пожалуйста с задачей: Вычислить значение n-го члена ряда Фибоначчи: f(0)=0, f(1)=1, f(n)=f(n-1)+f(n-2). Обязательно реализовать хвостовую рекурсию. Число n считать из файла. Результат также записать в файл. На данный момент имею следующее: Код: PREDICATES fib(integer,integer) result CLAUSES fib(1,1):-!. fib(2,1):-!.
|
|
|
|
cyberforum.ru
- 2013-03-21 12:28:54
- Similar
- Report/Block
1. Вычислить сумму квадратов нечётных чисел от 1 до n. 2. Вычистить N!+(N-1)!+...+2!+1!.
|
|
|
developpez.net
- 2013-04-20 09:58:01
- Similar
- Report/Block
Bonjour, Je dois appeler des prédicats Prolog depuis Java. J'utilise SICStus et Jasper. Au début j'ai essayé ça : http://sicstus.sics.se/sicstus/docs/...1 2.html#SEC169 Code: public class Launcher { public static void main(String[] argv){ SICStus sp; SPPredicate predicat; SPTerm nbReines, resultat; SPQuery query; int nbSolutions = 0;...
|
|
|
cyberforum.ru
- 2012-09-18 18:17:25
- Similar
- Report/Block
Есть функция.Необходимо посчитать ее значение с заданной точностью (например,Е=10[SUP]-3[/SUP] ) Написал такой код на Turbo Prolog: Код: predicates R(integer,real,integer,integer,integer,i nteger,integer). %R(X, E, Res, N, XpowN, Min1Factor, PrevRes). clauses R(X, E, Res, N, XpowN, Min1Factor,PrevRes) :- NewXpowN = XpowN * X, NewN = N + 1,...
|
|
|
|
cyberforum.ru
- 2013-02-07 10:31:12
- Similar
- Report/Block
Только начал изучать пролог так что не привык ещё к его логике. В общем я хочу найти max от 3х чисел, с логикой как это сделать в лекции интуита я ознакомился, да вот только беда в том что там только логику и описали, а вот что ещё надо наобъявлять не написали :) Искать max я хочу так (это худший вариант, я просто хочу так без ! попробова...
|
|
|
cyberforum.ru
- 2013-03-21 22:50:26
- Similar
- Report/Block
Написать программу на Прологе реализующую конечный автомат, который распознает слова, имеющие следующий общий вид:a(abc)^n(de)^m, n≥0, m≥0, n+m≥1...
|
|
|
cyberforum.ru
- 2013-03-28 09:58:00
- Similar
- Report/Block
Складывает по парно числа списка L1, результирующий список - L2...
|
|
|
|
cyberforum.ru
- 2012-10-11 10:13:50
- Similar
- Report/Block
Здравствуйте, помогите пожалуйста с задачей: имеется список, элементы которого — непустые бинарные деревья. Для каждого элемента списка выполнить преобразование дерева в список. В полученных списках удалить наименьший элемент. Нужно на Visual Prolog 5.2 Нашел код, похожей задачи: Имеется список, элементы которого – непустые бинарные дерев...
|