Search found 283 matches

by Harrison Pratt
26 May 2014 23:23
Forum: Visual Prolog
Topic: commondialogs::tryGet_string
Replies: 10
Views: 2825

This is an untested approach you might consider: class facts finding : ( string ClinicalSignOrSymptom ). class predicates ask_put_finding : ( window, string, string ) determ (i,i,i). ask_signs_and_symptoms : ( window, string Patient ) . clauses ask_put_finding( ParentWin, Pt, SignSymptom ) :- Prompt...
by Harrison Pratt
9 Apr 2014 23:17
Forum: Visual Prolog
Topic: Increase integer variable
Replies: 7
Views: 1704

Thanks, Thomas. I understand your meaning.
Code maintainability (by ordinary mortals) and clarity should be the first consideration.
by Harrison Pratt
9 Apr 2014 14:19
Forum: Visual Prolog
Topic: Increase integer variable
Replies: 7
Views: 1704

Question for Thomas: Is this somewhat equivalent code compiled to better/worse/same code as the if/then/else syntax? something(0, Cnt) = Cnt :- !. something(N, Cnt1) = Cnt0 :- 0 = N mod 2 , % if test(...) then !, Cnt0 = something( N-1, Cnt1 ). something(N, Cnt) = Cnt0 :- Cnt0 = something( N-1, Cnt +...
by Harrison Pratt
3 Apr 2014 2:18
Forum: Visual Prolog
Topic: Unreachable or excessive code?
Replies: 11
Views: 2647

I now understand the scope of your problem! That's curious about the numeric constants ... I'll take a look at that. By the way, I usually set up a small class named "app" that handles quirky little configuration parameters, functions, etc. that need global access or storage for each application. It...
by Harrison Pratt
2 Apr 2014 21:12
Forum: Visual Prolog
Topic: Unreachable or excessive code?
Replies: 11
Views: 2647

Re:

Three thoughts on this: (1) If you reverse the order of the statements so the that mandatory fail clause (or the given constant) is last, the compiler does not optimize away any code: checkQuarter(Year,Q) = true():- Year = lastKnownYearInQuarters, list::isMember(Q,["Q1","Q2","Q3","Q4"]), lastKnownQu...
by Harrison Pratt
2 Apr 2014 15:03
Forum: Visual Prolog
Topic: Unreachable or excessive code?
Replies: 11
Views: 2647

Since lastKnownQuarter is a constant ("Q2"), clauses containing a statement like this

Code: Select all

lastKnownQuarter = "Q4",
must always fail, so the test for list membership in the flagged clauses can never be reached.
by Harrison Pratt
24 Mar 2014 13:37
Forum: Visual Prolog
Topic: A list to CSV
Replies: 18
Views: 3865

AHMED, There are several different CSF formats in common use. For example, the Excel-type double quotes strings but not numbers; others double quote only strings which have embedded commas, still others double quote everything. One simple version that quotes everything looks like this: list_write_cs...
by Harrison Pratt
7 Mar 2014 23:27
Forum: Visual Prolog
Topic: Discontiguous facts
Replies: 6
Views: 1522

I believe that discontiguous is a compiler directive in other prologs. It may pop up in an error message at compilation or run time in those languages if clauses having the same signature are separated by one or more dissimilar clauses.
by Harrison Pratt
7 Mar 2014 14:01
Forum: Visual Prolog
Topic: Advanced List handling
Replies: 19
Views: 4930

Re:

Back inthe 5.x and 6.x days what I would do is have 2 predicates. the first was simply a list iterator. the second contained clauses to execute an action (or not). That's what I do in 5.2, also. I try to avoid nondeterminism for bulky processes to avoid the dreaded GStack overflow condition. Below ...
by Harrison Pratt
7 Mar 2014 12:53
Forum: Visual Prolog
Topic: Advanced List handling
Replies: 19
Views: 4930

Re:

Thomas, You are, of course, right about inefficient code. In practice I never recurse into member/2 if it can be avoided. I believe that George's stated intent was to have processing terminate when a specified string was encountered and not process strings after that string. What to do when there is...
by Harrison Pratt
6 Mar 2014 14:58
Forum: Visual Prolog
Topic: Advanced List handling
Replies: 19
Views: 4930

Re:

Two little predicates and your job is done. %-- a member is "before" the Chop %-- as long as the Tail of the list contains the Chop string before_nd( Chop, [S|T], S ):- member( Chop, T ). before_nd( S, [_|T], BF ):- before_nd( S, T, BF ). member( S, [S|_] ):- !. member( S, [_|T] ):- member(S,T). QED...
by Harrison Pratt
25 Jan 2014 14:03
Forum: Visual Prolog
Topic: Read from an external file.
Replies: 17
Views: 4254

Copy from Word to Windows clipboard, retrieve from clipboard in your application with tryGetString/0-> tryGetString : () -> string String determ. It is acceptable to have the user open Word and export some (or all) of the document. That's the fastest way to get started since you don't seem to have s...
by Harrison Pratt
24 Jan 2014 23:17
Forum: Visual Prolog
Topic: Read from an external file.
Replies: 17
Views: 4254

Ahmednadi, Can you give more specifics ... Will your application require an installed version of Word, or do you want to read the file directly without using MS Word? Do you want ALL of the document, or a specific part of it? Is it acceptable to have the user open Word and export some (or all) of th...
by Harrison Pratt
16 Jan 2014 14:16
Forum: Visual Prolog
Topic: define clause with value from edit control
Replies: 6
Views: 1832

Look at "single" facts.
by Harrison Pratt
29 Nov 2013 4:33
Forum: Visual Prolog
Topic: Do we have any built in predicate to validate whether the input date is valid or not..??
Replies: 12
Views: 3257

Re: time::isValidDate predicate was not working as expected

Perhaps it is _designed_ to test the validity of a future date (200 - CurrentMonth) a certain number of months into the future? Can you get a valid date response if the input Month is negative (for a date before the current month)? If so, the designed function would seem to be to assess the validity...