Questions tagged [functional-programming]

Functional programming is a paradigm which attempts to solve computational problems by the chained evaluation of functions whose output is determined by their inputs rather than the program state. In this style of programming, side effects and mutable data are deprecated.

Filter by
Sorted by
Tagged with
-3
votes
0answers
44 views

C program to print Pi basing on Madhava series [closed]

in this question, i have been tasked to write a program that prints pi basing on madava series, using pi() function and power() function. This is the source code i have written. ...
-1
votes
1answer
29 views

How to make my Clojure code more “funcional”?

I've started learning Clojure a few days ago and I wrote this code that factorises numbers. How do I make it better? Is there any way to avoid doing it with a loop? Is that how I am supposed to code ...
0
votes
2answers
40 views

Is My Function to Find Triplets in Scala running in O(N^2)

Given the classical problem to find triplets that sum to zero in an array. Is my Scala implementation correct and executed in O(N^2)? If yes, why? Can someone make a running time analysis. What other ...
-3
votes
0answers
29 views

Functions involving integrate [closed]

I'd like to define a function f(x), and then define another function that it its integral. from sympy import * x = symbols('x') f = lambda x: x**2 If I do this: <...
0
votes
0answers
25 views

Dominos [Python] CLI Game

Most concerned with improving efficiency and eliminating redundancy than anything else. a lot of Dominos rules have not been implemented yet. Any form of feedback is appreciated. ...
7
votes
1answer
122 views

A beginner's brainfuck interpreter in Haskell

I am rather new to haskell, and could use some feedback on my code and the decisions I had to make. In my previous project, I made a JSON parser, but relied heavily on guidance from a university ...
0
votes
2answers
35 views

Functional Programming Style in Javascript Picking a Random Item from an Array

I'm trying to understand the Functional Programming Paradigm (or style) implemented with Javascript. There are a few things I have difficulties with. The naming conventions, and dependency injections. ...
0
votes
1answer
16 views

Writing the scheme (functional programming) filter function

I know this is a bit elementary, but I am highly uncomfortable writing scheme code, and I want to make sure that what I'm doing is good practice. I know mutation is frowned upon in scheme. I have no ...
0
votes
0answers
5 views

Retrieving first non-private ip for local system in elixir

I've recently started learning elixir, and the following is my attempt at fetching the local IP address of the system. It can definitely be improved further, but as this would be my first ever project ...
1
vote
1answer
126 views

Tic Tac Toe (Haskell)

I implemented tic-tac-toe in Haskell. I'm trying to incorporate suggestions from my last question (which mostly revolved around algorithmic logic) while trying something new - IO logic. What kind of ...
0
votes
0answers
30 views

Refactor code following modular architecture for readability and maintainability

I don't know what the title should be, but I am having very hard time to refactor my codes. I need some insight and help. Here is the business requirements: An order needs to be created and processed. ...
4
votes
2answers
189 views

Connect-Four winner-checking algorithm

I'm trying to practice some functional techniques. I haven't worked much in Haskell, so any language-specific tips would be very appreciated, but what I care for even more are general tips towards my ...
2
votes
1answer
124 views

A Stateless Immutable Event-Driven DDD Pattern in Kotlin

I've been interested in making fully repeatable, reproducible game states. This led me into the world of DDD, and specifically, the concept of Aggregates + Event Sourcing (although that's not ...
4
votes
3answers
246 views

Split function using C and dynamic memory allocation

I have programmed a function to split strings, and it gives the expected output. I am looking forward to write better code and I was told here is a good place to start. Here's my program: ...
0
votes
0answers
43 views

Efficiently calculate value of Pascal's Triangle using memoization and recursion(updated)

Follow up to Efficiently calculate value of Pascal's Triangle using memoization and recursion Based on feedback given by jvwh in the answers ...

15 30 50 per page
1
2 3 4 5
64