[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-451730-105":3,"detail-sidebar-cat-0-en-105":81,"doc-detail-451730-en":131,"doc-similar-451730":162},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":74,"head_meta":76,"extra_data":78,"updated_unix":80},105,"en","learning-programming-in-picat-by-examples-from-google-code-jam-article-introduction","Learning Programming in Picat by Examples from Google Code Jam - Article Introduction","","Picat is a logic-based, multi-paradigm programming language combining logic programming, functional programming, constraint programming, and dynamic programming with tabling, plus scripting. Built on Prolog-like logic concepts, it emphasizes efficiency, reliability, and convenience. The text explains Picat’s core constructs—logic variables, unification, backtracking—and its integrations from other paradigms such as arrays, maps, comprehensions, loops, and assignments. It highlights tabling, explicit non-determinism, and constraints as strengths for symbolic computation, then introduces Picat through Google Code Jam examples.",{"@graph":14,"@context":73},[15,34,56],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/learning-programming-in-picat-by-examples-from-google-code-jam-article-introduction/451730/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/learning-programming-in-picat-by-examples-from-google-code-jam-article-introduction/451730.png","ImageObject",300,407,{"name":42,"@type":43},"dbqoiu","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-30","2026-09-30",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",18,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69],{"name":60,"@type":61,"acceptedAnswer":62},"What programming paradigms does Picat integrate?","Question",{"text":63,"@type":64},"Picat integrates logic programming, functional programming, constraint programming, dynamic programming with tabling, and scripting.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"How do logic variables work in Picat?",{"text":68,"@type":64},"Logic variables act as value holders and can be bound to any term, including other logic variables, using unification and backtracking.",{"name":70,"@type":61,"acceptedAnswer":71},"What is tabling in Picat and what does it enable?",{"text":72,"@type":64},"Tabling allows predicates and functions to store calls and answers, which supports dynamic programming solutions by reusing computed results.","https://schema.org",{"og:url":32,"og:type":75,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":77,"canonical":32},"index,follow",{"doc_id":79,"site_id":7},451730,1790866006,{"code":4,"msg":82,"data":83},"success",[84,88,92,96,101,105,110,115,120,123,127],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":85,"show_sort_weight":86,"slug":87},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":89,"show_sort_weight":90,"slug":91},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":93,"show_sort_weight":94,"slug":95},"Exam",70,"exam",{"id":97,"doc_module":4,"doc_module_name":25,"category_name":98,"show_sort_weight":99,"slug":100},5,"Comic",60,"comic",{"id":102,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":103,"slug":104},6,50,"technology",{"id":106,"doc_module":4,"doc_module_name":25,"category_name":107,"show_sort_weight":108,"slug":109},7,"Healthcare",40,"healthcare",{"id":111,"doc_module":4,"doc_module_name":25,"category_name":112,"show_sort_weight":113,"slug":114},8,"Research & Report",30,"research-report",{"id":116,"doc_module":4,"doc_module_name":25,"category_name":117,"show_sort_weight":118,"slug":119},9,"Religion & Spirituality",20,"religion-spirituality",{"id":118,"doc_module":4,"doc_module_name":25,"category_name":121,"show_sort_weight":118,"slug":122},"World Cup","world-cup",{"id":124,"doc_module":4,"doc_module_name":25,"category_name":125,"show_sort_weight":124,"slug":126},10,"Lifestyle","lifestyle",{"id":128,"doc_module":4,"doc_module_name":25,"category_name":129,"show_sort_weight":97,"slug":130},19,"General","general",{"code":4,"msg":82,"data":132},{"doc_id":79,"user_id":133,"nickname":42,"user_avatar":134,"doc_module":4,"category_id":102,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":135,"file_id":136,"file_url":137,"file_type":138,"file_size":139,"view_count":55,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":118,"language":140,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":12,"update_tm":144,"read_time":103,"preview_page_count":33,"preview_urls":145},3985747862462,"https://ap-avatar.wpscdn.com/davatar_3d24733baf745e90a7e4bdd5f77d97b2","Learning Programming in Picat by Examples from Google Code Jam  \nNeng-Fa Zhou  \nFebruary, 2016  \nAbstract  \nPicat ([picat-lang.org](picat-lang.org)) is a logic-based multi-paradigm programming language that integrates logic programming, functional programming, constraint programming, dynamic programming with tabling, and scripting. Picat is underpinned by the same logic programming concepts as Prolog, but it is more efﬁcient, reliable, and convenient than Prolog. Picat integrates features from other languages, including arrays, maps, functions, list and array comprehensions, loops, and assignments. Picat's support for explicit uniﬁcation, explicit non-determinism, tabling, and constraints makes Picat more suitable than functional languages (such as Haskell and F\\#) and scripting languages (such as Python and Ruby) for symbolic computations. Picat can give a competitive edge for many applications. This article provides a quick introduction to Picat using examples from Google Code Jam (GCJ) .  \n1.1 Introduction  \nPicat is a simple and yet powerful logic-based multi-paradigm programming language for general-purpose applications. Picat's core is underpinned by logic programming concepts, including logic variables, uniﬁcation, and backtracking. Logic variables, like variables in mathematics, are value holders. A logic variable can be bound to any term, including another logic variable. Figure 1.1 gives the types of terms in Picat. Picat is a dynamically-typed language, which means that type checking occurs at runtime.  \nA variable name is an identiﬁer that begins with a capital letter or the underscore; for example, X1 and   abc are variable names. The underscore itself   is used for anonymous variables, and each occurrence of the underscore indicates a different variable.  \nAn atomic value can be an atom or a number. An atom is a constant symbol. An atom name can be either unquoted or quoted. An unquoted name is an identiﬁer that begins with a lower-case letter, followed by an optional string of letters, digits, and underscores. A quoted atom is a single-quoted sequence of arbitrary characters. For example, x1, x   1, ' abc', and 'a+b' are atom names.  \nA compound value can be a list or a structure ; for example, [a,b,c] is a list and  \nf(a,b,c) is a structure.1 Lists are singly-linked lists. A string is a list of characters; for example, \"a+b\" is the same as [a,'+',b] . An array is a special structure; for example, fa,b,cg is an array. A map is a special structure that contains a set of key-value pairs, and a set is a special map that contains only keys; both are hash tables.  \nEach type provides a set of built-in functions and predicates. Each of the type names in Figure 1.1, except term and set, is a type-checking predicate. For example, list(L) tests if L is a list. Let L be a compound term. The index notation L [I] is a special function that returns the Ith component of list L, with L [1] referring to the ﬁrst element of L. An index notation can take multiple subscripts. The cons operator [H|T ] builds a new list by adding H to the front of T. The concatenation operator L 1 ++ L2 returns the concatenated list of L 1 and L2.  \nIn Picat, predicates and functions are deﬁned with pattern-matching rules. Picat has two types of rules: the non-backtrackable rule Head ; Cond => Body, and the backtrackable rule Head ; Cond ?=> Body. In a predicate deﬁnition, the Head takes the form p (t1 ; : : : ; tn), where p is a predicate name, and n is the arity. The condition Cond, which is an optional goal, speciﬁes a condition under which the rule is applicable. For a call C, if C matches Head and Cond succeeds, then the rule is said to be applicable to C. When applying a rule to call C, Picat rewrites C into Body. If the used rule is non-backtrackable, then the rewriting is a commitment, and the program can never backtrack to C. However, if the used rule is backtrackable, then the program will backtrack to C once Body fails, meaning that Body ","cbCairTPkhujZAPf","https://ap.wps.com/l/cbCairTPkhujZAPf","pdf",227290,"English","# 1.1 Introduction\n## Logic variables and core execution model\n## Data types: atoms, numbers, lists, structures, strings, arrays, maps, sets\n## Built-in functions, indexing, and list operations\n## Rule types: non-backtrackable vs backtrackable\n## Function definitions and tabling for dynamic programming\n## Loops, comprehensions, and additional language features\n## Google Code Jam practice focus","[{\"question\":\"What programming paradigms does Picat integrate?\",\"answer\":\"Picat integrates logic programming, functional programming, constraint programming, dynamic programming with tabling, and scripting.\"},{\"question\":\"How do logic variables work in Picat?\",\"answer\":\"Logic variables act as value holders and can be bound to any term, including other logic variables, using unification and backtracking.\"},{\"question\":\"What is tabling in Picat and what does it enable?\",\"answer\":\"Tabling allows predicates and functions to store calls and answers, which supports dynamic programming solutions by reusing computed results.\"}]","Learning Programming in Picat by Examples from Google Code Jam - Article Introduction | PDF",1790735827,[146,150,154,158],{"page_no":22,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/4d977886a9cd3225862aa8a5faa21314.webp",983,1272,{"page_no":26,"url":151,"width":152,"height":153},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/f0115289a571708b2078a1fe091ab609.webp",982,1270,{"page_no":30,"url":155,"width":156,"height":157},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/a0b95a8cb1ccc831206d3a96379e5e06.webp",981,1269,{"page_no":33,"url":159,"width":160,"height":161},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/5ca0fe0aae407ee96e23ee99deccf73d.webp",980,1268,{"list":163,"token":11},[164,171,178,185,191,197,204,210,216,222],{"doc_id":165,"doc_title":166,"file_type":138,"home_preview_img_url":167,"slug":168,"view_count":169,"category_name":29,"create_tm":170},504950,"Picat - Programming Language Overview","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229932167978/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112119&Signature=dkAwspSDQtS4eg17Lo2zULXNjJ0%3D","picat-programming-language-overview",15,1791080548,{"doc_id":172,"doc_title":173,"file_type":138,"home_preview_img_url":174,"slug":175,"view_count":176,"category_name":29,"create_tm":177},504881,"A User’s Guide to Picat - Version 3.9 - Overview","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229931950051/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112119&Signature=Fiyw3cWIi1jF6%2B0OxoAyUNT1bK4%3D","a-users-guide-to-picat-version-39-overview",14,1791077220,{"doc_id":179,"doc_title":180,"file_type":138,"home_preview_img_url":181,"slug":182,"view_count":183,"category_name":29,"create_tm":184},451764,"Constraint Solving and Planning with Picat","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229925103740/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112119&Signature=hstguhmw8fAdr4uxjHiaVWaiRyI%3D","constraint-solving-and-planning-with-picat",12,1790735882,{"doc_id":186,"doc_title":187,"file_type":138,"home_preview_img_url":188,"slug":189,"view_count":111,"category_name":29,"create_tm":190},505016,"A Picat-based XCSP Solver - Overview of PicatSAT from Parsing, Modeling, to SAT Encoding","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229932209354/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112119&Signature=6jR8Luy7B97mp9jlNqAwAJ%2F9FGY%3D","a-picat-based-xcsp-solver-overview-of-picatsat-from-parsing-modeling-to-sat-encoding",1791086097,{"doc_id":192,"doc_title":193,"file_type":138,"home_preview_img_url":194,"slug":195,"view_count":169,"category_name":29,"create_tm":196},403651,"Week 1 - Programming Fundamentals - Basics & Conditionals","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229920231890/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112119&Signature=AkI1yWPvhyWTfkd%2FDij4S1qr2Ag%3D","week-1-programming-fundamentals-basics-conditionals",1790542223,{"doc_id":198,"doc_title":199,"file_type":138,"home_preview_img_url":200,"slug":201,"view_count":202,"category_name":29,"create_tm":203},410334,"Programming Paradigms - Part I - Haskell - The Craft of Functional Programming - Second Edition","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229921592848/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112119&Signature=ZlgqcMFOat0TOaKgrXGyVl03bcQ%3D","programming-paradigms-part-i-haskell-the-craft-of-functional-programming-second-edition",13,1790585005,{"doc_id":205,"doc_title":206,"file_type":138,"home_preview_img_url":207,"slug":208,"view_count":30,"category_name":29,"create_tm":209},697909,"Programming Languages - Principles and Practice - Third Edition","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010130355/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112119&Signature=Jv211k1qYXWrqB7XQSUIlp3FjGk%3D","programming-languages-principles-and-practice-third-edition",1794445799,{"doc_id":211,"doc_title":212,"file_type":138,"home_preview_img_url":213,"slug":214,"view_count":33,"category_name":29,"create_tm":215},697911,"Organization of Programming Languages - read online free","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230009210114/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112119&Signature=FqemysTuwUqpcAO8I6X0kr8kgfQ%3D","organization-of-programming-languages-read-online-free",1794445801,{"doc_id":217,"doc_title":218,"file_type":138,"home_preview_img_url":219,"slug":220,"view_count":169,"category_name":29,"create_tm":221},181279,"Beginning JavaScript - 5th Edition","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229877629328/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112119&Signature=bhKxIAnujN7WS9R%2FtlmFd4XJJdI%3D","beginning-javascript-5th-edition",1788344074,{"doc_id":223,"doc_title":224,"file_type":138,"home_preview_img_url":225,"slug":226,"view_count":55,"category_name":29,"create_tm":227},424685,"Basic Programming Terminology - Lesson 1","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229922629363/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796112119&Signature=A7EGAWuhOmnROD1Urbir4wG0cj8%3D","basic-programming-terminology-lesson-1",1790635064]