Logtalk

Logtalk
ParadigmLogic programming, object-oriented programming, prototype-based programming
Designed byPaulo Moura
First appeared1998; 26 years ago (1998)
Stable release
3.66.0 / 30 May 2023; 13 months ago (2023-05-30)
OSCross-platform
LicenseArtistic License 2.0 (2.x) / Apache License 2.0 (3.01.x)
Websitelogtalk.org
Influenced by
Prolog, Smalltalk, Objective-C

Logtalk is an object-oriented logic programming language that extends and leverages the Prolog language with a feature set suitable for programming in the large.[1] It provides support for encapsulation and data hiding, separation of concerns and enhanced code reuse.[1] Logtalk uses standard Prolog syntax with the addition of a few operators and directives.

The Logtalk language implementation is distributed under an open source license and can run using a Prolog implementation (compliant with official and de facto standards)[1] as the back-end compiler.

Features

Logtalk aims to bring together the advantages of object-oriented programming and logic programming.[1] Object-orientation emphasizes developing discrete, reusable units of software, while logic programming emphasizes representing the knowledge of each object in a declarative way.

As an object-oriented programming language, Logtalk's major features include support for both classes (with optional metaclasses) and prototypes, parametric objects,[2] protocols (interfaces), categories (components, aspects, hot patching), multiple inheritance, public/protected/private inheritance, event-driven programming, high-level multi-threading programming,[3] reflection, and automatic generation of documentation.

For Prolog programmers, Logtalk provides wide portability, featuring predicate namespaces (supporting both static and dynamic objects), public/protected/private object predicates, coinductive predicates, separation between interface and implementation, simple and intuitive meta-predicate semantics, lambda expressions, definite clause grammars, term-expansion mechanism, and conditional compilation. It also provides a module system based on de facto standard core module functionality (internally, modules are compiled as prototypes).

Examples

Logtalk's syntax is based on Prolog:

?- write('Hello world'), nl.
Hello world
true.

Defining an object:

:- object(my_first_object).

    :- initialization((write('Hello world'), nl)).

    :- public(p1/0).
    p1 :- write('This is a public predicate'), nl.

    :- private(p2/0).
    p2 :- write('This is a private predicate'), nl.

:- end_object.

Using the object, assuming is saved in a my_first_object.lgt file:

?- logtalk_load(my_first_object).
Hello world
true.

?- my_first_object::p1.
This is a public predicate
true.

Trying to access the private predicate gives an error:

?- my_first_object::p2.
ERROR: error(permission_error(access, private_predicate, p2), my_first_object::p2, user)

Anonymous functions

Logtalk uses the following syntax for anonymous predicates (lambda expressions):

{FreeVar1, FreeVar2, ...}/[LambdaParameter1, LambdaParameter2, ...]>>Goal

A simple example with no free variables and using a list mapping predicate is:

| ?- meta::map([X,Y]>>(Y is 2*X), [1,2,3], Ys).
Ys = [2,4,6]
yes

Currying is also supported. The above example can be written as:

| ?- meta::map([X]>>([Y]>>(Y is 2*X)), [1,2,3], Ys).
Ys = [2,4,6]
yes

Prolog back-end compatibility

Supported back-end Prolog compilers include B-Prolog, Ciao Prolog, CxProlog, ECLiPSe, GNU Prolog, JIProlog, Quintus Prolog, Scryer Prolog, SICStus Prolog, SWI-Prolog, Tau Prolog, Trealla Prolog, XSB, and YAP.[4] Logtalk allows use of back-end Prolog compiler libraries from within object and categories.

Developer tools

Logtalk features on-line help, a documenting tool (that can generate PDF and HTML files), an entity diagram generator tool, a built-in debugger (based on an extended version of the traditional Procedure Box model found on most Prolog compilers), a unit test framework with code coverage analysis, and is also compatible with selected back-end Prolog profilers and graphical tracers.[5]

Applications

Logtalk has been used to process STEP data models used to exchange product manufacturing information.[6] It has also been used to implement a reasoning system that allows preference reasoning and constraint solving.[7]

See also

