Qhov txawv ntawm Prolog thiab Lisp

Qhov txawv ntawm Prolog thiab Lisp
Qhov txawv ntawm Prolog thiab Lisp

Video: Qhov txawv ntawm Prolog thiab Lisp

Video: Qhov txawv ntawm Prolog thiab Lisp
Video: Hunter Education with Kong Pheng Yang 3-25-2019 2024, Hlis ntuj nqeg
Anonim

Prolog vs Lisp

Prolog thiab Lisp yog ob hom lus nrov tshaj plaws AI (Artificial Intelligence) computer programming languages hnub no. Lawv tau tsim nrog ob qhov sib txawv programming paradigms. Prolog yog ib hom lus tshaj tawm, thaum Lisp yog lus ua haujlwm. Ob leeg siv rau ntau yam teeb meem AI tab sis Prolog siv feem ntau rau cov laj thawj thiab cov teeb meem kev xav, thaum Lisp siv rau cov teeb meem nrog kev xav tau sai sai.

Prolog

Prolog yog AI programming lus. Nws belongs rau tsev neeg ntawm logic programming lus. Prolog yog ib hom lus tshaj tawm, nyob rau hauv uas kev suav yog nqa los ntawm kev khiav cov lus nug dhau ntawm kev sib raug zoo (uas sawv cev rau qhov kev pab cuam logic), uas txhais tau tias yog cov cai thiab qhov tseeb. Tsim nyob rau hauv 1970, prolog yog ib qho ntawm cov laus tshaj plaws logic programming lus thiab ib qho ntawm feem nrov AI programming lus niaj hnub no (nrog rau Lisp). Nws yog ib hom lus pub dawb, tab sis muaj ntau yam kev lag luam sib txawv. Nws yog thawj zaug siv rau kev ua cov lus ntuj, tab sis tam sim no nws tau siv rau ntau yam haujlwm xws li cov kws tshaj lij, cov lus teb tsis siv neeg, kev ua si thiab kev tswj hwm qib siab. Prolog tsuas muaj ib hom ntaub ntawv hu ua lub sij hawm. Lub sij hawm tuaj yeem yog atom, tus lej, sib txawv lossis cov ntsiab lus sib xyaw. Cov lej tuaj yeem yog ntab lossis cov lej. Prolog txhawb cov npe thiab cov hlua raws li kev sau cov khoom. Prolog txhais cov kev sib raug zoo siv clauses. Clauses tuaj yeem yog cov cai lossis qhov tseeb. Prolog tso cai rau iteration tag nrho nws cov recursive predicates.

Lisp

Lisp yog tsev neeg ntawm cov lus programming hauv computer. Thiab cov lus nrov tshaj plaws Lisp siv rau kev ua haujlwm dav dav niaj hnub no yog Hom Lisp thiab Scheme. Lub npe LISP los ntawm "List Processing" thiab raws li nws qhia, Lisp cov ntaub ntawv loj yog cov npe txuas. Qhov tseeb tag nrho cov hauv paus yog sau siv cov npe (siv cov ntawv sau ua ntej), lossis ntau dua cov npe kom raug (hu ua s-expressions). Piv txwv li, ib qho kev hu xov tooj yog sau li (f a1 a2 a3), uas txhais tau hais tias muaj nuj nqi f yog hu ua siv a1, a2 thiab a3 raws li kev sib cav tswv yim rau kev ua haujlwm. Yog li ntawd nws yog hu ua ib tug qhia oriented lus, qhov twg tag nrho cov ntaub ntawv thiab code yog sau raws li kab lus (tsis muaj qhov txawv ntawm kab lus thiab nqe lus nyob rau hauv Lisp). Qhov zoo nkauj no tshwj xeeb heev rau Lisp, qhov twg nws tuaj yeem siv los txuas ntxiv cov lus rau qhov teeb meem ntawm tes los ntawm kev sau cov macro pab. Txawm hais tias tus Tsov tus tw-recursion yog siv los ntawm programmers los nthuav qhia cov voj voog, txhua qhov pom tau pom zoo li Lisp cov lus suav nrog cov qauv tswj zoo li lub voj. Tsis tas li ntawd, Common Lisp thiab cov tswv yim muaj mapcar thiab daim ntawv qhia uas yog cov piv txwv ntawm kev ua haujlwm, uas muab kev ua haujlwm zoo los ntawm kev siv cov haujlwm ua tiav rau tag nrho nws cov ntsiab lus thiab tom qab ntawd sau cov txiaj ntsig rau hauv daim ntawv teev npe.

Qhov txawv ntawm Prolog thiab Lisp yog dab tsi?

Txawm hais tias, Prolog thiab Lisp yog ob hom lus AI nrov tshaj plaws, lawv muaj ntau qhov sib txawv. Lisp yog ib hom lus ua haujlwm, thaum Prolog yog ib qho kev ua haujlwm logic thiab cov lus tshaj tawm. Lisp yog qhov hloov pauv tau yooj yim vim nws cov qauv nrawm thiab cov yam ntxwv macro, yog li nws tso cai rau txuas cov lus kom haum rau qhov teeb meem ntawm tes. Hauv cov cheeb tsam ntawm AI, cov duab kos duab thiab cov neeg siv interfaces, Lisp tau siv ntau heev vim tias muaj peev xwm prototyping sai. Txawm li cas los xij, vim nws lub peev xwm ua kom muaj peev xwm ua tau zoo, Prolog yog qhov zoo tshaj plaws rau AI teeb meem nrog rau cov lus pom zoo, cov ntaub ntawv thiab cov ntawv sau cov lus. Kev xaiv ntawm ib qho ntawm lwm qhov yog nyob ntawm hom teeb meem AI uas yuav tsum tau daws.

Pom zoo: