Skip to main content
0 votes
0 answers
49 views

I want to make my mutually recursive functions stack-safe, but because they have different signatures - one traverses a list and other a tree(?) of sorts - I'm not clear how to go about this. Here's ...
joel's user avatar
  • 8,122
1 vote
2 answers
114 views

Here is the question from Mitchell Wand's Essentials of Programming Language: Exercise 1.19 [⋆ ⋆] (list-set lst n x) returns a list like lst, except that the n-th element, using zero-based indexing, ...
YCH817's user avatar
  • 123
Advice
0 votes
1 replies
78 views

Suppose a scenario where: you need to execute an expensive operation which can fail or succeed. the result of the operation is modeled by using a result object Result<T>. The result object ...
Enrico Massone's user avatar
Best practices
5 votes
3 replies
150 views

I had a nice idea of using applicative for nondeterministic financial modelling. Or maybe it is a simple case of sentization. So the basic example is to define newtype ValueRange. newtype ValueRange a ...
Dominik G's user avatar
  • 614
0 votes
1 answer
91 views

The task Given the following string¹ one ' two 'three four the required function should split it in 3 tokens (one, two three, and four), in agreement with how the bash shell does: $ function ...
Enlico's user avatar
  • 30.3k
0 votes
1 answer
124 views

tl;dr Ideally, I'd want the following "hello world" is split in "hello" and " world" " world" is split in "" and " world" "hello "...
Enlico's user avatar
  • 30.3k
4 votes
1 answer
115 views

The following program assumes that /path/to/mypipe is a named pipe, e.g. created via mkfifo /path/to/mypipe, with no readers/writers waiting yet, runs two threads, of which the main thread keeps ...
Enlico's user avatar
  • 30.3k
3 votes
2 answers
151 views

tldr; how does one deal with logic that depends on data that are too heavy to fetch up-front when subscribing to the functional core, imperative shell line of thought? Years ago I was inspired by Gary ...
oligofren's user avatar
  • 23.4k
3 votes
2 answers
104 views

If in a terminal I enter mkfifo /tmp/pipe echo hello > /tmp/pipe (which blocks) and in another I run the haskell program main = readFile "/tmp/foobar" >>= putStr then I see it ...
Enlico's user avatar
  • 30.3k
2 votes
1 answer
86 views

I'm reading the paper Selective Applicative Functors. So far I've read from page 16 out 29, and I think I've understood the gist of this abstraction, but I'm having some trouble with some basic ...
Enlico's user avatar
  • 30.3k
1 vote
2 answers
237 views

I’m working with large nested associative arrays in PHP and I need to apply transformations (like map, filter, reshape) immutably, meaning the original array should not be modified. The problem is ...
Dharm's user avatar
  • 21
1 vote
0 answers
120 views

Consider the following toy code which performs very simple (a few instructions) operations on a hot loop over a large amount of values: template<float (*f)(float)> void process_f(int count, ...
F.X.'s user avatar
  • 7,515
0 votes
1 answer
59 views

I am having trouble getting the following code to work. I got it to work originally, then I changed it so all the Nonterminals also have positions. And I added the method parseLexeme that transforms ...
Jacob Bauer's user avatar
1 vote
1 answer
108 views

I've created a small library called StreamX, which acts like a type-safe, index-aware zipper to enable parallel streaming over multiple lists. It supports functional operations like forEach, map, ...
M S's user avatar
  • 19
7 votes
2 answers
206 views

In Haskell in Depth, Chapter 11, there's an example aimed at avoiding character escaping in GHCi, which is what happens automatically when you enter print "ë", as it'll be printed like "...
Enlico's user avatar
  • 30.3k

15 30 50 per page
1
2 3 4 5
1283