I read the file using the prolog and wondered about the difference in the statement:
processRead(Stream, ...) :- at_end_of_stream(Stream), !.
and
processRead(Stream, ...) :- get(Stream, Ch), Ch is -1, !.
Whether there is a?
If you need to choose, always prefer to useat_end_of_stream/1 over get/2!
at_end_of_stream/1
get/2
get/2outdated. If you have a ten year old code, move it.
If your code is new, never use it. Never. Not even once.
, .
SWI-Prolog :
phrase_from_file/2
: DCG , . . .. ..
( ) at_end_of_stream/1. , .. (, , - , get_code/2), , .
get_code/2
, , , () EOF .
at_end_of_stream/1 , ( ). , , , , . SICStus Prolog at_end_of_stream/1 , at_end_of_stream/1 .
, , , .
Source: https://habr.com/ru/post/1624445/More articles:Get all references and values ββfrom the stack - c #VBA code to display a Message Box popup if the cell value exceeds the value of another - excel-vbaFrom Webapp and with Apache Camel / and using MQ, do you add JMS messages using jsessionid? - springCould not find a compatible version for com.google.android.gms: play-services-plus: + - cordova-pluginsPublishing Option Siteore 8.0 - publishnew () at the end of the method declaration - syntaxPromise.all returns an undefined array - javascriptMath.Net Numerics - setting a sinus function - c #Inherit factory parent method - inheritanceLaravel5 and GAE using multiple queues - google-app-engineAll Articles