Skip to main content

All Questions

Tagged with
5 votes
1 answer
158 views

Ackermann-Péter function call count using Writer monad

I'm quite new to Monads and I tried add function call counting to the Ackermann function code. The goal was simplicity, not performance. I want to have code review on the ...
Arpad Horvath's user avatar
4 votes
1 answer
1k views

Generate possible combinations by range and length

I am learning Haskell and I implemented a recursive function that generates possible strings by length and array (e.g. ['a'..'z']): ...
Vlad Havriuk's user avatar
3 votes
2 answers
2k views

Haskell Function to get the List representation of an Integral

This is a simple practice problem. The task is to write a function getLR that receives an Integral, ...
Moritz Loritz's user avatar
1 vote
1 answer
58 views

Equivalent partition sums

I'm looking for feedback on my solution to the following prompt: Given an array of ints, return the index such that the sum of the elements to the right of that index equals the sum of the elements ...
cgoates's user avatar
  • 185
1 vote
1 answer
173 views

String tokenizer

Objective: Create a function called wordsAndSpaces that splits a string on groups of spaces, preserving each group of space characters as a single token. Example: <...
cgoates's user avatar
  • 185
1 vote
1 answer
252 views

"Sequence full of colors" challenge on HackerRank

This is the challenge: You are given a sequence of N balls in 4 colors: red, green, yellow and blue. The sequence is full of colors if and only if all of the ...
Enlico's user avatar
  • 507
2 votes
1 answer
169 views

Berlekamp–Massey Algorithm in Haskell

I was recently tasked to write an implementation of the Berlekamp–Massey algorithm (for GF2) from a given inductional proof and decided to fresh up on my Haskell, since converting a proof by induction ...
ljrk's user avatar
  • 919
2 votes
1 answer
142 views

Performing an action which may return other actions to be performed, concurrently

I have a program which, at its core, involves repeatedly performing an action on some value, and based on that action also returning a list of new values to perform that action on. The pure version of ...
Izaak Weiss's user avatar
1 vote
1 answer
4k views

The quicksort algorithm in Haskell

I am learning Haskell programming language mainly from this source. And there I have encouraged with "an elegant" realization of the quicksort sorting algorithm (the Quick, sort! section). ...
LRDPRDX's user avatar
  • 921
12 votes
1 answer
222 views

Solving alethic modal logic formulas using truth trees

Disclaimer: this first section is about alethic modal logic and truth trees. It's important to the question but significant parts of the code can probably be reviewed without it. You're welcome to ...
overactor's user avatar
  • 654
3 votes
2 answers
299 views

Segementing a recursive tree in haskell

Could somebody help me work out how to abstract the recursion from this code for me please? I'm trying to write something that takes a pandoc structure, and subdivides the tree whenever it finds a ...
danbroooks's user avatar
5 votes
1 answer
467 views

Haskell limit number of recursions

I want to create a monad which will prevent more than 10 instances of recursion (which I am implementing by preventing more than 10 instances of >>=). My <...
Xodarap's user avatar
  • 153
3 votes
1 answer
278 views

Parsing n lines to count vowels - HackerEarth

I have written a haskell program for the following 'Code Monk' Challenge at HackerEarth. Here is the challenge description. Basically, we are looking for the number of vowels in a string. The first ...
Jonathan Chouraki's user avatar
6 votes
1 answer
18k views

Filter Duplicate Elements in Haskell

I'm working on HackerRank to try to improve my Haskell skills along side with reading Haskell Programming from first principles. I wrote a program that works, but it seems to time out on large input ...
Eli Sadoff's user avatar
3 votes
2 answers
163 views

Count numbers whose digits are only increasing or decreasing

The goal is described here: basically, it is to compute the number of numbers below \$10^n\$ such that its digits are either increasing or decreasing (like 112 or 211, but not like 121). The original ...
awllower's user avatar
  • 131

15 30 50 per page