[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 333
Thread images: 23

File: output4.webm (2MB, 1280x720px) Image search: [Google]
output4.webm
2MB, 1280x720px
old thread: >>56033133

What are you working on, /g/?
>>
>>56040962
On web based controller for mpd problem is im not web dev so i cant make nice UI in this shit... Any ideas?
>>
C++ is an amazing multi-paradigm language with no competition
>>
>>56040962
>made before the bump limit
Weebshits getting desperate
>>
>>56040999
Made exactly at 310 posts, you autist.
>>
>>56040999
When will the DPT OP WARS end?
>leave for 2 years
>war still ongoing

will there be a documentary about it one day?
>>
>>56041004
No, linked at exactly 310, but made 10 posts early, you autist.

>>56040962
What does that even have to do with programming?
>>
>>56041013
post 309: 01:43:51 EST
this thread: 01:44:16 EST
post 310: 01:44:29 EST

stop posting
>>
hey haskellfags
is
anime = "shit"


a function?
>>
>>56041034
Its a function of your bad taste and general pajeetery
>>
>>56041027
>lying on an anonymous image board
>>
I really don't understand functional programming.

How would you write a program that writes a 32-bit integer to a 28-bit integer spread over 4 bytes where the most significant bit of every byte is skipped?

And how could you could do this in a pure way without using state?
>>
>>56041053
Answer is monads, but seriously if you need to do that dont. Use tool appropriate for that, use C
>>
>>56040962
I'm writing a Discord bot for my server since mobile versions lack a lot of administrative features plus it's fun Python exercise. I'm modelling it after BotServ's ZBot. Uses sqlite for persistent data (fantasy commands).
>>
>>56041041
is there any redeemable quality to anime that can overshadow the bad plots, the awful voices, the bipolar characters and poorly drawn people in it?
>>
>>56041075
Has anyone ever written an ERP bot?

You should write an ERP bot.
>>
File: 1411967877361.jpg (275KB, 1300x1734px) Image search: [Google]
1411967877361.jpg
275KB, 1300x1734px
What's the best version available (for free) of "Cracking the coding interview" that I can get? And where can I find it?
>>
>>56041075
How is writing a bot done?
>>
>>56041053
>How would you write a program that writes a 32-bit integer to a 28-bit integer spread over 4 bytes where the most significant bit of every byte is skipped?
?
You split your number into array/list of bits
After that it is elementary
>>
>>56041089
In case you missed, yea it is a function

There is quality anime dont watch weebo shit, its like judging all tv shows by spanish tele novelas or something...
>>
>>56041089
You're watching seasonal trash.
Low-budget low-impact slice of life, harem and cute girls doing cute things anime is an acquired taste and you can't really learn to appreciate it until you've watched more anime.

Go watch some overrated, well-loved entry-level anime before attempting to watch cute girls doing cute things seasonal trash.
>>
>>56041089

Try watching anime that aren't shit. I recommend Shin Sekai Yori.
>>
File: IhIgE.jpg (358KB, 630x775px) Image search: [Google]
IhIgE.jpg
358KB, 630x775px
>>56041089
it's the best form of escapism i've found so far. Perhaps i'll move to VR once it's developed enough.
>>
>>56041053
Regarding state (your problem could be done without thinking about state)

Think of it this way
You have a function F and want it to use a state
So instead, you make this function return a function (that takes the state as a parameter)

F ... params ... = \state -> ... result ...

e.g., we want to increment our input by our state
F x = \state -> x + state

So we can then "run" this by doing
let result = (F x) state


Now this isn't very useful - we want to be able to change the state, obviously
So rather than returning 1 value, we also return the new state
F x = \state -> (x + state, state)

Now we can get out the result (on the left) and the new state (on the right)
let (result, state2) = (F x) state


So lets say we've got a function G that does the opposite of F
G increments the state by the parameter, and returns nothing (i.e. void) (we'll use the unit type () to represent void
G x = \state -> ( (), state + x)


Now we can call this to increment our state
let (result, state2) = (G x) state
-- result = (), we could just as easily avoid naming it, i.e.
let (_, state2) = (G x) state

-- we could also have just taken the result of our earlier function by doing this
let (result, _) = (F x) state


Now obviously it's not very convenient to do this:
let state1 = 0 in
let (_, state2) = (G 3) state1 in -- state += 3
let (result, _) = (F 5) state2 in --5 + state
result


(PT 1)
>>
>>56041180
Is this satire?
Why the fuck would you do all this shit when you can do this in C with some bitwise fiddling and 2 nested for loops?
>>
File: Screenshot (522).png (724KB, 800x600px) Image search: [Google]
Screenshot (522).png
724KB, 800x600px
>>56041089
Rid yourself of the anime filth, and join the Visual Novel master race, where glory and Japanese Multinational jobs awaits you
>>
So we make an operator >>= that chains lets us chain computations together, feeding the result state from one into the initial state for the other, and letting us manipulate the value it gave us
it works like this
stateful1 >>= (\result -> stateful2)

i.e., result is the result from the first stateful computation, and we use that result to make a new stateful computation (e.g. if x%4 == 0 then skip)

stateful1 >>= resultToStateful2 = 
\state ->
let (result1, state1) = stateful1 state in -- run our first state computation
let stateful2 = resultToStateful2 result1 in -- get our new state computation
let (result2, state2) = stateful2 state1 -- run it
(result2, state2) -- return our final result and our altered state


Now we can do this instead:

let result = 
let wholeComputation = (G 3) >>= (\GResult -> F 5) in
wholeComputation 0
-- GResult was just (), because all it did was modify state
-- we could have just done (\_ -> F 5) or const (F 5)


in Haskell we can use do notation to more concisely represent this

do
GResult <- G 3
F 5

This is an example of the state monad
The >>= (mostly) defines the behaviour of the monad

In fact, there's more to this.
In this example, we don't need a monad, all we need is an applicative - the difference is with an applicative we can't "get the result out" - but we don't use it, we use the state

So we can just do this
(G 3) >> (F 5)

or

do
G 3
F 5


(PT 2)
>>
>>56041200
I'm explaining how the state monad works

He asked how you can do stateful computations in a stateless language
>>
>>56041218
so now that we have our state monad & do notation, we can do stateful computations very simply

generally there are three functions commonly paired with the state monad - get, set, modify

get = \state -> (state, state) 
-- leaves the state unchanged, but also gives it back as the result for us to peek at)

put x = \state -> ( (), x )
-- changes the state to x

modify f = \state -> ( (), f x )
-- changes the state by applying the function f
--We can implement modify using get and set:

modify f = do
state <- get
put (f state)
>>
>>56041250
>>56041218
>>56041180
what the fuck is this?
>>
>>56041264
>>56041226

this is how you can implement stateful computations
>>
>>56041264
Anon is doing gods work, its pretty good tutorial
>>
>>56041264
it's how to do bitwise bit fiddling in haskell
>>
File: 1466926992731.jpg (21KB, 474x429px)
1466926992731.jpg
21KB, 474x429px
guys need help

i have 4 vectors
std::vector<int*> current, toadd, toremove, newobjects

every few frames i ask user to generate list of relevant objects, now, before i copy all newobjects to current i have to know what objects are actually new and add them to 'toadd' list, and objects that are no longer relevant and put them in 'toremove'. how do i do it?
>>
>>56041121
You'll be using one of the APIs to do it. Real simple stuff. Just set up a bot account, get the auth token and put that in your login script, then authorize the bot to join your server. After that it's just scanning every message looking for whatever keywords you programmed it to look for and writing appropriate responses.

I'd suggest using the javascript or python APIs

>>56041106
>Has anyone ever written an ERP bot?
Not that I know of.
>You should write an ERP bot.
That'd be pretty cool if I made a ERP bot that got popular and I started making that Fenoxo money.
>>
>>56041269
Why would ANYONE want to do that?
>>
>>56041287
Some problems are best expressed using a state. So if you need states you use state monad

you dont have to implement it like anon above it already exists in standard library
>>
>>56041287
'tism
>>
>>56041272
As I said, you can do what the other anon asked without this, this is just an explanation of state

In fact the commonly used foldl (or "reduce" or "accumulate") does stateful computation over something that can be put into a list

>>56041287
well you don't have to worry your little head about it, you can just add MTL to your cabal and then do
import Control.Monad.State
>>
>>56041272
How can that poor excuse of a language be useful in any real-life setting?

Even fucking JavaScript, aka Scheme with C syntax for your browser, can do bit-fiddling.
>>
>>56041298
I'm more than certain most anons here weren't healthy to begin with before they came here.
>>
>>56041296
>>56041299

You have to do that all that shit fuckery to implement a state machine?

Jesus Christ, no wonder Haskell fags are hostile and militant about their language on this board.
>>
>>56041296
>>56041299
You dumb autists didn't get his point. Why would anyone want to do that shit in Haskell?
>>
>>56041314
>well you don't have to worry your little head about it, you can just add MTL to your cabal and then do
>
import Control.Monad.State

I literally told him he doesn't have to, someone else did

The point is this is an explanation of "stateless state"
Maybe it would help if you think about it this way

f x = x + 2 -- stateless function
f x state = (x + 2, newState) -- stateful function
>> -- something that lets us sequence stateful functions (ignoring their results, e.g. void functions)
>>= -- something that lets us combine stateful functions and get their results
>>
>>56041314
I answered why you would want to use state in haskell didnt I? AND YOU DONT HAVE TO IMPLEMENT IT just import it
>>
>>56041335
>The point is this is an explanation of "stateless state"
What kind of fucking mental gymnastics is this?

This is the whole "IO monads are stateful containers, but Haskell is still pure because only the runtime is tainted" backwards shit logic all over
>>
>>56041345
>import impure state monad
>"b-b-b-but haskell is pure because the code is only RETURNED and only the runtime is tainted"
>>
>>56041352
I put it in parentheses for a reason.
This is state and this is pure.
You don't like that but it's true.
It will give you the same result for the same inputs no matter how many times you run it.

>>56041360
the state monad is pure, it's Haskell that is impure (as well as the IO and ST monads, ST is a thread)
>>
>>56041360
I never said that, i actually didnt say anything about purity. I answered question: Why would you want to use state in haskell
>>
>>56041363
>the code IS pure, only haskell runtime is impure
M E N T A L
G Y M N A S T I C S
>>
>>56041363
>modifies state
>pure
Pick one

>It will give you the same result for the same inputs no matter how many times you run it.
Then it's not a state machine, you fucking idiot, and your example showed nothing.
>>
>>56041313

Haskell is a language by academics for academics. It's one of the primary reasons it doesn't see much use outside of it's dedicated user base.

It takes "Purity" too seriously. This just over complicates things with mathematical concepts where other languages take a more practical approach.
>>
>>56041390
IT DOESNT MODIFY STATE it only appears to be, nothing in state monad is impure
>>
>>56041380
>>56041390
You could at least read what I wrote

It gives you back a state machine.
You still have to put the initial state in, to get the output state.
i.e. run the state

there are normally 3 functions given for this
runState -- gives you back the result and the final state
evalState -- gives you back the result
execState -- gives you back the final state

>>56041393
This isn't true
>>
>>56041394
>this is how you modify state in Haskell....
>but it's not modifying state after all lol
>>
>>56041399
>only the code """"returned"""" is impure, the code itself is pure
Fucking autism
>>
>>56041403
It performs stateful computations
>> and >>= thread a value (the state) through the computations, giving you back a state machine that asks for the initial state
then you give it the initial state

then it gives you the final state
>>
>>56041420
Problem is these faggots dont know anything about haskell so they attack their own interpretation of it...
>>
>>56041399

Oh, care to enlighten me then? I do not see how emulating state change and introducing structures from category theory isn't more complex.
>>
>>56041415
Look, it's EXTREMELY simple
Is this function pure?
myFunction x y = (x + y, y - 1)

Is this function pure?
myFunction x state = (x + state, state - 1)

Is this function pure?
myFunction x = ( (), 100 )

Is this function pure?
myFunction state = ( (), 100 )
>>
int foo(int j)
{
static int i = 0;
return ++i + j;
}


This code is pure too, as only the runtime (aka the OS) is tainted. The code itself isn't impure, the code returned by GCC is.
>>
>>56041432
It's not that complicated, the idea is just that you make functions with an extra parameter (called stateful functions), that return an extra value (the result state), and then you just chain them together
Then you feed in the initial state
>>
>>56041053 here

here's the non-autistic version
/* write 32-bit int as 28-bit 4 byte array, skipping most significant bit */
#define BYTES 4
#define BITS 7
int i, j, k = 0;
for (i = BYTES - 1; i >= 0; i--)
{
arr[i] = 0;
for (j = 0; j < BITS; j++)
{
if (integer & (1 << k++))
arr[i] |= (1 << j);
}
}
>>
every [] n = []
every xs n = (take n xs): ((drop n xs) `every` n)

bytes (bits) = (bits `every` 8)
-- every 8 elements of bits

clearHighest [] = []
clearHighest (True:xs) = False : xs
clearHighest (False:xs) = False : (clearHighest xs)

sample = concat . (clearHighest <$>) . bytes

I've only done some preliminary tests but I think this does what anon wanted
>>
>>56040962
Working on a shitty imageboard using php and mysql, even tho i made a previous versione w/o db
>>
>>56041442

It is indeed more complex than any other language that just bites the bullet and accepts mutable state where you just define the variable and then change the variable.
>>
>>56041473
Whoops, "every" doesn't work as expected

>>56041487
C++ added constexpr
D added pure
>>
>>56041493
Actually ignore me, it does work, I just messed up the tests
>>
>>56041473
>>56041493
>>56041502
>programming in haskell
>not formally proving his functions
Might as well just program imperatively if you're not going to do it properly.
>>
>>56041502
tell me what anon wants, I might be able to implement it
>>
>>56041487
It's not more complicated when you just import it

It's like asking why C++ bothers with the entirety of vector.cpp when they could just bite the bullet and accept builtin vectors

Plus you get the benefit of the standard library, which all have functions that work with monads in general, such as traverse_ or forM_

In the end you could write Haskell code that looked imperative if you wanted
>>
>>56041493

constexpr is strict and is basically the same as pre-calculating and inserting the value into your code by hand in most of the use cases I've seen it in.

The constraints on constexpr generally limit it to use cases that allow the compiler to evaluate it. You're literally saying either the values in the object are able to be evaluated at compile time or the result of the function is able to be evaluated at compile time).
>>
>>56041053
Don't mind the Haskell autists. You can do that without using state in a more sensible language quite easily (though it wouldn't be as efficient as using state):
(defun elim-8th-bits (n &optional (exp 4) (acc 0))
(if (= exp 0)
acc
(test n
(1- exp)
(ash (+ acc
(logand n (ash 127 (* 8 (1- exp)))))
-1))))