References

  1. ^ a b c d Paulo Moura (2003). Logtalk: Design of an Object-Oriented Logic Programming Language. PhD thesis. Universidade da Beira Interior
  2. ^ Moura, Paulo (2011). Programming Patterns for Logtalk Parametric Objects. Applications of Declarative Programming and Knowledge Management. Lecture Notes in Computer Science. Vol. 6547. doi:10.1007/978-3-642-20589-7_4. ISBN 978-3-642-20588-0.
  3. ^ Practical Aspects of Declarative Languages. Lecture Notes in Computer Science. Vol. 4902. 2008. doi:10.1007/978-3-540-77442-6. ISBN 978-3-540-77441-9.
  4. ^ "Logtalk compatibility". Logtalk.org. 2016-10-10. Retrieved 2021-07-06.
  5. ^ "Developer Tools – LogtalkDotOrg/logtalk3 Wiki – GitHub". Github.com. 2013-02-12. Retrieved 2013-08-19.
  6. ^ Logic Programming. Lecture Notes in Computer Science. Vol. 4079. 2006. doi:10.1007/11799573. ISBN 978-3-540-36635-5.
  7. ^ Victor Noël; Antonis Kakas (2009). Gorgias-C: Extending Argumentation with Constraint Solving (PDF). Logic Programming and Nonmonotonic Reasoning. Lecture Notes in Computer Science. Vol. 5753. pp. 535–541.
  • Official website
  • Logtalking blog
  • From Plain Prolog to Logtalk Objects: Effective Code Encapsulation and Reuse (Invited Talk). Paulo Moura. Proceedings of the 25th International Conference on Logic Programming (ICLP), July 2009. LNCS 5649. Springer-Verlag Berlin Heidelberg". (Slides)

Read other articles:

Artikel ini tentang tahun 1985. 1985MileniumMilenium ke-2AbadAbad ke-19Abad ke-20 Abad ke-21Dasawarsa 1960-an1970-an1980-an1990-an2000-anTahun1982198319841985198619871988 1985 (MCMLXXXV) merupakan tahun biasa yang diawali hari Selasa dalam kalender Gregorian, tahun ke-1985 dalam sebutan Masehi (CE) dan Anno Domini (AD), tahun ke-985 pada Milenium ke-2, tahun ke-85 pada Abad ke-20, dan tahun ke- 6 pada dekade 1980-an. Denominasi 1985 untuk tahun ini telah digunakan sejak periode Abad Perteng…

Terowongan Schelde BaratIkhtisarNama resmiWesterscheldetunnelLokasiZeeland, BelandaKoordinat51°22′09″N 3°47′56″E / 51.3691°N 3.7989°E / 51.3691; 3.7989Koordinat: 51°22′09″N 3°47′56″E / 51.3691°N 3.7989°E / 51.3691; 3.7989RuteHighway N62MelintasiSchelde BaratMulaiEllewoutsdijk (ujung utara)BerakhirTerneuzen (ujung selatan)OperasiDibuka14 Maret 2003 (2003-03-14)PemilikProvinsi ZeelandTolYa, mobil €5,00TeknisPanjang…

Artikel ini tidak memiliki referensi atau sumber tepercaya sehingga isinya tidak bisa dipastikan. Tolong bantu perbaiki artikel ini dengan menambahkan referensi yang layak. Tulisan tanpa sumber dapat dipertanyakan dan dihapus sewaktu-waktu.Cari sumber: Celengan – berita · surat kabar · buku · cendekiawan · JSTOR Celengan terakota Majapahit, abad 14-15 Masehi. Trowulan, Jawa Timur. (Koleksi Museum Nasional, Jakarta.) Celengan berbentuk ayam Celengan merupa…

MayangDesaKantor Desa MayangNegara IndonesiaProvinsiJawa TengahKabupatenSukoharjoKecamatanGatakKode pos57557Kode Kemendagri33.11.11.2014 Luas-161.1966Jumlah penduduk-4500Kepadatan- Mayang adalah desa di kecamatan Gatak, Sukoharjo, Jawa Tengah, Indonesia. Pembagian wilayah Desa Mayang terdiri dari dukuh: Jantran Mayang Ngemplak Saripan Serongan Tegalgede Batas wilayah Batas-batas wilayahnya adalah sebagai berikut: Utara Kecamatan Kartasura Timur Kecamatan Baki Selatan Kecamatan Baki Barat De…

