chunalt787 28 Junior Poster in Training

I am a complete newbie on Prolog and I had a quick question. I want to write a function that takes no arguments and just does some asserts and retracts. Is this valid?

turnLeftFunc:-
	select(currentDirection(dir))->select(leftof(dir,turnDir))->
	   retract(currentDirection(dir)),
	   assert(currentDirection(turnDir)).

This is for a wumpus world implimentation.

I want to be able to just say:

some code....
turnLeftFunc,
some more code...

This will hopefully essentially execute the code similar to an inline function in C++.

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.