Here logand does a bitwise AND and ash does a bit shift.
>>
>>56041578
Haskellfags completely REKT by Lisp

I lol'd
>>
>>56041581
>>56041578
samefag
>>
>>56041578
>test n
Change it to elim-8th-bits n. Forgot to change the function name.
>>
>>56041587
>he doesn't know about the post cooldown timer
Hello newfag
>>
>>56041591
>what are proxies
>>
>>56041575
constexpr functions can be called at runtime, but if they're called with constexpr parameters than they can be evaluated at compile time

that's because they're pure
you can say the same of state in haskell (but I don't think GHC optimises State, as it's user code and not part of the standard library (though it should be added!). ST is, and you can do any state with ST)


>>56041581
see >>56041473
>>
>>56041595
>he thinks anyone is emotionally invested enough on a /dpt/ to not only enable a HTTP proxy or a VPN, but also clear cookies, all in less than a minute
>>
>>56041604
>click "VPN on"
>CTRL+SHIFT+DELETE, "Clear Browsing Data"

Yeah there's no way an idiot like you could press 3 keys and mouse click twice in a minute
>>
>>56041013
>What does that even have to do with programming?

It's a meme that every /dpt/ has to feature that pink haired anime gril.
>>
>>56041578
Hold on, that doesn't add the last bit to the result. This should fix it:
(defun elim-8th-bits (n &optional (exp 4) (acc 0))
(if (= exp 1)
(+ acc (logand n (ash 127 (* 8 (1- exp)))))
(elim-8th-bits n
(1- exp)
(ash (+ acc
(logand n (ash 127 (* 8 (1- exp)))))
-1))))

