Skip to main content

All Questions

6 votes
2 answers
1k views

Object immutability and persistence

While I was learning functional programming I have encounterd two for me very similar terms: immutability and persistence. Also I have read simular questions from stackoverflow, but I am still ...
DimitrijeCiric's user avatar
2 votes
2 answers
2k views

Designing the recursive solution

I understand the recursion and find it useful and intuitive while solving problems on trees but for many other problems recursion never fails me to leave puzzled. Recently I was solving the following ...
CodeYogi's user avatar
  • 2,186
5 votes
1 answer
393 views

How do you model has-a (aggregation) relationships in functional programming languages

Just to be on the same terms: Aggregation is a has-a relationship, where the owned components can exist independently of the owning component.E.g. a pond and some ducks swimming in it. A duck leaving ...
hgiesel's user avatar
  • 821
10 votes
2 answers
3k views

Data structure for two-dimensional board games in Functional languages

I am creating a simple MiniMax implementation in the functional programming language Elixir. Because there are many perfect-knowledge games (tic tac toe, connect-four, checkers, chess, etc), this ...
Qqwy's user avatar
  • 4,887
12 votes
2 answers
1k views

Workaround for implementing operations on doubly linked or circular data structures in languages with immutable data

I would like to learn how to make graphs and perform some local operations on them in Haskell, but the question is not specific to Haskell, and instead of graphs we may consider doubly linked lists. ...
Alexey's user avatar
  • 942
2 votes
1 answer
236 views

Time complexity of update and lookup in binary random access list

I'm trying to get through one of the exercises in Okasaki's "Purely Functional Data Structures," where he presents a zeroless binary numbers as a structure for random-access list, and asks to 9.6 ...
alf's user avatar
  • 131
14 votes
3 answers
7k views

Why do Haskell and Scheme use singly-linked lists?

A doubly linked list has minimal overhead (just another pointer per cell), and allows you to append to both ends and go back and forth and generally have a lot of fun.
Elliot Gorokhovsky's user avatar
8 votes
2 answers
1k views

How to handle complex calculated fields in an ORM

In our API we've got a few central datatypes which need to be "decorated" (so to speak) after retrieval from the database with calculated values. The database is accessed through an ORM which follows ...
moberemk's user avatar
  • 473
3 votes
0 answers
353 views

Lightweight data modeling vs traditional classes [closed]

I've heard a lot of talk about using lightweight data modeling as of late. Especially in relation to the Clojure programming language. What is it and how it differs from traditional classes regarding ...
user7610's user avatar
  • 429
1 vote
1 answer
814 views

What was the influence of Chris Okasaki's data structures on Scala? [closed]

I heard a friend say: The first real use of Chris Okasaki's book was in Clojure's data structures I heard another friend say: No, they influenced the design of Scala in quite a subtle way. My ...
hawkeye's user avatar
  • 4,859
22 votes
3 answers
4k views

How do purely functional programming languages deal with fast changing data?

What data structures can you use so you can get O(1) removal and replacement? Or how can you avoid situations when you need said structures?
zduny's user avatar
  • 2,633
1 vote
1 answer
451 views

Is there any practical algorithm / data-structure that can't be done with non-recursive Lambda Calculus augmented with foldl?

In my search for a practical non-turing complete programming language, I've been paying attention to lambda-calculus with disallowed self-application - that is, x x forbidden. After taking that ...
MaiaVictor's user avatar
  • 5,850
6 votes
4 answers
2k views

Why it is `(cons 1 (cons 2 (cons 3 nil)))` and not `(cons 3 (cons 2 (cons 1 nil)))` for [1,2,3]?

Is there any special reason that to construct list in Scheme you use (cons 1 (cons 2 (cons 3 nil))) instead of (cons 3 (cons 2 (cons 1 nil))) ? While the first seems more obvious because it reads ...
MaiaVictor's user avatar
  • 5,850
6 votes
2 answers
2k views

Is there any particular reason for the use of lists over queues in functional programming languages?

Most functional programming languages such as Scheme and Haskell use lists as their main data structure. Queues are identical to lists, except for the fact appending to the end - not to the begin - ...
MaiaVictor's user avatar
  • 5,850
16 votes
4 answers
4k views

Uses of persistent data structures in non-functional languages

Languages that are purely functional or near-purely functional benefit from persistent data structures because they are immutable and fit well with the stateless style of functional programming. But ...
Ray Toal's user avatar
  • 1,325

15 30 50 per page