Questions tagged [curry]

Curry is an experimental functional logic programming language, based on the Haskell language. It merges elements of functional and logic programming, including constraint programming integration.

Curry is developed as a universal programming language. It is closely related to Haskell but provides logic programming features. There are several implementations, and there are tools for both documentation and testing.

24 questions
23
votes
1 answer

What type systems can prevent goal suspension in logical languages?

From section 3.13.3 of the curry tutorial: Operations that residuate are called rigid , whereas operations that narrow are called flexible. All defined operations are flexible whereas most primitive operations, like arithmetic operations, are rigid…
user82928
  • 877
  • 7
  • 16
21
votes
4 answers

What is more interesting or powerful: Curry, Mercury or Lambda-Prolog?

I would like to ask you about what formal system could be more interesting to implement from scratch/reverse engineer. I've looked through some existing and open-source projects of logical/declarative programming systems. I've decided to make up…
Bubba88
  • 1,910
  • 20
  • 44
15
votes
1 answer

Why is the non-deterministic choice function in Curry's std lib not defined straightforwardly but rather with a helper 2-argument function?

Consider a function choose in Curry programming language with the specification that "(choose xs) non-deterministically chooses one element from the list xs". I'd implement it straighforwardly through two alternative non-deterministic rules: choose…
9
votes
1 answer

Function Returns "No Solution" Instead Of "Nothing"

I have a standard datatype representing formulae of predicate logic. A function representing a natural deduction elimination rule for disjunction might look like: d_el p q = if p =: (Dis r s) && q =: (Neg r) then Just s else if q =: (Dis r s) &&…
emi
  • 5,380
  • 1
  • 27
  • 45
8
votes
0 answers

Will whole Haskell be a part of Curry?

I found Curry on Wikipedia. It says Curry is nearly a superset but not because of lacking of something. I'd like to see it support whole Haskell. Did they plan to implement Haskell as a part of Curry?
user1065942
5
votes
1 answer

Curry compiler zinc cannot be configured

when I configure curry's compiler zinc, I get this: checking for Haskell 98 compiler... checking for ghc... ghc checking ghc version... 7.0 checking whether ghc supports Haskell 98... [1 of 1] Compiling Main ( conftest.hs, conftest.o…
user1065942
4
votes
2 answers

Compact vs full/verbose definition of the inverse combinator/operator in Curry

The rather fascinating 2013 introductory post to the Haskell based KiCS2 implementation of Curry by Wolfgang Jeltsch, A Taste of Curry, provides the following definition for the inverse combinator: inverse :: (a -> b) -> (b -> a) inverse f y | f x…
3
votes
1 answer

How do I translate Prolog's cuts to Curry?

Here's an algorithm in Curry which takes n and matches on two strings within edit distance n of each other. lev :: Eq a => Int -> [a] -> [a] -> () lev n (a : b) (a : c) = lev n b c lev n (_ : b) (_ : c) | n > 0 = lev (n - 1) b c lev n (_ : b) c…
Wheat Wizard
  • 3,982
  • 14
  • 34
3
votes
4 answers

"foop": a naming convention? It's a helper recursive function for "foo"; what does the suffix "p" mean?

I've come across the following code snippet (a function definition): choose (x:xs) = choosep x xs where choosep x [] = x choosep x (_:_) = x choosep _ (x:xs) = choosep x xs in Curry programming language in a "standard…
2
votes
2 answers

Haskell nested function order

I'm trying to write a function in Haskell to generate multidimensional lists. (Technically I'm using Curry, but my understanding is that it's mostly a superset of Haskell, and the thing I'm trying to do is common to Haskell as well.) After a fair…
2
votes
0 answers

Showing data types in Curry

Does Curry have the ability to show or pretty print data types inside the REPL (using PAKCS or MCC)? In Haskell, this functionality is impemented using the type class Show. However, no maintained Curry implementation implements type classes.…
emi
  • 5,380
  • 1
  • 27
  • 45
2
votes
2 answers

Is there any difference between an N-ary function in Curry and an N+1-ary relation in Prolog?

Curry, unlike its cousin Haskell, allows you to give multiple values to a function: foo 1 2 = 3 foo 1 2 = 4 and it does backtracking (or some other search) to explore the implications of such non-determinism. This makes it similar to Prolog…
MWB
  • 11,740
  • 6
  • 46
  • 91
2
votes
0 answers

"readline" (or "haskeline") for Curry?

What's the most practical way to write a program in Curry programming language that would have a console UI with decent line editing? Actually, I need to pass a string as a suggestion for the user's input, then let the user edit it in the console,…
2
votes
2 answers

Specifying default rules in the Curry language: Why and how?

In section 3.5.6 of the Curry tutorial (pdf), we are advised to use default rules to "regain control after a failed search". The following example is given. (For clarity I have added a type signature and curried the input.) lookup :: k -> [(k,v)]…
Jeffrey Benjamin Brown
  • 3,427
  • 2
  • 28
  • 40
1
vote
0 answers

Pow function in curry

I'm working with curry, and I'm using pakcs 2.2.1, and if I write 2^2 I get this error 2^2 PAKCS_Main_Exp.curry, line 2.18: Error: `^' is undefined ERROR occurred during parsing! If I use the most recent version of pakcs (3.3.0) I don't have…
Raul
  • 27
  • 2
1
2