The fact that the same sum repeats itself in both the base and recursion cases shows this would look much better iteratively.
>>
>>56041619
>he nonironically believes people take the /dpt/ this seriously

How sad must your life be?
>>
>>56041624
>gril

>>56041647
You're still replying?
I didn't actually think you did samefag but now I'm starting to change my mind
>>
>>56041627
And here it is iteratively, with a few tweaks:
(defun elim-8th-bits-neurotypical (n)
(do* ((exp 4 (1- exp))
(acc 0 (+ (ash acc -1)
(logand n
(ash 127 (* 8 exp))))))
((= exp 0) acc)))
>>
File: pretending1.png (3KB, 698x1284px) Image search: [Google]
pretending1.png
3KB, 698x1284px
>>56041662
>I didn't actually think you did samefag
>>
File: 1464718422972.jpg (48KB, 470x475px) Image search: [Google]
1464718422972.jpg
48KB, 470x475px
>>56041683
I'm not the first guy you replied to

and i won't be the last
>>
File: dman.png (14KB, 160x301px) Image search: [Google]
dman.png
14KB, 160x301px
Who here /dlang/?
Is it any good?
>>
>>56041664
This translates quite well to C code, barring syntactical differences.
int elim_8th_bits_neurotypical(int n)
{
int exp, acc;
for (exp = 4, acc = 0; exp > 0; exp--)
acc = (acc >> 1) + n & (127 << (8 * exp));
return acc;
}
>>
File: Type Iteration.png (10KB, 568x217px) Image search: [Google]
Type Iteration.png
10KB, 568x217px
>>56041695
It's better than C++.
Probably.
>>
File: 4u.png (26KB, 344x376px) Image search: [Google]
4u.png
26KB, 344x376px
>>56041701
>4u
>>
File: 2016-08-12-062310_854x413_scrot.png (85KB, 854x413px) Image search: [Google]
2016-08-12-062310_854x413_scrot.png
85KB, 854x413px
>>56041627
>>
>>56041692
>jokes on you, i was only pretending to be samefagging

What the fuck is going on in your brain right now? Are you having a stroke?
>>
>>56041711
epin
That's the last recourse of Hascucks when faced with a superior language, cry "muh parentheses".
>>
>>56041715
Ignore him, he's not actually me
I wasn't >>56041662
>>
>>56041719
You missed the other week when a Haskell user was complaining about a sample of Lisp code being unreadable, and a Lisp user was complaining about the number of parentheses produced by a sample of Haskell code
>>
can your language do this??

$ cat hello\ world.hs
main = putStrLn "Hello World"
$ ghc -O2 hello\ world.hs
$ du -h hello\ world
1.2M hello world
>>
>>56041766
#include <iostream>
>>
>>56041766
>1.2M
>>
>>56041034
Prelude> let anime = "shit"
Prelude> :t anime
anime :: [Char]


a function is defined as something that takes 1 input and gives 1 output, so this isn't a function
>>
>>56041969
>implying
lists are a monad you know

in this case anime is

()
-> "s"
-> "h"
-> "i"
-> "t"
>>
>>56042033
Maybe for difference lists you can say "shit" is a function
\l -> 's':'h':'i':'t':l
>>
File: SpanishExcellentJohndory.webm (232KB, 350x570px) Image search: [Google]
SpanishExcellentJohndory.webm
232KB, 350x570px
>>56040962
I'm working on a little tool that makes pasting code to hastebin easier.

Just finished making the UI usable.
>>
Apparently, WebAssembly will revolutionize the client-side development. The web apps will be very much like desktop ones: high performing, can be written in any language. At the same time they are cross platform, can be easily distributed, and do not require installation.

Meanwhile, every "builder of web3.0" who's trying to "fix the Internet", or "make the web faster, safer, and more open" is doing it in such a way that back-end development is not required. I.e. they are working on decentralized (either p2p or federated) universal back-ends that they assume should be used by everyone.

Do you believe that in future the back-end development as we know it today will be obsolete as everybody will use some p2p BaaS platform and the web-development will be all about implementing client-side apps?
>>
>>56042127
I sure hope so. I despise fullstack dev and would rather rip my own toenails off with a pair of rusty pliers.

Once Javascript stops having a monopoly on the web, competent devs who have no interest in learning a typeless language will finally have a chance to make web apps that aren't a heap of shit.
>>
>>56041075
hay im writing a discord bot too
in java and mostly for music playback tho
>>
>>56042114
hoooo boy dat's some MahApps

I like you
>>
>>56042114

> Open when Windows starts

No support for other operating systems?
>>
>>56042127
Will webassembly let me access the DOM directly?

The whole reason why asm.js never took off was it's limited scope.
Your javascript code had to interact with a black box that couldn't touch the webpage directly, you had to implement your own message passing scheme to get anything done.
It really limited it's usefulness to browser games and emulators.
>>
>>56042158
She's using WPF for the GUI framework, so it's inherently not cross-platform.

However, if she's designing it right, the back end could easily be modified to a portable GUI like GTK# or something.
>>
>>56042168

Gah, vendor lock in bullshit.
>>
>>56042168
>she
>she

stop that
>>
>>56042158
>WPF
Nope.

>>56042157
It's all MVVM as well, my first time writing with MVVM so I'm getting my ass handed to me pretty often by stuff I just don't know how to do yet. Dev has been pretty slow because MVVM has a whole heap of related boilerplate.

>>56042168
>She
As in my comment above, I'm using MVVM so realistically the majority of the stuff sat in the middle can't really be ported. However the actual logic is fairly simple and creating a lazy implementation with Mono and GTK# is doable but not really something I'm interested in seeing as I'm doing this mainly to get some experience with the MVVM workflow.
>>
https://wiki.haskell.org/Lambdabot

>Haskell is so useless an IRC bot was written in it to make writing Haskell take less work
>>
>>56042201
>WPF
>MVVM
>getting my ass handed to me pretty often by stuff I just don't know how to do yet
Got a hearty chuckle out of you, dumbfuck. Even a retard with down's syndrome could wrap his head around modern shit quite easily. You would kill yourself if you had to work with Windows API, fag.
>>
>>56042201
It was my understanding that modern MVVM basically encourages a cross-platform library that's tied into a separate GUI project for each OS.

Here's an example in WPF that could easily be re-wired only replacing the front-end:
https://mvvmcross.com/docs/a-wpf-ui-project
>>
>>56042249

A proper implementation of the MVVM pattern should indeed allow you to just replace the front end for each supported os.
>>
>>56042242
Not that anon, but MVVM is pretty unintuitive, considering every single professor and popular tutorial teaches basic WinForm back-and-forth logic.
>>
Hallo /dpt/
You guys are honest so:
What are the most fun areas that are both profitable and have a future?
>Distributed Systems
>Usual Java/.NET
>Machine Learning
>Bioinformatics
>Security
>Mobile

These are all interesting to me for different reasons, hoping for your opinions
>>
>>56042283
>Distributed Systems
>Usual Java/.NET
>Machine Learning
>Bioinformatics
>Security
>Mobile

>fun

>---------------------------
>---------------------------
>---------------------------
>---------------------------
>---------------------------
>---------------------------
>>
Just wrote this using the conditional operator, isn't it a thing of beauty? Thanks C++.
viewX = (viewX < 0) ? 0 : (viewX + viewHeight >= map.width - 1) ? (map.width - 1) - viewWidth : viewX;
viewY = (viewY < 0) ? 0 : (viewY + viewHeight >= map.height - 1) ? (map.height - 1) - viewHeight : viewY;
>>
>>56042299
What you deem fun then?
>>
File: 124124.jpg (28KB, 460x276px)
124124.jpg
28KB, 460x276px
>>56042304
I was not mad until I saw this code
>>
>>56042283
>Distributed Systems
>Usual Java/.NET
>Mobile

These three, because massive dev teams full of people much smarter than your or I are already cornering the research on the other topics.

Big data is where the world is moving, even mid-market companies are starting to use distributed data and predictive analysis. Also, there's always going to be a need for CRUD libraries and applications for the enterprise, so .NET/Java is guaranteed employment (and pet project application dev in .NET is actually really fun).

Mobile is a given because everyone uses smartphones every day.
>>
>>56042242
http://hastebin.com/gusufelero.cs
Au contraire, friend.

More or less everyone who isn't a cunt would agree that MVVM has an initially steep learning curve as you get your head around what you need to implement and what belongs where. Now that I'm over the initial hump I'm starting to make good ground.
>>
>>56042323
>much smarter than your or I
looks like I proved my point here

>>56042304
Ternaries are not for nesting, anon.

Every time you do that, a [loli/kitten/puppy/family member/dream] dies.
>>
Exokernel for ARM64
>>
>>56042312
>>56042344
It's only in one method, and it's not something that will ever need to be changed, so I'm leaving it as is. They were both previously two ternaries, but then I noticed that I could actually combine them into one.
>>
>>56042357
What's taking you so long?
Step up your game
>>
>>56042361
you've repeated so much code I'm not sure why you bothered
>>
>>56042362
>rushing things
lrn2zen faggot
>>
>>56042283

The majority of work that is "Profitable" is by very definition the opposite of fun.

In reality money is just a tool of enslavement. You can live without it. Don't get overly caught up with obsessing over it / obtaining it.
>>
rewriting haskell in the linux kernel
>>
>>56042323
Thanks for the thoughtful answer. I agree that those research fields have plenty of people way up there in terms of knowledge.
Bioinformatics though seems damn fun, I wonder if it's overly difficult/underpaid
>>
>>56042378
Well it has to be repeated twice, since it's working with x and y coordinates.
>>
>>56042326
>steep learning curve
Only if you're mentally challenged.
>>
>>56042383
I get what you mean. I think it's good to know what I'm in for though.
>>
File: 1467681317674.png (638KB, 4760x4986px)
1467681317674.png
638KB, 4760x4986px
>>56042388
Of course.
>>
>>56042383
>The majority of work that is "Profitable" is by very definition the opposite of fun.
>by very definition

That's, like, your opinion, man.

As corny as it sounds, I'm really fucking passionate about data. Working with data warehouses, ETL package dev, anything to do with APIs... I get erections from doing CRUD and charts and features that export to Excel.

I love analyzing data. I love that my work gets people hired and fired and influences major decisions at large firms.

I love that I can display the exact same data in two ways, telling two completely different stories, by simply changing the definition of a subjective term like "Stale" or "Delinquent" or "Out of Compliance".

I love data!

Data is cute! CUTE!
>>
>>56042414
I clearly specified that the opinion of non-cunts was that it has a steep learning curve.
>>
>>56042414
Yeah, you're a cunt.

MVVM is not intuitive.
>>
>>56042416

