Our department (PL and compiler construction) again offers a summer
internship in 2019 sponsored by DAAD Rise Germany [1]. Undergraduate
students enrolled at North American, British and Irish universities are
eligible to make an application. We'd be very happy to host a motivated
student, who is keen to improve our compiler for the functional logic
programming language Curry in terms of performance. For more information
you may have a look at our project poster [2]. If you have any
questions, feel free to mail any of the contact persons.
Please also spread the news to your students and classmates.
Cheers,
Sandra and Finn
[1]: https://www.daad.de/rise/en/rise-germany/
[2]: https://www-ps.informatik.uni-kiel.de/~sad/DAADRise.pdf
I posted this question on Stackoverflow[1] yesterday and haven't received
any answers yet. I've duplicated the question below, but an answer posted
to StackOverflow would be more useful to future students, if you're so
inclined.
Thanks!
---
In section 3.5.6 of the Curry tutorial (pdf)
<https://www.informatik.uni-kiel.de/~curry/tutorial/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)] -> Maybe v
lookup key (_++[(key,value)]++_ ) = Just value
lookup’default _ _ = Nothing
I can't get that to compile unless I replace the ’ with a '. Once I do, it
behaves like this:
test> test.lookup 1 [(2,3)]
*** No value found!
Question 1: What is the default declaration for?
Why would you need to specify that a particular clause is the default one?
Won't it be arrived at one way or another, once the others fail?
Question 2: How is it written? Should it be written at all?
If instead I drop the string 'default:
lookup :: k -> [(k,v)] -> Maybe v
lookup key (_++[(key,value)]++_ ) = Just value
lookup _ _ = Nothing
it behaves as intended:
test> test.lookup 1 [(2,3)]
Nothing
test>
Has the 'default syntax changed since the tutorial was written? Has it been
removed altogether?
[1]
https://stackoverflow.com/questions/53357361/specifying-default-rules-in-th…
--
Jeff Brown | Jeffrey Benjamin Brown
Website <https://msu.edu/~brown202/> | Facebook
<https://www.facebook.com/mejeff.younotjeff> | LinkedIn
<https://www.linkedin.com/in/jeffreybenjaminbrown>(spammy, so I often miss
messages here) | Github <https://github.com/jeffreybenjaminbrown>
I want to write something resembling an editor for a graph database. I'm
wondering if Curry will be fast enough.
The data defining the graph would resemble the following:
type Address = Int
data Graph = Graph {
address :: Map String Address
content :: Map Address String -- `address` and `content` are inverses
children :: Map Label (Set Address)
parents :: Map Label (Set Address) }
I would define rules such as:
descendent :: Graph -> Index -> Index
descendent g i
-- If j is i's child, then j is i's descendent.
| Set.member j $ Map.lookup i $ children g
= j
descendent g i
-- If j is i's descendent and k is j's child, then k is i's descendent.
| descendent g i j
& (Set.member k $ Map.lookup k $ children g)
= k
I'll use hash maps unless their space requirements stop me.
I'm hoping the resulting code will quickly (say, in under a second) answer
queries over a few million nodes, along the lines of "the descendents of X
and Y, minus any descendents of Z or W". If an unbounded number of
generations proves computationally difficult, I would not be bothered by
needing to impose depth limits, ala "the first two generations of
descendents of X and Y, minus the first seven generations of descendents of
Z or W".
The graph would be sparse: with an average number of children well under
five, and few cycles.
Is this kind of performance a reasonable thing to expect from Curry? If so,
using which compiler? If not, can you recommend another language?
I know Haskell, and prefer it immensely to any other language. I am
reluctant to write a full application in a pure logic language like
Mercury, but I will if need be.
--
Jeff Brown | Jeffrey Benjamin Brown
Website <https://msu.edu/~brown202/> | Facebook
<https://www.facebook.com/mejeff.younotjeff> | LinkedIn
<https://www.linkedin.com/in/jeffreybenjaminbrown>(spammy, so I often miss
messages here) | Github <https://github.com/jeffreybenjaminbrown>