6
votes
1answer
184 views

BBCode to HTML converter using functional programming

I was inspired to write a BBCode to HTML converter as I'm currently learning functional programming. I wanted achieve functional cohesion. jsFiddle I'd like feedback on: structuring of the code. ...
6
votes
2answers
46 views

Refactor module for calls to internal image service

Looking for help refactoring the following code to follow a Functional Programming paradigm. The first function builds a configuration object with default settings and optional presets, while the ...
2
votes
1answer
37 views

Aggregation of a collection of object's nested array-properties

Use Case So our lead programmer loves to follow the NIH Anti-Pattern and consequently I'm not allowed to use Underscore.js and can only use Vanilla JS... and we have to support IE8. The goal is to ...
3
votes
3answers
164 views

Better way to write this code in functional manner using map and reduce?

I have an array of items on which I have to perform 2 tasks: Applying a function on the array item Checking if the value is true or false. The functional approach to solving this would be ...
4
votes
1answer
572 views
5
votes
1answer
332 views

Project Euler question 2 in CoffeeScript

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. ...
4
votes
1answer
224 views

Functional linked list

I'm looking for feedback in general: code correctness, best practices, design patterns; everything you think about this. Is it bad code? Where can it be improved? I've been implementing functional ...
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 ...
3
votes
1answer
121 views

The eternal dilemma: bar.foo() or foo(bar)?

I was using foo(bar) as it's adopted for functional programming. ...
10
votes
1answer
620 views

Optimizing and consolidating a big jQuery function

I understand this is a very vague question and a lot of code to look over. My question is basically: I have all these functions that work together to create functionality on a page: is the structure ...
3
votes
1answer
200 views

Functional Sundaram's sieve

I wrote this Sundaram's sieve in Coffeescript to quickly generate prime numbers up to limit: ...
1
vote
1answer
76 views

mapping & loops - counting up or counting down

I am building a time tracking application and my requirement says that any hours past 40 total should be counted as overtime and not regular hours. Which function is more clear? What can be done to ...
6
votes
3answers
250 views

Overusing JavaScript closures?

I've finally gotten around to learning Lisp/functional programming. However, what I've noticed is that I'm trying to bring ideas back into JavaScript. Example Before ...
1
vote
1answer
319 views

Solution to 99 lisp problems: P08 with functional javascript

Solution to 99 lisp problems: P08, with functional javascript If a list contains repeated elements they should be replaced with a single copy of the element. The order of the elements should not ...
3
votes
3answers
131 views

Functional way to write this code

I have a pan control that look like this: Pretty standard Google Mapsish controls, IMO. When the user clicks in the top 3rd of the control, it should pan up (deltaY = +1); right third means it ...