|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Hey guys,
I'm teaching myself prolog and i'm having trouble solving a problem. The problem is this: I want to write a predicate that deletes the first 2 and the last 2 elements of a list to create a new list. A sublist I suppose. Any help appreciated. Thanks! ![]() |
|
#2
|
|||
|
|||
|
I've got this so far. It's crude but it's an effort!!
delFirst2Last2([],[]). delFirst2Last2([H1,H2,H3|T], [HNew|TNew]):- H3 = HNew, T = TNew. Console: | ?- delFirst2Last2([1,2,3,4,5,6], L2). L2 = [3,4,5,6] |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Prolog Problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|