Jump to content

Prolog Question

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
Nacre

Nacre

    Newbie

  • Members
  • Pip
  • 1 posts
I am just now learning Prolog and am quite bad at it.

notMember(X,[]).
notMember(X,[H|T]) :- X =\= H, notMember(X,T).

I can't figure out why this does not work. It give me error: undefined procedure: notMember/2.

If my understanding is correct, the first line says: notMember is true (X is not in the list) when the list is empty. The second line says that X is not in the list with Head H and Tail T, when X does not equal H and is not a member of Tail.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
I don't think there are any prolog programmers on this forum.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
chili5

chili5

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 7,247 posts
Sorry, but I'm not a prolog programmer. I don't know what prolog even is.

The only thing I can think of is your trying to use a procedure that you haven't made yet.

I found a few prolog tutorials that might be of more help:

Prolog Tutorials
prolog

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Your error matches a note on this page:
Test All Elements
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
I haven't even heard of Prolog, so I can't help with this one.

I wonder if GeSHi supports Prolog.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#6
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Prolog is a fairly strange language based on first order logic. It's sort of a recursion on steroids waiting to happen. I don't know how powerful it is, though.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#7
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
I must do some research into it, I'd actually never even heard of it before this.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums