11:05 AM
@200_success This runs fine:
test :: String
test = let io = getLine in "test"
I mean, it's dumb, sure

could you translate that to a language in English?
i don't even know how you read that

I'll try

public String Test() {
return "test"
}

@DanPantry test = "test" where io = getLine

11:09 AM
that's weird
thanks

It's supposed to be
the catch is, the readLine won't happen

The io = getLine is irrelevant because the io variable is never used.

So it would just be optimised away, likely, to test = "test"

Right.

Right?
Cool

11:10 AM
I should hope so :)
of course in other languages, you can't do that
since a function call can do more than just return a result

But there's a catch!

True, but some static analysis tools can determine dead code (well, unused results)
What's the catch?

Yeah, what's the catch?
I wrote a catch?

io = getLine, if it were live code, would not actually run getLine and assign the result to a variable named io.

ah yes

11:11 AM
Right, bcause it's an IO function?

Rather, it makes io an alias to the getLine function.

o
(╯°□°）╯︵ ┻━┻ screw this confusing haskell stuff
lol

Monking

Monking

It's no different from writing cosine = cos.

11:12 AM
I should really sit down and learn Haskell though, if for no other reason than the mentaility it would teach you

@DanPantry That was exactly my reason for diving in.
What better way than to learn a language where functional programming is all you have at your disposal?

@200_success How do you execute a function with no arguments then? Or is that not possible?

@JoeWallis since functions have no side effects

@JoeWallis all functions are pure ∴ you can't

there is no difference between functions with no parameters and values
if you do

11:14 AM
an invocation of a function that has no return value necessarily means you've made a side effect
so I would assume the haskell printline or whatever it is would return an IO?

@DanPantry There's no such things as functions without return values in Haskell
@DanPantry exactly

@overactor I know, that was my point

its type is
putStrLn :: String -> IO ()

IO empty tuple?

yeah
IO is like a box in haskell
IO String is an IO box with a String in it
getLine :: IO String
that's the type of getLine

11:17 AM
ah right
I was expecting something ilke IO<()> instead
but i forgot that haskell is allergic to most syntax characters

@DanPantry It does get a bit silly
everything just get put in sequence
space seperated

@JoeWallis A function with no arguments is just a constant value.

there's a certain elegance to it once you get used to it though
@200_success could be polymorphic though

Code review is not the same thing as code analysis — gliljas 51 secs ago

0

I'm a java beginner and I've just started learning about GUI. However, I'm not sure about GUI coding conventions and whether I'm getting the Object Orientation part of it right. I feel like I'm passing objects around different classes too much. I would like some critique on my code and I would a...

11:21 AM
@200_success Makes sense, since I was thinking of a function like f = lambda:'hi' it makes sense for it to just be a value.

So I just got ReSharper Ultimate for free thanks to my university email. :D

@JoeWallis Why is lambda syntax so verbose in python?

@JoeWallis Wait, I take that back. A pure function with no arguments is just a value.

I think I'll stay away from Haskell for the time being, my brain is rusty enough already..

@skiwi I'd like to get into Rust at some point

11:25 AM
@overactor No clue, it's advised not to use lambda for performance reasons, and is probably going to die when map and filter do.

I'm having pretty big troubles implementing a bit vector class unfortunately... The basic idea of a bit vector is simple and works, integrating it to work nicely with other parts of Rust is more of an issue

@JoeWallis They're throwing out map and filter?

@overactor Only Guido knows. Note that lambda is deliberately crippled such that it must be a one-line expression.

@overactor They planned on doing it on Python2 -> Python3 but just removed reduce.

@JoeWallis in favor of what?

11:26 AM
@overactor Comprehensions.

list comprehension?
How do you do something similar to a reduce in Python3?

@overactor from functools import reduce; reduce(...)

Didn't you say it got removed?

It's not removed. You're just not worthy of seeing it. =)

11:31 AM
Haskell has some unfortunate design decisions as well
Why isn't fmap called just map?

52

Everywhere I've tried using map, fmap has worked as well. Why did the creators of Haskell feel the need for a map function? Couldn't it just be what is currently known as fmap and fmap could be removed from the language?

2

Quoting from the Functor documentation at https://wiki.haskell.org/Typeclassopedia#Functor You might ask why we need a separate map function. Why not just do away with the current list-only map function, and rename fmap to map instead? Well, that’s a good question. The usual argument is t...

I figured that was the point
same reason Monads are not an extension of Applicatives

@overactor Because screw_map would be too long, presumably. /s
@overactor I understood some of these words.

@DanPantry heh

I know - basically - what a monad is
What's an applicative?

11:35 AM
Applicative Functors are cooler than Functors but less awesome than Monads

Applicatives are like boxes. where you can apply a function contained in such a box, can be applied to values in the same sort of box

Right.. so is fmap an applicative, then?

Not quite.

Perhaps I should say a List is an applicative

11:37 AM
fmap is a function that belongs to Functors
which are less powerful than applicatives
but lists are indeed applicatives

Right.
Thanks for the explanations btw

fmap is applying a normal function to a value in a box
no problem
it's very helpful to me too
but for historical reasons, this to be a Monad in Haskell, a type doesn't need to be an Applicative first
scratch that "this"
@200_success you're also somewhat active in the Swift tag, right?

12:01 PM
Monking

salutations

12:23 PM
6

@syb0rg Noice

@syb0rg congrats

@syb0rg well done
@syb0rg it was a cool answer, pattern matching with tuples for a FizzBuzz is quite clever

Ironically I've forgotten the very little swift I did know haha

You should get back in it, needs more activity
you can start by reviewing my question
4

I made a bunch of functions and an enumeration, that together allow me to write something like a switch expression. It's not as powerful as Swift switch statements, since it's lacking pattern matching and I don't intend to use this in real code, it was just an experiment. Here is what I got: enu...

:D

12:33 PM
@overactor Oofda that looks like way more complicated stuff than I ever knew
Right now I'm working on trying to tackle some of the unanswered questions on this site

@syb0rg a noble undertaking
matlab seems cool

> I believe (but cannot prove) that PHP developers have souls
3
lol

Other techniques can include code reviews (either on all changes or occasional ones) and mentoring new team members on the importance of good documentation. Or, the developers who write the SDK act as first-line support for the consumers of it. Poor documentation may result in more support queries, which reinforces the importance of well-written, usable documentation. — Richard Everett 40 secs ago

> I accept everyone, even the wretched and the huddled and people who enjoy Haskell
> This is a sorrow that lingers, because a 2^893 byte read is the only thing that both Republicans and Democrats agree is wrong.

i just wrote out a list of things that I want to do with the project API... and realised that I can't finish them by the time I leave. RIP

12:40 PM
@DanPantry How much time do you have left?

@DanPantry You got word from the job interview?

@overactor I haven't resigned yet, but if things go as planned, I'll be leaving early/mid september
@skiwi my culture one is tomorrow 7.30pm gmt

People at work want me to treat area codes and cities as one string :(

@overactor
we have a last name field that is varchar(15)
2
and lots of customers with double-barreled surnames that cut off at inconspicuous places

@DanPantry that's racist

12:42 PM
entity.surname = fullName.Split(' ').Last()
2
I'm not joking
2

0

I've created a simple python meter simulator which connects to a serial port (in my case COM1) listens on the serial port and takes actions based on what it receives. I'm looking for some advice regarding: unnecessary / wrong logic code that might be rewritten in a more concise / pythonic way ...

0

The following code doesn't work properly, I want to check after my mongoose findOne query if some subdocument in my object are defined. function cleanIfAny(social, value) { var name = social + '.id'; var query = {}; query[name] = value; User.findOne(query, function (err, fou...

@DanPantry oh boy
fails on my name

fails on plenty of names because the col only has a 15 char maximum

@DanPantry Oo hope it goes well

12:43 PM
@skiwi you guys will be the first to know, I owe it to you all for keeping me in sane all this time

Greetings, Programs.

@Zak believe me, I know, we have a colleague who doesn't even have a last name.
so we have to enter half of his name in the first name col and the other half in the last name :D

@DanPantry Where is quality control in this situation?

@syb0rg oh hun
you think we have a QA department
how cute
my team has no QA dept because we have no budget for it because we aren't customer facing :(

@DanPantry I don't know which of those two sentences deserves my 'wat'

12:45 PM
@Donald.McLean Greetings, human.

probably both

so the programmers the QA
and when those programmers are also doing user support, full stack development, architecture, migration to the cloud, etc, all in 8 hours.. :P

@DanPantry sounds like our company
but get this
no unit tests

@DanPantry you just described a day from my work
^_^

no coding standards

12:46 PM
@overactor We have a few, but nowhere near enough.

I almost prefer my company, where the entirety of the tech stack is just me, myself and I

@overactor Coding standards are overrated, IMO
People over processes
As long as you're consistent, it's okay

3 out of the 5 programmers are apprentices
1 finished his apprenticeship a year ago

I implement all these tests myself... but I'm not a QA department

@DanPantry we're not consistent

12:47 PM
@Zak I essentially manage the full stack. I manage the JavaScript, C# migration to .NET core, the architecture, also the adoption and training of Git, migration to the cloud, refactoring of both stacks, integration with other services and user support

@DanPantry How many developers does your company have again?

@Zak Our company has many
Our team has.. 4. And I'm the only javascript one (with any degree of seniority)

@syb0rg You have to prove that your code works, QA is there to break it despite you thinking that it works

2 of them are working on another project, and another works on the project with me (you may have heard me mention him once or twice here.. :))

@skiwi Challenge accepted

12:49 PM
Sorry, we have 5, another is working on refactoring an application written in Excel/VBA into... I'm not sure, Angular I think? They haven't started the new dev, it's just maint atm
oh I also help contribute towards refactoring the SQL side of things, so I guess I truly am full stack

@DanPantry How exactly has your company managed to survive this long? Genuinely curious.

Companies still survive by using emailed patches...

Also: Our sales people are really good, and the external customer facing team gets more budget than we do.

4

My naive version now is too slow. I think setting/accessing concurrent atomic bit is way slower compared to access/modify an array of boolean. Second, the parallel execution only happens on the beginning of the process. For bigger numbers, thread-pool is not really active. public class Eratosth...

even though all of our applications directly drive sales revenue

12:52 PM
Parallelizing the Sieve of Ethingy is an interesting problem ;)

btw, @Zak, that article you linked lol
> Do you see the difference between our lives? When you
asked a girl to the prom, you discovered that her father was a
cop. When I asked a girl to the prom, I DISCOVERED THAT
HER FATHER WAS STALIN.”

You know for sure that you're a full stack developer when you are THE ONLY developer.
5

Uh... using an atomic data structure when you are writing multi-threaded code is generally a terrible idea

@Donald.McLean I wouldn't say I'm the only developer, but I'm defniitely full stack in all but name and wear many, many hats.

Fun fact: Sieve of Atkin is faster than Sieve of Eratosthenes

12:53 PM
@syb0rg initially read it as "Sieve of Anakin". Am disappointed.

@DanPantry I was talking about myself.

@Donald.McLean o

3

Rename Sieve of Atkin to Sieve of Anakin and Sieve of Eratosthenes to Sieve of Darth Vader

close enough
And no, I didn't deface a Wikipedia page, I used my dev tools, you hooligans.

12:56 PM
> The Sieve of Atkin, also known as the "Sieve of Anakin" by some developers ...
@DanPantry I still checked haha

> I don't like composite numbers. They're coarse and rough and irritating and get everywhere.

> When it’s 3 A.M., and you’ve been debugging for 12 hours,
and you encounter a virtual static friend protected volatile
templated function pointer, you want to go into hibernation and
awake as a werewolf and then find the people who wrote the
C++ standard and bring ruin to the things that they love
Favourite line.

> 41. If a person has a title such as “Doctor”, they will have at most one such title. (In Germany, the over-educated go by names such as “Prof. Dr. Dr. Hans Schmidt” – a professor with two PhD’s)
@Zak virtual static friend protected volatile templated function pointer
Is that really a thing?!

Dr Dr sounds like a bad knock knock joke

> 43 – A person name in country-1 is the same as his name in country-2.

In Holland my name is Gert
In Denmark it is Gerardus
In Germany they refuse to try pronounce my name

1:01 PM
@skiwi You'd have to ask a systems engineer. I honestly have no idea.

LOL :D

If you ever get this working please take it to Code Review; as it currently stands there's a lot of room for improvement. — jonrsharpe 16 secs ago

@DanPantry What article is that?
pub struct BitSlice<S>([S]) where S: BitStorage;
I feel like I'm using some sort of black magic
My code compiles and I don't even know why

that looks dangerous
taking ownership of a slice of BitStorage?

@Mast What? You're kidding me?

1:11 PM
@DanPantry Not exactly, but maybe
> error: aborting due to 30 previous errors
error: Could not compile bit-vector.

@SimonForsberg I can see it.

Your code has no obvious bottlenecks..............suggest you repost here: codereview.stackexchange.com/questions/tagged/vbaGary's Student 32 secs ago

anyone here play with spec flow and Selenium in VS2015?

@DanPantry Yeah, other users said they could read it too, so it would be very strange if @Mast cannot.

1:25 PM
or any testing I guess
I think I am currently using xunit in conjunction with selenium and spec flow.

Debating if I should flag as spam: codereview.stackexchange.com/a/131967/27623
I don't think I should, since it declares affiliation

Looks like it definitely doesn't answer the question though

I flagged as not an answer and left a comment
You have presented an alternative solution, but haven't reviewed the code. Please explain your reasoning (how your solution works and how it improves upon the original) so that the author can learn from your thought process. — syb0rg 45 secs ago

Protip: If you tell me your users are nagging you about a feature being completed, it's not going to increase the speed at which I can write lines of code.

1:46 PM
0

I have these two queries: $db ->prepare("UPDATE users SET reputation = reputation + (CASE id WHEN ? THEN 2 WHEN ? THEN 15 END), Money = Money + (CASE id WHEN ? THEN ? WHEN ? THEN ? END) WHERE id IN (?, ?); ") ->execute(array($author_ques_id, ...

Great, when implementing my bit vector code so far I've gone into circles twice with each time understanding more and now realizing my approach may not be possible after all

Find it funny how I get someone demandign a feature be finished in ~10 working days and then also right next it get a help desk member demanding I answer a ticket

I find it funny sad that you don't have a manager

0

There is a full featured support of countable sets in .NET: IEnumerable<T>. What about uncountable sets; sets defined by predicate? How can they be manipulated and interact with IEnumerable<T>? Demo (you can click fork here and play with it online): using static System.Console; using static Sys...

I do

1:57 PM
@SimonForsberg I don't know why it's different now, but I can see it now while not being able to see it earlier.

@DanPantry Why are people bugging you then :(

@skiwi ¯\_(ツ)_/¯

It's probably de manager doing the bugging.

It's not

In that case you can send the buggers straight to your managers.

2:02 PM
Anyone worked with ActiveDirectory (in C#) before? Or anyone really love playing with strings?

It isn't an alternative solution; it's the accepted answer's modifications on top of the original poster, put into github/nuget so others can easily use it. — sethcall 3 mins ago
I don't think he knows how CR works

@syb0rg So essentially he stole the code?

@MichaelBrandonMorris In a way, kinda

I feel like being helpful to future me for once:

knowing me, I would have replaced that comment with

2:12 PM
0

I am just starting in python and i trying to write a rock paper scissors lizard spock game for 3 players in python and i can not figure out the scoring it tells me that the wrong player wins, the code is below and any ideas/help is much appreciated import random number_of_games = 3 print("Pla...

// you know nothing, jon snow

Is that PYTHON?
@DanPantry *jon

@overactor looks like it is P Y T H O N
because there's so much damn whitespace

Looks

like

it's

PYTHON

@overactor yes it does.
but the code formatting is so bad it hurts me

2:14 PM
My eyes are bleeding :(

turn your criticisms into a review :)

It has a bigger issue though, according to the asker, the code is broken.

correct :)

does anyone know if there is a way to "suspend" the current git commit session in vim?
like, sometimes I want to retain the current message but modify the commit or something

well, that's a nice way of remember it: blog.penjee.com/wp-content/uploads/2015/02/…

2:19 PM
It would be cool to make a bot that uses supervised learning to look at all the closed questions with their given reason, and then process incoming questions to give an indication whether or not it is off topic

'm guessin the only way is to continue the commit, then git commit --fixup HEAD or --amend -a --no-edit

@DanPantry open a new terminal window?

@Quill that's too easy.
therefore cheating
and this is windows, so no tmux

@syb0rg Seems a tad complex to me

@overactor over-engineering is fun

2:21 PM
@overactor I actually think it would be quite simple for a ML problem

If it's worth doing, it's worth overdoing.

Might be a neural net problem... have yet to learn about those in this course
I've been reading a book on them, but only know the basics

The only difference between science and screwing around is writing things down

There's no engineering like over-engineering.
2

2:25 PM
-3

I am just starting in python and i trying to write a rock paper scissors lizard spock game for 3 players in python and i can not figure out the scoring it tells me that the wrong player wins, the code is below and any ideas/help is much appreciated import random number_of_games = 3 print("Pla...

0

I have a method that generates some html, but it looks ugly to me. Maybe there are some better solutions for this? public static string GetReview(Quiz quiz) { StringBuilder sb = new StringBuilder(); string questionSection = string.Format( "<div class=\"alert ale...

Hi @dhairya-jaiswal, ask for a moderator to move your question to codereview stack. You'll have a better chance someone asking your quesiton — Andy K just now
@AndyK Code Review is for completed, working code only. Perhaps Game Development would be better? — Michael Brandon Morris 41 secs ago

Hi all

Hi @MichaelBrandonMorris mmmhhh... tons of people are putting half-baked code in code review ... ah youngsters ... Maybe game dev will be better... — Andy K 26 secs ago

@Neal Hello

@syb0rg Shalom

2:35 PM
@Neal howdy

0

If anyone could take a look and see if I could speed up the process any or make the code any cleaner. I'm not the best at programing - pieced this together via Google and trial and error. Declare Function EssVSetGlobalOption Lib "ESSEXCLN.XLL" (ByVal item As Long, ByVal globalOption As Variant)...

0

I'm working on converting a simple Python script into nodejs 4.4.5 with es6 features like Promises. The original Python script did the following: Contact a 3rd party SOAP service Attempt to retrieve results by calling various SOAP methods Display the results as a page that can be monitored by ...

@overactor Hola

@Neal guten Tag

Whaaaay I'm finally back to internet

@Vogel612 hi there

2:49 PM
@overactor hia

@Neal ohayou!

3:02 PM
0

I have an application in which I have multiple slow running prerequisite methods I need to call in order to have the data I need to continue. To try to speed this up I am doing this: Dictionary<string, string> processOptions = null; Dictionary<string, string> businessAreas = null; Dictionary<st...

0

I've written the following code to take data from the Excel file "Data" and use it for a mailmerge in a prepare Word template named "Template." I'm new to using VBA in word or Access, so any feedback in these areas is very welcome Sub AccessTransfer() Dim strPath As String Dim objAccess As Acce...

@overactor Salam

0

I was told that this was the spot for an earlier question I asked so here I am. I get the feeling with my code that I am stumbling in the dark until I get somewhere. I am getting to the final solution but it is taking a while and I feel like I could certainly be more efficient in how I solve pro...

3:19 PM
DO NOT Use your personal computer for work-related purposes. What are you going to do when you eventually leave your job and the company threatens to sue you for espionage if you don't agree to have the hard drive wiped along with any backups made since you started developing on it? — Zak 2 mins ago
Like, seriously, how is this not a thing people think about.

3:30 PM
0

The following function represents the electrostatic potential, in spherical coordinates, due to a ring of charge \$q=1\$ and radius \$R=1\$, placed in the plane \$x\$-\$y\$: $$\phi(r,\theta) = \sum_{n=0}^\infty \frac{r_\min^n}{r_\max^{n+1}} P_n(\cos\theta) P_n(0)$$ where \$P_n\$ are the Legend...

3:41 PM
0

Right now this function takes an excessively long time to run, please let me know how to make it more efficient. lunarCal is 144x7 and the dput for it is here. Here's the code: if(!require(pacman)) install.packages("pacman") pacman::p_load(lubridate) cat("Please make sure that birthday inputs ...

ohhhhhh my god the new GoT trailer..... paging @Mat'sMug
DO NOT Use your personal computer for work-related purposes. What are you going to do when you eventually leave your job and the company threatens to sue you for espionage if you don't agree to have the hard drive wiped along with any backups made since you started developing on it? — Zak 30 mins ago
Some companies allow you to work on your own PC @Zak
The main concern about them not letting me work on my own is because of virus etc concerns while connecting over VPN, not privacy

4:02 PM
I feel this question would be a better fit for codereview but I'm not 100% sure — TheLethalCoder 18 secs ago

now that's a punny title
24

Last time when I tried to come up with something easy that wasn't a duplicate, it ended up being way too hard.. So hopefully this time it's indeed something newcomers can try as well. Input: An array/list with integers/decimals. (Or a string representing an array with integers/decimals.) Outpu...

wrong site though
@DanPantry hands on ears ♪ LA LALA LALALALA LALA CAN'T HEAR YA LALA LALALA ♪
2

_queue.Queue.Enqueue(new QueueEntry<T>(message, messageKey));
No shame
I do what I want

0

I am creating a forum. It has sections. Each section has its own groups. I want to fetch all sections and their groups. But there is a problem with my code. plz check and tell me where the fault is. <?php // Database Configuration $_db['host'] = 'localhost';$_db['user'] = 'root'; \$_db['pas...

Why did this comment get 9 upvotes lol
Hello! Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you improve it! Please see our help center for more information. — syb0rg 2 hours ago
That's more than some of my reviews

@syb0rg That's more than most of my reviews.

4:16 PM
there, have a tenth one
> Congratulations, you've earned the 'Nice Comment' badge, ...nope.
6

It's an automatic comment too, it literally took me almost no effort to post haha
On a side note: I'm starting the third week of classes in this Machine learning course
Officially it's the class's second day
@CaptainObvious Die

@JeroenVannevel What is that doing exactly?

wrapping a message and queuing it onto the queue provided by the queueprovider

@JeroenVannevel Queueception? Or not really?

2
this looks so awesome
2

4:36 PM

Turn the sound on.
2

5:10 PM
I cannot comment on your implementation without seeing it. But if you have an implementation that is working and you're requesting a design/code review, you'd generally post that to codereview.stackexchange.com. — Rob 22 secs ago
2

5:36 PM
This seems to be an open-ended question about potential working code that you are trying to optimize. If that is the case, I would suggest moving the question to CodeReviewcricket_007 42 secs ago
2

-1

write a program in python language by take a 10 digit number from user and print the number of even numbers and odd numbers of that 10 digit number for example let the number be 1256986314 so even number in this 10 digit number is 5 and odd number in this 10 digit number is 5

2

5:53 PM
0

I would like to have every endpoint with parameters, method and endpoint url in one place, so it is easy when I want to change it. To register an account, it is POST /account with parameters email firstName lastName and password To log in, it is POST /account/login with parameters email and pas...

2

I'm voting to close this question as off-topic because it is requesting a code review of working code. This question should instead be posted on codereview.stackexchange.com4castle 1 min ago
2

Wtf
2
I leave for 5 minutes and the entire starwall is filled?
2