Wied Die Wied bei Roßbach Die Wied bei Roßbach Daten Gewässerkennzahl DE: 2716 Lage Westerwald (Naturraum) Oberwesterwald Dreifelder Weiherland Niederwesterwald Asbach-Altenkirchener Hochflächen Waldbreitbacher Wiedtal Mittelrheingebiet Mittelrheinisches Becken Neuwieder Beckenrand Neuwieder Rheintalweitung Deutschland Rheinland-Pfalz Flusssystem Rhein Abfluss über Rhein → Nordsee Quelle nördlich von Linden50° 36′ 16″ N, 7…

Venezuela throughout the history of the Jews in Venezuela See also: History of the Jews in Venezuela Part of a series onAntisemitism Part of Jewish history and discrimination History Timeline Reference Definitions IHRA definition of antisemitism Jerusalem Declaration on Antisemitism Nexus Document Three Ds Geography Argentina Australia Austria Belarus Belgium Canada Chinese Chilean Costa Rican Europe France Dreyfus affair 21st-century Germany Greece Hungary Italy Japan New Zealand Norway Pakista…

Artikel ini tidak memiliki referensi atau sumber tepercaya sehingga isinya tidak bisa dipastikan. Tolong bantu perbaiki artikel ini dengan menambahkan referensi yang layak. Tulisan tanpa sumber dapat dipertanyakan dan dihapus sewaktu-waktu.Cari sumber: Batu kecubung – berita · surat kabar · buku · cendekiawan · JSTOR Batu kecubungUmumKategoriVarietas mineralRumus(unit berulang)Silika (silikon dioksida, SiO2)Sistem kristalrhombohedral kelas 32IdentifikasiW…

العلاقات الجزائرية الكولومبية الجزائر كولومبيا   الجزائر   كولومبيا تعديل مصدري - تعديل   العلاقات الجزائرية الكولومبية هي العلاقات الثنائية التي تجمع بين الجزائر وكولومبيا.[1][2][3][4][5] مقارنة بين البلدين هذه مقارنة عامة ومرجعية للدولتين: وج…

Cet article est une ébauche concernant le chemin de fer. Vous pouvez partager vos connaissances en l’améliorant (comment ?) selon les recommandations des projets correspondants. Tunnel de Saint-Irénée Portail du tunnel côté Marseille Type FerroviaireVrai tunnel de percement Géographie Pays France Itinéraire Ligne de Paris-Lyon à Marseille-Saint-Charles Altitude 180 m (portail côté Paris)174 m (portail côté Marseille) Coordonnées 45° 45′ 35″ nord, 4° …

SI derived unit of absorbed dose of ionizing radiation grayUnit systemSIUnit ofabsorbed dose of ionizing radiationSymbolGyNamed afterLouis Harold GrayConversions 1 Gy in ...... is equal to ...    SI base units   m2⋅s−2   CGS units (non-SI)   100 rad The gray (symbol: Gy) is the unit of ionizing radiation dose in the International System of Units (SI), defined as the absorption of one joule of radiation energy per kilog…

This Is Me... NowAlbum studio karya Jennifer LopezDirilis16 Februari 2024 (2024-02-16)DirekamMei 2022–29 Juni 2023[1][2]GenreR&B[3]Durasi44:24Label Nuyorican BMG Produser BongoByTheWay Rogét Chahayed G-Ry Jeff Gitty Gitelman Bernard Harv Harvey Hit-Boy Tay Keith Carter Lang Angel Lopez Kurtis McKenzie T-Minus Andrew Wansel Sam Wish Federico Vindver Yeti Kronologi Jennifer Lopez Marry Me(2022) This Is Me... Now(2024) Singel dalam album This Is Me... Now Can…

KranjiKelurahanNegara IndonesiaProvinsiJawa TengahKabupatenBanyumasKecamatanPurwokerto TimurKodepos53116Kode Kemendagri33.02.26.1002 Kode BPS3302730002 Luas... km²Jumlah penduduk... jiwaKepadatan... jiwa/km² Kranji adalah kelurahan di kecamatan Purwokerto Timur, Banyumas, Jawa Tengah, Indonesia. lbsKecamatan Purwokerto Timur, Kabupaten Banyumas, Jawa TengahKelurahan Arcawinangun Kranji Mersi Purwokerto Lor Purwokerto Wetan Sokanegara Artikel bertopik kelurahan atau desa di Indonesia ini a…

