instruction
stringlengths
71
71.9k
I've written the larger part of an emulator for a 6502 CPU but my method of op-code decoding is giving me concern, mainly because of how long the method is getting but also because I need a variable for each code, I need to declare them three times and I've stuck them all in a very non-OO class. I wouldn't mind some s...
I've written some python code designed to take a csv of waypoints for a series of trips, and calculate the distance of each trip by the sum of the distance between the waypoints. An example csv might be: 9e77d54918dd25c3f9d2e5354ec86666,0,2015-10-01T14:14:15.000Z,45.0988,7.5811,, 9e77d54918dd25c3f9d2e5354ec86666,1,2015...
I've written a Python script that given a few arguments executes a build process bash script. def start(self): """ """ repository = Repository.query \ .join(Client) \ .filter(Client.id == self.client_id) \ .first() client = Client.query.filter(Clien...
I am parsing ICD-10 codes and have achieved a result that satisfies my base case, but I'm worried about how fragile my method is: import xml.etree.ElementTree as ET # A sample of the larger XML file I'm parsing data = '''<diag> <name>A00</name> <desc>Cholera</desc> <diag> <name>A00.0</name> <desc>Cholera due to Vi...
I am iterating over a list of environments but calling the same method each time. The only difference is the parameters are changing depending on what environment it is. The result so far is similar to the code below, i know this is not great but cant find a better way to solve it. Any ideas? foreach (var enviro...
This is the first time I tried to write some code in Python. I think it gives proper answers but probably some "vectorization" is needed import numpy as np import math import operator data = np.genfromtxt("KNNdata.csv", delimiter = ',', skip_header = 1) data = data[:,2:] np.random.shuffle(data) X = data[:, range(5)] ...
I have to implement an algorithm that generates a modified version of a Thue Sequence, being that there can't be any adjacent sub-sequence can repeat itself using the letters N,P and O. For example, NOPNO is a valid output but NOPNPNO is not because it repeats here NOPNPNO. I tried to approach the problem using backtra...
I recently graduated from a coding bootcamp, and while it was great for the most part - I feel like it was lacking in learning good coding technique. I recently built this Minesweeper game for node.js, and I would love some feedback! Here is the link to the GitHub repo. I really appreciate your time - the feedback w...
I was inspired to write this by a recent review of cutting pipes. The only thing I'm really iffy about is using the WriteCuts method. I couldn't figure out a way to Let listOfCuts() out of Class TwoByFour. Example If you want to build a table (out of 2x4s), you'll need 4 legs of x length 2 long sides of y length and 2...
I'm writing a very simple engine which I hope to use to create a game at some point and felt that I needed buttons to allow the user to select options in a menu, so I wrote up a rudimentary button class. Think of this as similar to Windows forms if you like. Whilst what I've produced works and I can detect the button ...
Titles is an array populated by numbers (1, 2 and 3). Depending on the number, a Square component should have a different background colour. Now, I don't think that having that the switch statements are the best way to make the condition. I'm sure there's a better way to make Square's background depending on the mapped...
I took a crack at making a Pokemon-style text battle game in Python 3 to practice object-oriented programming a bit, inspired this project on Reddit, but I did not follow every instruction. import random Type_Monster=['ice','fire','grass'] Possible_Monster_name=['Mulu','Lume','Manda','Bomna','Kasa','Kama','Mutswe',...
I wrote it this just for learning. Is there holes at this code? public interface ConcurrentStack<T> { //blocking void put(T t) throws InterruptedException; //blocking T poll() throws InterruptedException; //non-blocking put boolean offer(T t); //non-blocking get T take(); } class Con...
Here is my working attempt to allow multiple/infinite child record entries with the original parent post in .NET MVC. Any refactoring to simplify my code would be greatly appreciated: Controller: public ActionResult Create() { EquipmentLicense equipmentlicense = new EquipmentLicense(); equipmentlicense.Equipme...
It solves the problem listed here. How can I make this more efficient? import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static int getIndex(int x, int lastAns,Integer size) { return ((x ^ lastAns) % size); } public ...
I like to think I'm an intermediate programmer, but I learned to code with the Unity engine so I'm still getting used to not using it, and I've never had someone review my code before. I don't know any other programmers, most people in my town don't even have a computer. I'd appreciate it greatly if you'd be so kind an...
I wrote an algorithm to separate a DAG into disjoint sets of vertices. I was hoping to have some comments on algorithmic complexity and efficiency of the Python code. Notably, I don't like the adding and removing of components from the components list. g = {1: [3, 4], 2: [5], 3:[7], 4:[], 5:[], 6:[1], 7:[]} vertices =...
I decided to do a bit more in C# by writing two methods that find duplicates, one being a naive approach, and the other one utilizing the LINQ capabilities of C# as a form of learning and training. Below is my code, and I would appreciate any critiques of it in terms of style, design, and if there are more succinct way...
I'm learning to use MVC in my JavaScript apps and I thought it might be good practice to write my own MVC implementation. I'd like to know if you see any ways I could improve it or any potential issues I could run into using it. class Model { constructor() { this.listenerStorage = {}; } trigger(event) { ...
I've created a program that can send & receive a screenshot. However, I feel like my method is a little bit...inefficient. I have to write to the stream twice, because from what I've observed, in order for the image to form properly, I must know the exact file size aka. the length. So, what I do is write the length to ...
I would like to simulate delay over network, for that I have implemented a simple retarder (=introduce random delay while maintaining order of messages) using Boost to handle sending itself. It appears to work as intended. However, since parallel programming is not trivial especially when coupled with networking, I wou...
Microsoft Visual Studio offers a non-blocking concurrent queue class, concurrency::concurrent_queue, based on Intel's TBB. I am using this as a base for a blocking single producer, single consumer concurrent queue. I am overriding the push and try_pop methods: #include <concurrent_queue.h> /** * Single producer, singl...
Problem statement Two players - Alice and Bob. Alice needs to guess a number \$n\$, from range \$[1, N]\$, \$N \le 200\$ In \$i\$th turn, Alice guesses a number \$i\$ Bob chooses to tell the relation between \$i\$ and \$n\$ (\$n \lt i\$, \$n = i\$ or \$n \gt i\$). Bob could tell what he wants, unless it conflicts...
I have an iOS Swift app with 8 buttons that call the same segue, but this is very repetitive. How can I refactor so it uses the same function prepare? @IBAction func backButtonPressed(_ sender: Any) { self.vcWithType = VCtype.back.rawValue self.postion = "back" self.performSegue(withIdentifier: "showCategor...
I'm currently working on a project1 which will result in millions of FFTs being solved time and time again. I have a finished prototype in Python (using numpy, scipy, and the pyfftw3 package), but there are significant bottlenecks in calculation speed. I have been writing a GPU version using arrayfire, but there's stil...
I am trying to convert a BeautifulSoup4 HTML Table to a list of lists, iterating over each Tag elements and handling them accordingly. I have an implementation of this that works at a surface level using BeautifulSoup4. However, the code is getting repetitive and complicated needlessly, but every time I try to improve ...
The code I have created calculates an arrangement of math calculation functions, and I would like to see if there is any way I could improve it, especially the calculator function. The guide function also only works if you have the file on your computer so don't try using it. #include <iostream> #include <cmath> #inclu...
I am learning Java and this is my solution for a program that will read in a name from the command line and write it out 100 times furthermore words are never split up assuming that the console is 80 characters wide. Could someone please help me improve its quality? /** * Program to print command line argument 100 time...
I have a Data First Migration and have been struggling a little with storing an enum value as a string. (Im aware that enums should be stored as ints but, personally I have never liked this, yes enums are hard and fast values but I have always percived them to vary a little bit as the code evolves, i am therefore worri...
So since I'm just new with learning C (this is the second day now), I'd be very happy if someone could review my code: what I tried to do is: create a structure containing a string- and a length-property I want to create a function, that checks for the length of the string and sets the length property to the result ch...
I've written a variety of libraries that query and work with data from APIs. While the classes and objects being passed around vary from project to project, I'm generating GET requests in the same manner in each project. I have a basic method to generate a GET request: private string GenerateWebRequest(string conn) { ...
I made a simple web crawler, I know there's many better ones out there, but I thought rolling my own would be a valuable learning experience. The problem is that I think there's some things I could improve here. I commented the code best I could to explain what it's doing: import re, random, requests, threading, collec...
My project is supposed to be used as back-end for a simple to-do web app that lets you create an account, add, edit, complete, and delete todos. It could be used with some front end consumer like AngularJS (I'm not doing that because I don't like front-end). I used Spring Boot + H2 in-memory database (Hibernate) + Spri...
My code performs CRUD operations in PHP using OOP and dynamic queries. How can I completely separate HTML tables from this code? Db.php class Db { Protected $conn; public $table; public $fields; public $values; public $sql; public $array_keys; public $array_values; //put your code here public function __construct() ...
I'm really new to coding so I'm looking for a bit of feedback on this twin prime finder. She works pretty decent but I know it could be better. import math primes = [] def get_primes(lower, upper): for num in range(lower, upper): for i in range(2, num): if num % i == 0: break else: pri...
I have an app where users at some point select the amount of tasks they have completed. If they have only completed 3 or less then 3 tasks then I send an email to the system admin to inform them. But at the same time as the email is being sent the I want the data to be saved into the database. To achieve this I impleme...
I tried solving this /r/dailyprogrammer challenge in Rust. I'm a complete Rust beginner, and I'm sure I've made a lot of mistakes. I would be very thankful for any tips or help you might be able to provide. Here are a couple of points that I found awkward/confusing: In show_result, what I basically wanted to do was so...
This is implemented in Ms Access 2003. The Table "People" is a ODBC linked database table on a MSSQL 2008 server. The file generated can be imported into Mozilla Thunderbird contacts to have a contact list of everyone in the company ready. The entire thing is written under option explicit. This is mandated. Private Sub...
Summary: I am using an API which returns paged results. I want to have these results as Java 8 Stream and implemented a Spliterator for this purpose. I am using AWS S3 Java API to list objects in the S3 bucket. The API returns paged results: when I call client.listObjects(bucketName, rootKey) for the first time, I get...
So I have the getSessionNamespace method in the below class in which I am trying to return different scenarios but one json response. So my solution is to store the required message and status code in a response array and vary it depending on the situation. Is there a cleaner more obvious method? <?php namespace Drupa...
How can I make the following checksum algorithm more pythonic and readable? items = {1:'one', 2:'two', 3:'three'} text = "foo" # This variable may change on runtime. Added to allow the execution number = 1 # This variable may change on runtime. Added to allow the execution string = text + items[number] + " " + "trai...
I'd like a more elegant and readable (if possible using functional programming style) for collection filtering (groupToAdd and groupToDelete collection handling) Just getting rid of multiple _.findIndex() < 0 or _.indexOf() > -1 would make me happy const {wrap} = require('co'); const _ = require('lodash'); function* m...
I am not sure whether it is the right way or am I deleting the memory properly. I have seen here some custom implementation of linked list, I want to do it simple way. Can anyone please suggest is it right or not? Should I use shared ptr, even if I do it, how to implement it correctly. .hpp class Camera { Camera(...
Made the following regex strings to match for typical UTC dates. I'd appreciate it if you guys can let me know if it seems fine and not too lengthy. [1-2](0|9)\d{2}(?([0-0])0\d{1}|1[0-2])[0-3]\d{1} // yyyyMMdd [1-2](0|9)\d{2}-(?([0-0])0\d{1}|1[0-2])-[0-3]\d{1} // yyyy-MM-dd \d{2}(?([0-0])0\d{1}|1[0-2])[0-3]\d{1} // yy...
1Note: This is the first post in - hopefully - a series of posts I plan to make. Project background Schemey is a project I've been working on for the past 3-4 weeks. It is an implementation of a subset of the Scheme programming language. The project is still very new and most likely has bugs in certain parts(which is w...
So I got this code; public bool Guest { get { return GetValue("guest", true); } set { SetValue("guest", value); } } I am wondering if it would be possible to shorten that as I would like to keep the code very clean, I've tried some stuff public bool Guest => GetValue("guest", true) Bu...
I am trying to implement a merge of two sorted lists of integers in Python using only the basic list abstract data type operations. That is, I do not want to use sorted() which comes with Python. Could someone tell me if this code is alright? Also, am I correct to understand that it is linear to the core? That is, it u...
Consider the class AB below that is to be used as a simple customized list of A objects for lookup operations. Can this code be improved to avoid instantiating AB with an empty list [] (i.e., perhaps modify __add__ in some way)? class A(): def __init__(self, arg): self.arg = arg class AB(): def __init_...
The below code runs a t-statistic within a large dataframe (rnadf) based on masked values from another dataframe (cnvdf_maked). Before, I was putting my results into a dictionary and turning it into a pandas dataframe. These dataframes became too large for my memory, so I had to switch to writing the results to a fil...
As a clear copy of this question, I've written a Pokedex to teach myself the basics of classes, reading from files, using streams etc. I'd really appreciate some feedback on my approach as I'd like to get into good habits early on. I've got myself the Bjarne Stroustrup C++ book, so my learning should be a little more s...
I'm working on a Slack app that uses Slash Commands. I've been looking for an excuse to learn Go, but the online tour was a little slow paced so I tried jumping in with this project. I'm looking for advice on everything I can do to make this code as idiomatic as possible (that includes using libraries that might make ...
Consider the MCG with parameters: a = 23, M = 10^8 + 1, and let the seed be 47594118. (This is the original MCG proposed by Lehmer in 1948.) Apply the Kolmogorov-Smirnov test to the first 1000 random numbers (including the seed) from this generator. Compute the KS-statistic and find its p-value. What is your conclusio...
I'm currently writting a JS Library in order to create a form in HTML. This library need to be : Cross-browser, with compatibility with at least IE10 (earlier version can be considered as bonus) Multi language : you should be able to change the form language Able to load external javascript dependencies* Communicate ...
I have a functional class WordAnalyzer that uses espeak to grab the IPA phonetics of a word & uses that information to find rhymes & print the number of syllables: from difflib import SequenceMatcher from subprocess import check_output class AnalyzeWord: """ Uses espeak's output to get a word's phonetics & syl...
Description: Although shapes can be very different by nature, they can be sorted by the size of their area. Create different shapes that can be part of a sortable list. The sort order is based on the size of their respective areas: The area of a Square is the square of its side The area of a Rectangle is width multipli...
I am starting my studies with Ruby and OO and I have received a test to do about OO. I am looking for new ways to improve the scenario following object-oriented concepts. Is there a better way to develop this design applying polymorphism? Here is my problem: If the product is physical, I have to generate a shipping l...
This program is a basic pizza ordering program with seven topping options, four size options, and five crust options. It pulls the options from a database and populates the GUI on start. I connected the images saved in the program to the strings associated with each topping. I used a recursive method to stack the toppi...
I was trying to read data from a file and after processing data write it to another file. Reading and writing do not need much CPU time, so I think it would be better if I use multithreading and reduce running time. The code uses backgroundworker for showing process state and in DoWork it uses multithreading. I think i...
I've seen at least two recent PHP questions that would do well from a Model-View-Controller ('MVC' from here-on-out in this question) setup. Now, me, being the horrible person I am, I wanted to build one because it's been a while since I've done any actual PHP work, and as much trash as I have been known to talk about ...
I have a working Tic-Tac-Toe game, which requires two players. The game also keeps track of the result of each game and assigns score to each player based on the result of the game. For this, I have made use of structures: Player Structure typedef struct { int score[10]; char choice; char name[10]; b...
This is a follow-up for here. Problem Your friend John uses a lot of emoticons when you talk to him on Messenger. In addition to being a person who likes to express himself through emoticons, he hates unbalanced parenthesis so much that it makes him go :( Sometimes he puts emoticons within parentheses, and you f...
I am just trying to improve my coding and designing skills in C++ and for that I am trying to solve same age old problem of mapping a http request to method. Could you guys please look at my program and point me to mistakes I am doing with design and coding style? resource.hpp #include <functional> #include <string> ...
I've got two classes for getting a connection to the database and executing things, Class 'A' was made by me and Class 'B' was made by a colleague, we were wondering which one is better for use (Security, efficiency etc), that's why we are asking it here. Which one is better, and why is it? And how can we improve that ...
I created a dashboard that uses CanvasJS graphs to show data collected by embedded devices. My problem is to get the last ten documents from a cloudant DB for each one of the devices. I've already made a question to solve this problem by using a view, but looks like it isn't possible to do so. The function getDeviceLis...
I wrote some string-extensions: public static class RegexStringExtensions { public static string PatternReplace( this string seed, string pattern, Func<string, string> outPattern) { return Regex.Replace(seed, pattern, s => outPattern(s.Groups[1].Value)); } public static string ...
Having an array of objects, such as numbers, what would be the most optimal (Memory and CPU efficiency) way if finding a sub group of objects? As an example: demoArray = [1,2,3,4,5,6,7] Finding [3,4,5] would return 2, while looking for 60 would return -1. The function must allow for wrapping, so finding [6,7,1,2] woul...
if(selectedGroup == 0 && model.selectedParameterItem != null) { foreach (var i in model.selectedParameterItem) { parameters.Add(db.ParametersMethods.Where(f => f.ID == i).FirstOrDefault()); } methods.AddRange(methodlogicclass.GetMethodFromParameters(parameters)); ...
I have this helper method to check if 3 numbers match some of the valid results (XXX+bool, XXX, -XX, X-X, XX-, --X). const categoryNumber = (numbers, myBool, resultNumbers) => { const matches = numbers.map((val, index) => val === resultNumbers[index]); if (matches[0] && matches[1] && matches[2] && myBool) return 1;...
I've written a short Random Exam Generator program. There are 6 days, 3 time slots per day. One day can not have more than 2 exams. There will be 5 exams in total. I am fairly new to programming so I would like some feedback on how well this code is written, and if there are any ways to improve it. var exam_days = ...
I have a list of lines and I need to merge those who are similar (for example my machine vision script will return 3 small vertical line instead of one long vertical line). I came up with this. I'm not pleased with it, what do you think? import math class Point(): def __init__(self, x, y): """ Repr...
I have created the following class that is used to provide single instancing functionality to an application. It is called like: if (Helpers.SingleInstance.IsAlreadyRunning()) { Helpers.SingleInstance.ShowRunningApp(); return; } The idea of the class is to prevent the program from being ran twice and it does t...
I was recently solving a question on LeetCode platform to delete a node from a Binary Search Tree, I wrote the given below iterative solution, I was wondering if it was a good practice to add a return statement within every if else block, that way the control would never reach the end of the function, however doing tha...
I looked into possible ways to raise an error to generate an error when a slug already exist. This is the model: # models.py from django.db import models class Question(models.Model): title = models.CharField(max_length=100) slug = models.SlugField(max_length=100, db_index=True, unique=True) for which I use a ...
As part of a solution I have the following class createCSV. It is working as expected but I'm very much aware of my lack of experience with c# and OO programming: are there any obvious potential problems or simple refactors? (note: the use of a guid is a user requirement) using System.Text; using System.IO; using Syst...
I have some code that's meant to discern certain words in a list and then based on which word is in the list, do a mathematical operation on the numbers also found in the list. Here's my code: for (op in operations) { if (arrayses.letteros.indexOf(op) !== -1) { found = true; break; } } if (fo...
I have implemented a class which encapsulates a thread of execution and provides an interface to send messages to it. It is based largely on an article written by Herb Sutter in 2010. It also uses the pImpl idiom as described by Scott Meyers in Effective Modern C++. A comment on Stack Overflow from a guy with a high re...
I'm trying to pass a programming challenge where we are to replace all instances of a substring in a string until there are none left. So an input like Pibabakekezza bake Has output Pizza And if there is nothing left say so. I fail an unknown test case because I take longer than 1 second. //Rextester.Program.M...
I was trying to implement a deque using a singly LL when I realized that eject() (popping the tail element) wasn't going to work without a pointer to the previous element. A few implementations I've seen online seem to use a node struct as well as a queue struct, so I'm starting to think I might've really messed this t...
I'm writing a priority queue that stores a bunch of data with a value attached to the data, with \$O(1)\$ access to the data with the smallest value attached to it. I also need to be able to update said value any time I want (the setValue operation), which is a bit awkward to do with a standard binary heap. So I made t...
I've written a simple script to refresh the page when the page has been updated. How it works: The Javascript polls a PHP script and sends it the current URL and the current version, the PHP script then queries MySQL which returns the true version of the page. Here is the PHP if (isset($_GET['URL']) && isset($_GET['Cur...
I have wrote some code to store all possible configurations of a set of numbers in the sliding tile puzzle but the process of doing slow is very slow. Say, for instance, I have a sliding tile puzzle with the goal state of {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0} where the 0 represents the blank tile which other tiles ca...
This is kind of like a "word search" problem, the exceptions being that the words may not be in the grid and I am merely required to determine the number of total instances the search terms appear. Instructions: Given a two dimensional array of characters, determine the number of instances search terms occur horizontal...
I have recently started trying Java 8 and I am trying to solve problems as much possible using Java 8 lingo. I wrote the code for the Sparse Arrays problem on HackerRank and needed to know a few pointers regarding my code: Is it the right way to code in Java 8? How much more efficient is it than legacy Java programs? ...
I'm building the backend for a mobile app project. Below is my createComment controller. The challenge for me is that I want to send notifications out to the postAuthor and other commenters. If a user is either a postAuthor or commenter, and 20 users make a comment, I do not want there to be 20 notifications in their n...
This code displays images in a GridView. It allows the user to select an item at which point a custom checkbox is checked and the area around the image is highlighted a different color. (The image shrinks to show a highlighted border). I've been programming a while but I learned Java & Android in a bit of a vacuum so...
I'm taking and Android course and I would like to refactor the code for one of the exercises. The complete solution done by tutors is here. When I was doing this exercise by myself I was annoyed by those ifs with instanceofs and by the fact that class containing too much logic. Also, due to the fact this code used to ...
I'm learning TDD with Django and currently I'm testing my CreateView class. I feel like I'm not using best practices but am not sure on how to improve my code. test_reservation_create.py from django.test import TestCase from django.urls import reverse from reservations.models import Reservation from src.factories imp...
Problem statement: Find \$kth\$ largest element in the union of two sorted array, assuming that two sorted arrays are in ascending order. The size of two arrays are \$m\$, \$n\$. My introduction of the algorithm To solve the kth largest element in the union of two sorted array, there are three solutions; \$1\$: The tr...
I have an assignment to implemented a Quarantine project where I was left with the some unit tests and a skeleton of the implementation. I provided the solution below and get rejected from the interview. The feedbacks I get (I feel lucky that they provided, usually, they have legal issues) are, NO indicator of design...
I'm developing a Social Engineering Awareness Training Application. This is the focus of my thesis for my undergraduate degree. This will be a multi-part review request, however, if you want to see the entire application, it can be found on GitHub. For this request, I'm looking to see how my AuthController is set up an...
Problem statement Given a string \$S\$, find the number of "unordered anagrammatic pairs" of substrings. Input Format First line contains \$T\$, the number of testcases. Each testcase consists of string \$S\$ in one line. Constraints \$1 \leq T \leq 10\$ \$2 \leq length(S) \leq 100\$ String \$S\$ contains only the l...
I'm developing a Social Engineering Awareness Training Application. This is the focus of my thesis for my undergraduate degree. This will be a multi-part review request, however, if you want to see the entire application, it can be found on GitHub. For this request, I'm looking to see how my EmailController is set up a...
I am learning Java and this is my solution for a program that will read two numbers in the range of 0 to 99 and multiply them. Input numbers are given in natural language e.g. for input thirty-two ten it should return 320. I have tried to do my best. Could someone please review this and suggest improvements, if any? pa...
Problem Statement Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input: Digit string "23" Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]. Note: Although the above answer i...
Please take a moment and review my code and tell me how I did. This is the first time in my class (CSC 111) I've been given an assignment in which I had to use a lot of my own resources and develop most of it on my own. Write an application that prompts for and reads a double value representing a monetary amount. T...
I'm pretty new to templates, and admittedly I'm not particularly good at C++, but I've written a little container that does not move allocated objects once they are created, so you can use weak pointers to access elements, and be aware of their existence. I'm sure that much of it can\should be improved, but I lack the ...
100 Doors 100 doors is a relatively simple mathematical problem. If you have 100 doors that are initially closed, and follow this procedure: Walk past the doors 100 times, the first time you toggle every door (if the door is closed, you open it, and vice versa). The second time, you only visit every second door, the t...
I have worked out a code for graceful shutdown of a httplistener. However, I am not sure if its foolproof. Below I provide c# code and the powershell (v3.0) scripts I've used to run my tests... C# Code: using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Te...
I want to perform function composition like this: f(g(...(z(x) (y)); I have already compn: const id = x => x; const comp = f => g => x => f(g(x)); const foldr = f => acc => xs => xs.reduceRight((acc, x, i) => f(x) (acc, i), acc); const compn = foldr(comp) (id); I tried to derive the desired function from compn, b...
Still pretty new to coding. I posted that Twin Primes Finder the other day and you guys were a great help so thanks. Here's my quadratic equation solver: import math #variables for initial equation a = int(raw_input("Enter a:")) b = int(raw_input("Enter b:")) c = int(raw_input("Enter c:")) #variables for quad. equati...