Just figure out what you actually like doing and don't worry about the paycheck too much.

>>56042428

That's your choice and it is fine if you love working data. It's just saddening that your field is contributing to the mass death of privacy and the monetization of human information.
>>
>>56042428
Finally, someone into data. What do you work on? Or, rather "how" do you work? Do you ever get to do some code? I love data too, but it boggles me that I might end up just writing reports on the results of simple queries.
>>
>>56041624
no it's not, it's just the one mentally ill samefagging trapfag that keeps forcing it
>>
>>56042464
I like opening up some terminals, writing code and gritting my teeth over it not working until it does. That fits a good number of specializations I think
>>
>>56042501

Yeah, that is a little bit too generic to really give any advice.

Think about the specific kind of problems you find interesting to research and solve. Actually, look at your hobbies in general. What do you truly enjoy doing most? Life doing what resonates with what you love is truly abundant and happy. Programing in a corporate environment may not be as enjoyable as you believe it is when you have the job.
>>
File: deep insight.jpg (392KB, 569x702px)
deep insight.jpg
392KB, 569x702px
>>56042464
When I do consulting, none of the data leaves the entity that owns that data. I sell companies their own data, in a way of speaking.

>>56042474
I consult for mid-market companies and build business intelligence solutions for their data.

In a typical day, I'll use C#, SQL, DAX, and a few different BI platforms.

A good chunk of my work is actually programming in C#, but the ETL packages I write could easily be done in something like Python.