Cycling at the Olympics Men's points raceat the Games of the XXVII OlympiadJoan Llaneras (2011)VenueDunc Gray VelodromeDate20 SeptemberCompetitors23 from 23 nationsWinning score14 (0 laps behind)Medalists Joan Llaneras Spain Milton Wynants Uruguay Aleksei Markov Russia← 19962004 → Cycling at the2000 Summer OlympicsRoad cyclingRoad racemenwomenTime trialmenwomenTrack cyclingTime trialmenwomenIndividual pursuitmenwomenTeam pursuitmenSprintmenwomenTeam…

Khalid Bakdash Informasi pribadiLahir1912Damaskus, SuriahMeninggal1995 (umur 83)Damaskus, SuriahKebangsaanSuriahnPekerjaanSekertaris jendral dari Partai Komunis SuriahAnggota dari Parlemen SuriahSunting kotak info • L • B Khalid Bakdash (1912–1995; umunya dieja Khalid Bagdash, Arab: خالد بكداشcode: ar is deprecated ) adalah pemimpin Partai Komunis Suriah dari tahun 1936 sampai pada kematiannya. Pada tahun 1954 Bakdash menjadi anggota pertama dari partai komunis yang terp…

A. Dirk MosesMoses during a presentation at the Haus der Kulturen der Welt in Berlin in 2022LahirAnthony Dirk Moses1967 (umur 56–57)Brisbane, Queensland, AustraliaOrang tuaIngrid MosesJohn A. MosesLatar belakang akademisPendidikanUniversitas QueenslandUniversitas Santo AndreasUniversitas Notre DameUniversitas California, BerkeleyTesisThe Forty-fivers[1] (2000)Pembimbing doktoralMartin JayKarya akademisDisiplin ilmuSejarahStudi genosidaCabang disiplin ilmuSejarah koloniali…

Promotion of ideas through culture For other uses, see Agitprop (disambiguation). Agitprop poster by Vladimir Mayakovsky titled: Want it? Join 1. You want to overcome cold?2. You want to overcome hunger?3. You want to eat?4. You want to drink?Hasten to join shock brigades of exemplary labor! Agitprop (/ˈædʒɪtprɒp/;[1][2][3] from Russian: агитпроп, tr. agitpróp, portmanteau of agitatsiya, agitation and propaganda, propaganda)[4] refers to an inten…

Unai Emery is a record four-time winner of the competition as manager The UEFA Cup was a European association football competition contested from 1971 to 2009. In the 2009–10 season its name was changed to UEFA Europa League. English manager Bill Nicholson led Tottenham Hotspur to victory in the inaugural final, an all-English encounter against Wolverhampton Wanderers. For the first 25 years of the competition, the final was contested over two legs, one at each club's stadium. In 1998, Luigi S…

American politician from North Carolina Tricia CothamMember of the North Carolina House of Representativesfrom the 112th districtIncumbentAssumed office January 1, 2023Preceded byDavid RogersMember of the North Carolina House of Representativesfrom the 100th districtIn officeMarch 22, 2007 – January 1, 2017Preceded byJim BlackSucceeded byJohn Autry Personal detailsBornPatricia Ann Cotham (1978-11-26) November 26, 1978 (age 45)Charlotte, North Carolina,…

Town in New Hampshire, United StatesExeter, New HampshireTownWater Street in downtown Exeter SealLocation in Rockingham County and the state of New HampshireCoordinates: 42°58′53″N 70°56′52″W / 42.98139°N 70.94778°W / 42.98139; -70.94778CountryUnited StatesStateNew HampshireCountyRockinghamSettledApril 3, 1638Incorporated1638Government • Select BoardNiko Papakonstantis, ChairMolly CowanNancy BelangerJulie D. GilmanDaniel Chartrand …

Cambodian steamed fish curry Fish amokFish amok served in a banana leaf containerAlternative namesAmok trei, amok treyTypeSteamed curryPlace of originCambodia[1][2][3]Serving temperatureHotMain ingredientsGoby fish, snakehead fish or catfish, yellow or green kroeung, coconut cream or coconut milk, eggs  Media: Fish amok Fish amok or amok trei (Khmer: អាម៉ុកត្រី [ʔaːmok trəj]) is a Khmer steamed fish curry (amok) with a mousse-like c…

Kembali kehalaman sebelumnya