Tagged Questions
7
votes
2answers
208 views
Naive Bayes classifier
I just started learning Haskell, and I must say it is unlike anything else. As my first not-entirely-trivial piece of code I tried to write a simple Bayes Classifier. It is in two parts, a classifier ...
5
votes
1answer
217 views
Generic pure functions memoization
I like to create tools for memoization since it can sometimes be useful. I recently created a generic tool for memoizing pure functions results. Here is an example og how it works:
...
3
votes
1answer
80 views
Hangman game background image inefficient?
I'm making a Hangman game and it seems that my code doesn't provide me much freedom with using layouts. I added an image to my JFrame then I added a JPanel to my image which I'm using for all the ...
3
votes
2answers
104 views
Is there a better way to write these two nested loops in Erlang?
Since one month, I'm learning Erlang and I like it so much.
Today, I wrote an algorithm to solve a problem.
Some time ago, I used two nested for loops in C# to ...
3
votes
1answer
226 views
Idiomatic Clojure? Performant & functional enough?
Problem
Disclaimer: This is my first clojure function & I'm still busy finishing the last chapters of "Programming Clojure". Thanks! :)
I am writing a function to randomly flood-fill parts of a ...
1
vote
1answer
87 views
Finding an entry in a Hashmap
I've been playing around with functional programming for a while now and just started learning Clojure. So the problem I'm trying to solve is the following:
I have a tree-like hashmap of tasks where ...
1
vote
1answer
175 views
Jquery Geocoding Script
The rules for this script are simple:
If geocode is hit, then just geocode
If geocode and submit is hit, then geocode and then submit
If an autosuggest link is hit, then geocode instantly
In this ...
1
vote
1answer
73 views
Speeding up repetitive initialisation with structured data?
I need to speed up this code: it creates a multilinear function. I considered the below methods but no idea which with the largest benefit.
replacing dummy variables with things such as anonymous ...
1
vote
1answer
118 views
Optimize this Scheme-written chess engine module
I'd like to know how to optimize this by shadowing symbols 'lo and 'hi inside nested function f. I guess CPS conversion would solve this but how?
...
1
vote
0answers
140 views
Space and time complexity of operation on lists
I'm new to programming and even more new to Haskell. Below is a little tid-bit I wrote that operates on a bunch of lists. I am wondering if someone would be kind enough to walk through the function ...
0
votes
0answers
111 views
Optimizing my Quadratic Sieve, with advice on style?
I'm still new to Haskell, and I'd like others' opinions on optimizing my basic quadratic sieve, in addition to feedback on the code's clarity and functional style.
The ...