A typical BI project goes something like this:
>discover business needs and available databases or APIs from cloud services (I've got packages to pull from OpenDNS, Trend Micro, Webroot, IP Geolocation, etc.)
>design and create data warehouse with staging tables and fact tables (I've stared using SQL Server 2016 for temporal tables, really neat feature)
>design and develop custom ETL package to suck in all the data into the warehouse at varying intervals depending on time-sensitivity of data
>design and develop reports and dashboards based on whatever solution the client wants (I prefer PowerBI, but I can work with Tableau or pretty much any other mainline BI solution)
>present to client, make changes (repeat this step until the money runs out or the client is satisfied)
>>
>>56042561
That's really sound advice, thanks. I'll take more time looking into it.
>>56042576
Okay, this sounds interesting. What about stuff like SAP? I saw people working on it and it looks so boring...
>>
Gomennasai /g/

I am working on the ``Zebra Puzzle" (https://en.wikipedia.org/wiki/Zebra_Puzzle) and I am wondering what the minimum number of clues needed to convey the solution to any size puzzle might be.

In the case of one dimension, with an array of
Norwegian, Japanese, Brit
, the order could be represented in two clues:
- The Norwegian lives in the first house
- The Brit lives in the last house
.

With two dimensions
Norwegian, Japanese, Brit
and
Zebra, Turtle, Dog
it'd be 4 clues:
- The Norwegian lives in the first house
- The Brit lives in the last house
- The Japanese man owns a turtle
- The Brit owns a dog


So I thought that for any array of attributes N items long in the puzzle, it would require N-1 clues to convey a solution, but if you look at the canonical example, it's a 5x5 puzzle solvable with 15 clues rather than 20.

I guess I'm wondering:

1. At what point this increase in efficiency occurs
2. If 15 is indeed the minimum number of clues required for a 5x5, or if it can be lower
3. If there's a formula that can express this relationship
>>
>>56042713
Generate all possible solutions & filter
>>
>>56042422
Wouldn't an array of size n be more efficient in looking up n at the expense of memory?
>>
>>56042662
SAP is a company that does enterprise software, just like Microsoft. If you're referring specifically to working with something like SAP HANA, then it's likely to be mind-numbingly boring, but it pays very very well.

While it's similar in practice to being a consultant or DBA for something like a MySQL or SQL Server setup, SAP resides in the massive enterprise space so each job is less full-stack and more of a specific task on an assembly line.

SMB is where it's at if you want a chance to actually be influential.
>>
>>56042776
Yes, that's the only problem with that code.
>>
Just discovered that Java has higher ranked types, so one can actually implement closed sum types in Java. The lambda syntax even makes it not-so-bad syntactically.
>>
Checking in from wdg to laugh at just how shitty these threads are.
>>
>>56042817
>Java has higher ranked types
since when
>>
>>56041008
>implying it's not already documented

https://wiki.installgentoo.com/index.php/Daily_programming_thread#The_Image_Wars

The way I see it, at least it's not 3DPD trannies.
>>
>>56042853
>when /dpt/ was this active
RIP
>>
>>56042444
Yeah, you are dumb.

Anything not involving working directly with Windows API is babby-tier lego.
>>
>>56042840
You can simulate them. Example with Either:

interface Either<A, B> {
<C> C match(Function<A, C> left, Function<B, C> right);
}

class Left<A, B> implements Either<A, B> {
private A a;

Left(A a) {
this.a = a;
}

@Override
public <C> C match(Function<A, C> left, Function<B, C> right) {
return left.apply(a);
}
}

class Right<A, B> implements Either<A, B> {
private B b;

Right(B b) {
this.b = b;
}

@Override
public <C> C match(Function<A, C> left, Function<B, C> right) {
return right.apply(b);
}
}

See how the <C> in Either's match makes it so only 2 distinct implementations for Either are possible (disregarding nulls)?

This should be equivalent to the following Haskell code:

type Either a b = forall c. (a -> c) -> (b -> c) -> c

left a = \l _ -> l a

right b = \_ r -> r b
>>
>>56042882
Ohhh you mean using inheritance

Yeah the thing about inheritance is it's basically GADTs
>>
>>56042872
>working directly with Windows API
>cross-platform

Pick one, faggot.

Either way, working in MVVM and using the WinAPI are not mutually exclusive, nor is working with WinAPI particularly difficult or confusing.

I'm not sure why you think working with WinAPI is some sort of badge of honor as to your code prowess. The only conclusion possible is that you live in an area with designated shitting streets.
>>
>>56042882
That's just inheritance, but it does simulate it.

That being said, you could do that in C# or C++, too, so specifying Java is a bit silly.
>>
>>56042896
Inheritance here is only circumstantial, since Java doesn't allow something like 'Name = Type'.

The crucial thing here is match's type parameter C, it's what makes this 'closed'. Otherwise one could add subtypes to Either that do weird shit.
>>
File: c71.jpg (20KB, 334x393px)
c71.jpg
20KB, 334x393px
>>56042822
>Front end webdev who probably only uses NodeJS talking shit about /dpt/
>>
>>56042915
Again, inheritance is not the important part here. The point is that the <C> in Either's match makes it so only exactly these two implementations are possible(barring names and null), making it a closed sum type.
>>
>>56042901
>working with WinAPI is some sort of badge of honor
Because it actually needs brain cells to get anything done, meanwhile a babby cannot grasp basic .NET facilities that literally hold your hand. You're a fucking disgrace.
>>
File: 1470819521689.png (3MB, 5000x5000px)
1470819521689.png
3MB, 5000x5000px
>>56042958
>>
why doesn't this work
var c = '';
Map([[3, a], [5, b], [7, c]]).forEach(function(value, key){
c += '(++a%' + key + '?'':' + value + ')+'
});
c.split('').pop().join('').replace(/^/,"a=>") += "||a.join('\n')";
>>
>>56042997
I can't imagine going about life being this irrationally angry.

Are you chuckling to yourself after posting something like this, or is it more of a general bitter frustration?

I feel like this is trolling, but you could be genuinely 'tism-raging right now.
>>
>>56042576
i don't understand the comic
>>
>>56043012
>fractal
Did you use a comonad?
>>
>>56043018
why dont you read the error you fag
>>
>>56043020
Whatever helps you sleep tight at night, baby. Now go back to your legos.
>>
>>56043018
Why do you think it should work?

>>56043025
https://en.wikipedia.org/wiki/Oracle_Database
>>
What language\ gui library do i use for good cross platform programs. I only need to connect to an sql server and get some data
>>
>>56043018
>c.split('').pop().join('').replace(/^/,"a=>") += "||a.join('\n')";
Try this


c.split('').pop().join('').replace(/^/,"a=>") += "||a.join('\n')".bop();
>>
>>56043048
You need to connect directly to a SQL Server from any given platform?

This already reeks of horrible design, what are you doing?
>>
>>56043018
here you go
c.split('').pop().join('').replace(/^/,"a=>") += "||a.join('\n')".bop().split('').pop().join('').replace(/^///,"a=>") += "||a.join('\n')".bop();
>>
>>56043018
c.split('').pop().join('').replace(/^/,"a=>") += "||a.join('\n')".bop().split('').boop().zippity().mup().da().muhfugga().bix().nood().pop().join('').replace(/^///,"a=>") += "||a.join('\n')".bop();
>>
Generally speaking. Would you reinvent the wheel in free time.
Yes or no?
>>
>>56043048
C# with .NET Core; it has built-in EF to connect to a SQL Server and it'll run on all major OS's.

Pair it with Xamarin if you need to target all mobile devices, or something like GTK# if you need to target all desktop OS.

Sounds like you'd honestly be better off building a web page, though, but this would give you a way to dev the logic once and run on anything.
>>
>>56043124
No.

Libraries make my life easier, and I'm generally content with starting with a library and modifying it to suit my specific needs, or adding onto it if it needs performance/compatibility improvement.
>>
>>56043124
class Wheel {
/* TO DO */
}
>>
File: polite conversation.png (311KB, 2072x1984px) Image search: [Google]
polite conversation.png
311KB, 2072x1984px
Seems like every assertion in /dpt/ is an unpopular opinion.

Is there anything that /dpt/ can agree on?
>>
>>56043195
>Seems like every assertion in /dpt/ is an unpopular opinion.
I disagree
>>
>>56043195
>Seems like every assertion in /dpt/ is an unpopular opinion.
I disagree
>>
>>56043239
You're full of shit >>56043195 is exactly right
>>
>>56043124
yes because the existing wheels are shit and not suited for my specific needs
>>
>>56043195
Welcome to the Internet.
>>
>>56043195
most can probably agree that python, js, php and haskell are shit
>>
>>56043195
Python is a monumentally slow language only defended by the moron's who picked it up as their first language and have no hope of ever transitioning to a non-shit, performant and statically typed one.
>>
>>56043267
>haskell
this is bait
>>
>>56043267
>python, js, php
I don't like them, but they all have their uses.

The internet runs on JS.

>haskell
Yeah, it's shit.
>>
>>56043267
just no
>>
>>56043066
There is a pc that runs a program that connects to a local sql server and displays some data. I want to make a different frontend, which is not locked to the pc i mentioned before. Since i'm going to improve my knowledge of a programming language, i may as well choose the one that makes better cross platform programs
>>
>>56043343
see
>>56043133
>>
>>56043018
and people say haskell's unreadable
>>
>>56043513
whenever you mention other people professing negative views of Haskell, please remember ot add (wrongly), e.g.
and people (wrongly) say Haskell's unreadable
and people (wrongly) believe Haskell is bad
and people think (wrongly) that Haskell is too complicated

thank you
>>
>>56043270
>moron's
It's "morons"
>>
>>56043523
Why, because autists like you can't take a hint?
>>
>>56043124
If I predict the existing wheels to be a huge bottleneck think I can write a less multipurpose optimised wheel, yes.
>>
>>56043289
>yeah, its shit
stop
>>
>>56043532
If you need hints on how to write better haskell, try hlint
>>
>>56043270
This is correct.
>>
>>56043267
Agreed. At least TypeScript can make JS bearable. Not much for the other 3.
>>
>>56043551
even FP tards usually prefer other langs like ocaml
>>
>>56043592
>sources: i have none but i trust other people i hate will agree with me on this one
>>
>>56043513
its unreadable because this
qsort []        = []
qsort (x:xs) = qsort (filter (<x) xs) ++ [x] ++ qsort (filter (>x) xs)

is supposed to be a highlight of how good the language is
>>
>>56043527
I was posting on my phone from the shitter.
>>
>>56043625
x:xs wouldn't make much sense to someone that didn't know haskell
>>
Can we please stop calling haskell a functional programming language?

It gives Lisp, Standard ML, and Ocaml a bad name.

Haskell is puzzle-oriented over-engineered programming, or POOP as I've taken to calling it.
>>
>>56043634
Of course it's a dumb phoneposter
>>
>>56043592
t. only browser /dpt/ and has never done fp
>>
>>56043646
Why would it give any of those a bad name?
None of those languages are remotely functional

I mean that in both senses of the word
>>
>>56043646
I read on /dpt/ that lisp isn't a functional programing lang
its has imperative features
>>
>>56043124
Yes, I do that a lot actually.
>>
>>56043657
functional != purely functional
>>
>>56043680
That's not what I'm getting at, but that is more incidental than accidental
>>
>>56043666
Haskell does too.

Lisp is largely functional in practice.

>I read on /dpt/...
Mistake number one
>>
wtf is functional programming?

I've learned haskell but I really don't know what it means for a language to be functional.

same thinkg with oop
>>
>>56043657
My grain of salt: it's expression based, so it's very doable to write functional code in it. If we're talking about Schemes it's even better: general tail-recursion, and impure procedures are set appart nicely with a bang.
>>
>>56043705
sure is summer
>>
>>56043705
Does it run like shit?
Then it's probably functional or OOP.
>>
>>56043716
pls help, I don't want ridicule
>>
>>56043730
https://www.youtube.com/watch?v=sqV3pL5x8PI
>>
>>56043728
but xmonad runs real fast and works nice
>>
>>56043739
I watched that video once
he starts explaining baby tier haskell code right?
>>
>>56043705
Imperative:
res = []
i = 0
while i < 10:
res.append(i)
i += 1
return res

Do this, then do that and assign that to this, then return that and jump to this other instruction.

Functional:
[i for i in xrange(10)]
or even
range(10)
(Python 2 btw, don't judge me, I'm forced to write it at work)
Here's an expression, evaluate it by going down the tree of nested function calls until the leaves, and then piling up.
>>
>>56043761
Indeed he does
>>
>>56043772
so its just about state?
>>
>>56043812
define 'it' within your sentence.
>>
>>56043772
imperative:
res = []
i = 0
while i < 10:
res.append(i)
i += 1
return res


functional:
whileM mb act = mb >>= (`when` act)

do res <- newIORef []
i <- newIORef 0
whileM ((<10) <$> readIORef i) $ do
modifyIORef i succ
modifyIORef res (i:)
readIORef res
>>
>>56043820
so, functional programming's just about state?
>>
>>56043812
>>56043834
no, ignore him
it's sometimes important because stateful is often less composable
>>
can you guys recommend me something to properly learn recursion?
i took about 1.5 hours creating a simple factorial algorithm in C and i still don't understand it very well
>>
>>56043834
>so, functional programming's just about state?
That's the weirdest way to interpret my message desu
>>
>>56043845
fact 0 = 1
fact x = x * fact (x - 1)

what's to understand?
>>
>>56043842
agreed

>>56043849
Also 'x is about y' is such a vague and retarded expression anyway
>>
>>56043845
That's because you took it from the wrong angle and with too much preconceived notions and apprehensions.
>>
>>56043845
The first couple of pages of SICP

seriously.

Once you understand functions in terms of one big evaluation instead of "returning" values "back" to other functions, recursion will make much more sense

and the parentheses totally help
>>
>>56043887
>implying procedural coders will ever understand this
did you not see the shitfest earlier about the state monad
>>
>>56043849
all I see in imperative is state change
>>
>>56043898
we all have to start somewhere lad

SICP is literally made to be that somewhere where we start
>>
>>56043845
lmao just visualize it
after you understand what factorial is doing
try visualizing>>56043625
>>
>>56043902
State changes guided by a sequence of instructions
>>
>>56043863
i'm the quoted, my problem with recursion in general is that i think its too hard to keep track of what my function is doing after a few iterations, i also had this feeling with Fibonacci recursion algorithm and Hanoi towers (which i couldn't do by myself)...
>>
>>56043936
Think of it bottom up starting from the base case, it helps.
>>
>>56043845
write down the calls step by step
let rec factorial n =
match n with
| 0 | 1 -> 1
| _ -> n * factorial(n-1)
>>
>>56043936
it's good to learn it but you won't have to worry about it in real life, iteration is always better
>>
>>56043930
maybe its because you're doing haskell, that is purely functional (in my mind, that means no state change)

and thus, it must be about state

what is it that you're trying to differentiate between the two?
>>
>>56043962
>iteration is always better
please Anon, don't say such things
>>
>>56043936
Start with the base case then go up in small increments, like in the qsort example see what happens with an empty list, a 1 element list, a two element list, etc. and then extrapolate from there. Or take a small example and write down every call that will result from it until you reach the base case.
>>
Java is the best language, it's used by more devs than any other language.
>>
>>56043962
iteration is just recursion++
>>
>>56043958
5
5 * fact (5-1)
4 * fact (4-1)
3 * fact (3-1)
2 * fact (2-1)
1 -> return since we hit the base case
so that becomes 5*4*3*2*1
>>
>>56043987
C++ is the best language. Programs written in C++ are used by more people than any other language.
>>
>>56043958
>| 1
why?
>>
>>56043962
>his language doesn't have tail call optimization
>>
>>56043962
please iterate over a tree
>>
>>56044000
I'd say C holds that mantle.
>>
>>56044009
>what is an explicit stack
explicit > implicit
>>
>>56043972
>purely functional
means shit must be pure. Look up the definition of pure function.


>what is it that you're trying to differentiate between the two?
The fundamental way programs are structured and thought of. imperative programs are a sequence of orders, functional programs start with a single expression on top, that unfolds as the program goes on to compute that expression's value. the qsort thing is one expression with nested calls, see?

I know I'm shit at explaining
>>
>>56044009
import Data.Foldable

printTree = print `traverse_` tree
>>
>>56044008
That's not always enough. Sometimes you need a trampoline.
>>
>>56044012
GCC and Clang are written in C++
>>
>>56044013
>explicit > implicit
implicit state carried over all your functions dummy, what is it?
>>
>>56044021
That's implemented using recursion.
>>
>>56044021
>implying traverse isn't itself recursive
kys
>>
>>56043592
nah, only fags on /g/ use it
>>
>>56044023
What can a trampoline do that tail calls (not necessarily recursive ones) can't? Honest question, I think I can prove the two are equivalent but idk
>>
>>56044041
>>56044042

it still iterates over a tree you idiot

all iteration is implemented using recursion, it uses goto
>>
>>56044025
Most people don't use compilers, anon.
>>
>>56044047
You can't tail call optimize recursive monadic binds.
>>
>>56044049
factorial n = foldl (*) 1 [2..n]

DOOD DON'T U SEE, ITS ITERATION LMAO
>>
>>56044071
wait hol up
this is tail recursive right
>>
>>56044071
At least don't be a faggot and use mtimesDefault & Product when you're trying to put forward your shitty argument
>>
>>56044085
product = foldl (*) 1
u stupid nigger
>>
>>56044067
Not in general, but it depends what the monad is. I'm pretty sure that if it's a state passing one it'll come down to tail-call optimisable functions. Mind providing an example? Not sure we're talking about the same thing.
>>
>>56044098
I meant Product the newtype, the one that defines nums or enums (I forget which) to be monoids under multiplication, then using mtimesDefault to repeat the monoidal operation a given number of times (or mempty if 0)

Obviously you fucking knew all that you twelve year old, that's why you wrote a function that throws an exception for factorial of 1
>>
>>56044071
it's literally iteration, foldl/foldr just iterates over a list of numbers and in this case multiplies them together
>>
>>56044123
whoops, didn't mean that last part
>>
>>56044123
wait, msum
i'm really confused today
>>
>>56044104
I was mainly thinking of the various generic monad loop functions, i.e. https://hackage.haskell.org/package/monad-loops-0.4.3/docs/src/Control-Monad-Loops.html

Admittedly my main experience of this is in Scala, which has extremely limited support for tail calls.
>>
File: 2016-08-12-101809_295x67_scrot.png (2KB, 295x67px) Image search: [Google]
2016-08-12-101809_295x67_scrot.png
2KB, 295x67px
>>56044123
dude, who uses monoids
I can't see a case use except in the example in
lyah
also, pic related
>>56044131
confirmed troll
>>
>>56044171
foldl (*) 1
is msum for Product a
>>
>>56044169
And laziness probably confuses it even further. Also how do you trampoline a monad? Again, honest question. Maybe that's Scala stuff
>>
>>56044171
>dude, who uses monoids
A small niche library going by the name of Control.Lens.

>>56044187
Yeah who cares?
>>
>>56044052
Adobe suite is written in C++
Steam is written in C++
Most video games are written in C++
Office is written in C++
Most of Windows userland programs are written in C++

That makes it a majority. Although I agree that C is still prevailing due to the use in kernels, drivers, and libraries.
>>
>>56044208
>Yeah who cares?
who cares that you could use foldl?
>>
>>56044193
The most common approach is to use the free monad over (() ->) as the base monad in your transformer stack. It's hideous, but it means you can run each step in the resulting computation individually, feeding through the result from each step to the next, all without blowing the stack.
>>
>>56044210
It's difficult to use any of those programs without an OS, and therefore a kernel.
>>
>>56044208
lenses are beyond me
too hard to lern
no documentation
>>
>>56044226
caring because
>DOOD DON'T U SEE, ITS ITERATION LMAO
which I don't agree with but whateva. You're just derailing shit by insulting people (not me) over not using monoids for no reason at all by your own admition. You're tired I concur, go to bed.
>>
>>56044234
I see
>>
>>56044250
holy shit you did it again
you greentexted the lmao

wow i am the btfo
lol #rekt i am going back t.o reddit
>>
>>56043646
>Haskell is puzzle-oriented over-engineered programming, or POOP as I've taken to calling it.
a big one
a grat one
>>
>>56044271
>holy shit you did it again
Wut?
>>
is haasn here posting haskell again
>>
>>>/biz/1439589
>>
>>56044250
>which I don't agree with but whateva
>>DOOD DON'T U SEE, ITS ITERATION LMAO
>You're just derailing shit by insulting people

I'm sorry but this website is 18+
>>
>>56044245
Types are documentation
>>
>>56044317
>crypto
>a PhD mathematician, a PhD compsci and a msc chemist

What could go wrong?

>>56044326
Haskell doesn't have pi types
>>
File: ENOUGH.jpg (29KB, 412x430px) Image search: [Google]
ENOUGH.jpg
29KB, 412x430px
QUICK, POST SHITTY CODE IN YOUR FAVORITE LANGUAGE
>>
File: frame.png (32KB, 616x426px)
frame.png
32KB, 616x426px
>>56044346
>>
>>56044322
>Obviously you fucking knew all that you twelve year old, that's why you wrote a function that throws an exception for factorial of 1
>At least don't be a faggot and use mtimesDefault & Product when you're trying to put forward your shitty argument

confirmed for
attention_span < 0
>>
>>56044338
Not yet
>>
>>56044346
using namespace std;

void main() {
if(tweet = "negative" || tweeter = "gamergater")
cout << "block";
}
>>
>>56044359
Did you quote the wrong post?

>>56044367
>using namespace std
My favourite part
>>
>>56044346
(uncurry (++)) . (partition (9 /=))
>>
>>56044367
#GAMERGATE IS TABOO YOU NOOB
>>
is there any way in c++ to automatically generate unique id for classes at compile time? example
class BaseObject
{
int get_id()
};

class OtherObject1 : public BaseObject
{
};

class OtherObject2 : public BaseObject
{
};


now, without any code in constructors in derived classes, OtherObject1::get_id() should return 1, OtherObject2:get_id() should return 2, baseobject is abstract and all initialization code should be in it. is this possible?
>>
>>56044367
YOU HAVE DOOMED US ALL REEEEEEEEEE
>>
>>56044373
proves to you that >>56044226 was derailing and is mentally way beyond nine years of age. At least try.
>>
New thread:
>>56044388
>>56044388
>>56044388
>>
File: anal beads.png (82KB, 566x998px) Image search: [Google]
anal beads.png
82KB, 566x998px
>>56044346
static void BottlesOfBeer()
{
Range(1, 100)
.ToList()
.ForEach(x =>
WriteLine(x == 100 ? $"No more bottles of beer on the wall. :("
: x == 99 ? $"One last bottle of beer on the wall, take it down, pass it around"
: $"{100 - x} bottles of beer on the wall, take one down, pass it around"));
}
>>
>>56044387
>telling you what he thinks is better code

Yeah, maybe in /dpt/ that's considered derailing
>>
>>56044375
there it is, again
can I save it my friend?
>>
>>56044356
dats cute
>>
>>56044418
No, it is ©®™ by me 2017. You may license it, if you like. I offer very reasonable prices.
>>
>>56044394
>(x == 100 ?
> : x == 99 ?
> :
>tfw no pattern matching
>>
>>56044438
How would pattern matching make that any easier to write?

It's a simply int comparison.
>>
>>56044394
What's with the dollars? I honestly don't know C#. if that's for string interpolation the two first ones are unnecessary.
>>
>>56043646
>Haskell
>over-engineered
wew
>>
>>56044384
typeid(BaseObject);
typeid(OtherObject1);
typeid(OtherObject2);

Does not return sequential ids but that's the easiest way without having to resort to template madness.
>>
>>56044481
It's for string interpolation, and the first two ones are unnecessary.
>>
>>56044346
#include <stdio.h>
int number;
printf("enter number:\n");
scanf("%i", &number);

if (num==1) || (num ==3)|| (num ==5) || (num ==7) || (num ==9) || (num ==11) || (num ==13) || (num ==15) || (num ==17) || (num ==19) || (num ==21) || (num ==23) || (num ==25)
printf("number is odd");

else
printf("number is even");

>>
>>56044451
it's better than nested ?:
plus in haskell you can do it like this:

string 100 = "No more bottles of beer on the wall. :("
string 99 = "One last bottle of beer on the wall, take it down, pass it around"
string x = (show $ 100 - x) ++ " bottles of beer on the wall, take one down, pass it around"));
>>
>>56044525
bottlesOfBeer = map string [1..100]
where string 100 = "No more bottles of beer on the wall. :("
string 99 = " "One last bottle of beer on the wall, take it down, pass it around"
string x = (show $ 100 - x) ++ " bottles of beer on the wall, take one down, pass it around"
>>
>>56044681

mapM_ [1..100] $ putStrLn . string
where string ...
>>
>>56044384
http://pastebin.com/e2SmTJwh
Something like this I guess.
>>
>>56044681
defmodule Bottles do
def say(n) when n == 0 do
IO.puts "No more bottles of beer on the wall."
end

def say(n) when n == 1 do
IO.puts "One last bottle of beer on the wall, take it down, pass it around"
end

def say(n) do
IO.puts "#{ n } bottles of beer on the wall, take one down, pass it around"
end
end

Bottles.say 0
Bottles.say 1
Bottles.say 99
Thread posts: 333
Thread images: 23


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.