Skip to main content
Top
Published in:
Cover of the book

2016 | OriginalPaper | Chapter

Programming in Picat

Activate our intelligent search to find suitable subject content or patents.

search-config
loading …

Abstract

Picat (picat-lang.org) is a logic-based multi-paradigm programming language that integrates logic programming, functional programming, constraint programming, and scripting. Picat takes many features from other languages, including logic variables, unification, backtracking, pattern-matching rules, functions, list/array comprehensions, loops, assignments, tabling for dynamic programming and planning, and constraint solving with CP (constraint programming), SAT (satisfiability), and MIP (mixed integer programming). These features make Picat more convenient than Prolog for scripting and modeling, and more suitable than functional languages (such as Haskell and F#) and scripting languages (such as Python and Ruby) for symbolic computations. This article provides a quick introduction to Picat using examples from Google Code Jam (GCJ).

Dont have a licence yet? Then find out more about our products and how to get one now:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Footnotes
3
The minof predicate, which takes another predicate call as the first argument, is called a higher-order predicate. Picat provides several higher-order built-ins. For example, maxof( Goal,Exp ), find_all( Template,Goal ), and count_all( Goal ).
 
4
The function permutations( L ), which is defined in the util module, returns a list of permutations of L.
 
7
Picat does not issue singleton variable warnings for variable names that begin with the underscore _.
 
Literature
1.
go back to reference Appa, G.M., Pitsoulis, L., Springer, H., Williams, P.: Handbook on Modelling for Discrete Optimization. International Series in Operations Research & Management Science. Springer, New York (2010) Appa, G.M., Pitsoulis, L., Springer, H., Williams, P.: Handbook on Modelling for Discrete Optimization. International Series in Operations Research & Management Science. Springer, New York (2010)
2.
go back to reference Armstrong, J.: Programming Erlang, 2nd edn. Pragmatic Press, Dallas (2013) Armstrong, J.: Programming Erlang, 2nd edn. Pragmatic Press, Dallas (2013)
3.
go back to reference Barták, R., Dovier, A., Zhou, N.-F.: On modeling planning problems in tabled logic programming. In: Proceedings of the 17th ACM International Symposium on Principles and Practice of Declarative Programming, PPDP 2015, pp. 31–42 (2015) Barták, R., Dovier, A., Zhou, N.-F.: On modeling planning problems in tabled logic programming. In: Proceedings of the 17th ACM International Symposium on Principles and Practice of Declarative Programming, PPDP 2015, pp. 31–42 (2015)
4.
go back to reference Colmerauer, A.: Equations and inequations on finite and infinite trees. In: Proceedings of FGCS, pp. 85–99. ICOT (1984) Colmerauer, A.: Equations and inequations on finite and infinite trees. In: Proceedings of FGCS, pp. 85–99. ICOT (1984)
5.
go back to reference Debray, S.K.: Static inference of modes and data dependencies in logic programs. ACM Trans. Program. Lang. Syst. 11(3), 418–450 (1989) CrossRef Debray, S.K.: Static inference of modes and data dependencies in logic programs. ACM Trans. Program. Lang. Syst. 11(3), 418–450 (1989) CrossRef
6.
go back to reference Dymchenko, S., Mykhailova, M.: Declaratively solving Google Code Jam problems with Picat. In: Pontelli, E., Son, T.C. (eds.) PADL 2015. LNCS, vol. 9131, pp. 50–57. Springer, Heidelberg (2015) CrossRef Dymchenko, S., Mykhailova, M.: Declaratively solving Google Code Jam problems with Picat. In: Pontelli, E., Son, T.C. (eds.) PADL 2015. LNCS, vol. 9131, pp. 50–57. Springer, Heidelberg (2015) CrossRef
7.
go back to reference Hanus, M.: Functional logic programming: from theory to Curry. In: Voronkov, A., Weidenbach, C. (eds.) Programming Logics. LNCS, vol. 7797, pp. 123–168. Springer, Heidelberg (2013) CrossRef Hanus, M.: Functional logic programming: from theory to Curry. In: Voronkov, A., Weidenbach, C. (eds.) Programming Logics. LNCS, vol. 7797, pp. 123–168. Springer, Heidelberg (2013) CrossRef
10.
go back to reference Malik, S., Zhang, L.: Boolean satisfiability: from theoretical hardness to practical success. Commun. ACM 52(8), 76–82 (2009) CrossRef Malik, S., Zhang, L.: Boolean satisfiability: from theoretical hardness to practical success. Commun. ACM 52(8), 76–82 (2009) CrossRef
11.
go back to reference Nethercote, N., Stuckey, P.J., Becket, R., Brand, S., Duck, G.J., Tack, G.: MiniZinc: towards a standard CP modelling language. In: CP, pp. 529–543 (2007) Nethercote, N., Stuckey, P.J., Becket, R., Brand, S., Duck, G.J., Tack, G.: MiniZinc: towards a standard CP modelling language. In: CP, pp. 529–543 (2007)
12.
go back to reference Rossi, F., van Beek, P., Walsh, T.: Handbook of Constraint Programming. Elsevier, Amsterdam (2006) MATH Rossi, F., van Beek, P., Walsh, T.: Handbook of Constraint Programming. Elsevier, Amsterdam (2006) MATH
13.
go back to reference Van Roy, P., Haridi, S.: Concepts, Techniques, and Models of Computer Programming. MIT Press, Cambridge (2004) Van Roy, P., Haridi, S.: Concepts, Techniques, and Models of Computer Programming. MIT Press, Cambridge (2004)
14.
go back to reference Schimpf, J.: Logical loops. In: Stuckey, P.J. (ed.) ICLP 2002. LNCS, vol. 2401, pp. 224–238. Springer, Heidelberg (2002) CrossRef Schimpf, J.: Logical loops. In: Stuckey, P.J. (ed.) ICLP 2002. LNCS, vol. 2401, pp. 224–238. Springer, Heidelberg (2002) CrossRef
15.
go back to reference Warren, D.S.: Memoing for logic programs. Commun. ACM, Special Sect. Logic Program. 35, 93–111 (1992) MathSciNet Warren, D.S.: Memoing for logic programs. Commun. ACM, Special Sect. Logic Program. 35, 93–111 (1992) MathSciNet
16.
go back to reference Zhou, N.-F.: The language features and architecture of B-Prolog. Theory Pract. Logic Program., Special Issue Prolog Syst. 12(1–2), 189–218 (2012) MathSciNetCrossRefMATH Zhou, N.-F.: The language features and architecture of B-Prolog. Theory Pract. Logic Program., Special Issue Prolog Syst. 12(1–2), 189–218 (2012) MathSciNetCrossRefMATH
17.
go back to reference Zhou, N.-F., Bartak, R., Dovier, A.: Planning as tabled logic programming. Theory Pract. Logic Program. 15, 543–558 (2015) MathSciNetCrossRef Zhou, N.-F., Bartak, R., Dovier, A.: Planning as tabled logic programming. Theory Pract. Logic Program. 15, 543–558 (2015) MathSciNetCrossRef
19.
go back to reference Zhou, N.-F., Have, C.T.: Efficient tabling of structured data with enhanced hash-consing. Theory Pract. Logic Program. 12(4–5), 547–563 (2012) CrossRefMATH Zhou, N.-F., Have, C.T.: Efficient tabling of structured data with enhanced hash-consing. Theory Pract. Logic Program. 12(4–5), 547–563 (2012) CrossRefMATH
21.
go back to reference Zhou, N.-F., Kjellerstrand, H., Fruhman, J.: Constraint Solving and Planning with Picat. SpringerBriefs in Intelligent Systems. Springer, Heidelberg (2015) CrossRef Zhou, N.-F., Kjellerstrand, H., Fruhman, J.: Constraint Solving and Planning with Picat. SpringerBriefs in Intelligent Systems. Springer, Heidelberg (2015) CrossRef
22.
go back to reference Zhou, N.-F., Sato, T., Shen, Y.-D.: Linear tabling strategies and optimizations. Theory Pract. Logic Program. 8(1), 81–109 (2008) MathSciNetMATH Zhou, N.-F., Sato, T., Shen, Y.-D.: Linear tabling strategies and optimizations. Theory Pract. Logic Program. 8(1), 81–109 (2008) MathSciNetMATH
Metadata
Title
Programming in Picat
Author
Neng-Fa Zhou
Copyright Year
2016
DOI
https://doi.org/10.1007/978-3-319-42019-6_1

Premium Partner