[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: 386
Thread images: 20

File: STRENGTH THROUGH PURITY.png (36KB, 2000x1412px) Image search: [Google]
STRENGTH THROUGH PURITY.png
36KB, 2000x1412px
Previous Thread: >>57008055

What are you working on, \g\?
>>
>>57012805
You were wrong because "in C++" it would run just fine, not that it matter.s
>>
>>57012800
making a game about going on a crusade to Jerusalem and raping women and children for a friend
>>
File: simon.jpg (80KB, 536x649px) Image search: [Google]
simon.jpg
80KB, 536x649px
>>57012800
>>
>>57012800
Thank you for using an anime image
>>
>>57012822
*My treatise on the OO community
>>
>>57012800
Shit, didn't expect the Haskell fag to make it.

Either way, thanks.

>What are you working on, \g\?
I'm working on a Xamarin application with a backend and notification broadcaster hosted in Azure.

I want to see how deep I can fit the Microsoft cock before I gag.

Metaphorically speaking, of course.
>>
>>57012800
My treatise on autism in the OO community.
>>
File: haskell.jpg (104KB, 768x1024px) Image search: [Google]
haskell.jpg
104KB, 768x1024px
>>57012829
You're welcome anon
>>
Writing a specification for my programming language which doesn't exist yet. Because any language without a formal specification is trash.
>>
>>57012864
Tell about your new language anon.
>>
>>57012880
Low level like C. But with nice high level features such as closures, everything is an expression, macros that aren't simple token replacement, interfaces, etc.

No inheritance. And certainly no features that require a large runtime such as exceptions. The language must be easily usable without the presence of a "standard library". Maybe even easier than C in this regard.

At the same time being able to #include C headers in some form is considered an essential feature because there are so many existing C libraries and manually writing bindings is an error prone and tedious process.
>>
>>57012152
Inheritance involves sub typing. For example, if i have

Foo -> Bar -> Alpha
-> Omega
-> Lambda


then later if i have to add a method to Foo, all the sub classes (Bar, Alpha, Omega, ...) automatically implements that new method due to Inheritance.

With composition, i would have to modify the code of every classes to write a redirection.
>>
how do you write an algorithm
>>
So the common lisp PSETF macro is pretty neat, eliminates the need for temporary variables with a cool use of evaluation order trickery

(psetf a b b a)

is a generalised analogue to Python's
a, b = b, a
>>
What would be a minimal implementation of a p2p protocol in C? What are the modern papers/projects I should be looking?
>>
>>57012980
Hence the syntactic sugar part. It forwards the method calls for you, but if you want to do anything else in the method you have to manually forward the call anyways.
>>
>>57012976
>Low level like C. But with nice high level features such as
I don't see a single correct thing in that first line
>>
File: 1474860398458.gif (1MB, 300x313px) Image search: [Google]
1474860398458.gif
1MB, 300x313px
>>57012864
>not writing your language in a theorem prover, thus creating a formal specification, constructively proving useful properties and implicitly building a correct-by-construction compiler for it along the way
pleb
>>
>>57012987
/dpt/ can't even write an algorithm that calculates the average of two integers.
>>
>>57012976
lmfao. you have no idea what you're doing, do you?
>>
>>57013022
(a + b) / 2
>>
>>57012987
what kind of algorithm and how efficient?
>>
>>57013029
Rude desu.
>>
>>57012976
You might be interested in C-targetting Scheme compilers. Chicken Scheme comes close to what you've listed
>>
I want to create a company that can be traded through programming, is that possible? Also if I'm running a virtual machine and the virtual machine gets a virus, does the machine outside the virtual machine also get a virus? Thanks.
>>
>>57012800
Need to implement measures like silhouette for clustering, logloss for classification and fscore.
The latter is easypeasy. but I'm yet to find a defintion of logloss and silhouette where I have my questions answered.
>>
>>57013031
incorrect, a + b will overflow for large enough values
>>
So I want to learn python as my first language, I learn by doing I'm looking for a python learning book that has projects in it and would it be ok to post each project on my github to prove I've worked through the book, if I explain all the code is from book x - want to learn python 3.x
>>
>>57013064
Architecture-specific implementation detail. The algorithm is correct.
>>
>>57013064
There was no assumption of what his a and b are. They may be integers in a bignum-backed language that are only constrained by the system memory.
>>
I wrote a script to automatically download torrents from an RSS feed. Any suggestions?
#!/usr/bin/env python3

import argparse
import os
import re
import urllib, urllib.request
import xml.etree.ElementTree

parser = argparse.ArgumentParser(description='RSS feed downloader')
parser.add_argument('url', help='feed URL')
parser.add_argument('dir', help='destination directory')
parser.add_argument('-t', '--title', default='.', help='title pattern')
parser.add_argument('-d', '--description', default='.', help='description pattern')
parser.add_argument('-l', '--link', default='.', help='link pattern')
args = parser.parse_args()

names = []
for root, dirs, files in os.walk(args.dir):
for name in files:
names.append(name)

headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36',
}
request = urllib.request.Request(args.url, headers=headers)
response = urllib.request.urlopen(request)
body = response.read()

root = xml.etree.ElementTree.fromstring(body)
for item in root.iter('item'):
title = item.find('title').text
safe_title = re.sub('/', r'\\', title)
description = item.find('description').text
link = item.find('link').text

if not re.search(args.title, safe_title):
continue
if not re.search(args.description, description):
continue
if not re.search(args.link, link):
continue

if safe_title in names:
continue

request = urllib.request.Request(link, headers=headers)
response = urllib.request.urlopen(request)
body = response.read()

filename = '{}/{}.torrent'.format(args.dir, safe_title)
f = open(filename, 'wb')
f.write(body)
f.close()
>>
>>57013123
the fuck is that
>>
>>57013048
>Also if I'm running a virtual machine and the virtual machine gets a virus, does the machine outside the virtual machine also get a virus?

There is occasionally malware that can break out of a vm.
>>
>>57013064
My implementation of the language uses distribute node-based computation power to expand memory as needed.

This includes contiguous caching to disk, if needed.

The underlying interpretational processes have been installed on nearly every computer in existence, giving me the ability to average two number of nigh-incomprehensible length.

Nerd.
>>
>>57013152
True, be extremely rare, and would have to be designed to take advantage of a particular flaw in a common VM tool.

I can imagine some sort of exploitation possible with the VMWare Tools installation process, or in cases where you use the host machine as a NAS device.
>>
Currently working on a small idle game just as a fun little project.
It's pretty comfy.
>>
>>57013073
unfortunately no. you provided a formula, not an algorithm. do you also think addition is O(1)?
>>
>>57013213
Nice strawman.

>>57013201
pics or gtfo
>>
what does the c in c++ stand for
>>
>>57013130
usage: matcha.py [-h] [-t TITLE] [-d DESCRIPTION] [-l LINK] url dir

RSS feed downloader

positional arguments:
url feed URL
dir destination directory

optional arguments:
-h, --help show this help message and exit
-t TITLE, --title TITLE
title pattern
-d DESCRIPTION, --description DESCRIPTION
description pattern
-l LINK, --link LINK link pattern
>>
>>57013213
you trying to count bit operations in simple addition as time complexity?
>>
>>57013228
cuck
>>
File: large.jpg (91KB, 500x421px) Image search: [Google]
large.jpg
91KB, 500x421px
>>57011958
>>57012496
>>57012540
>>57012620
>>57012659

Thanks DPT!

#include <stdio.h>
int main() {
char buffer[1] = {0};
FILE *fp = fopen("input.txt", "rb");
FILE *gp = fopen("output.txt", "wb");
if(fp==NULL) printf("I fucked up\n");


int stream;
int agete = 0xCC;
int hibikase;
while((stream = fgetc(fp))!=EOF) {
hibikase = stream;
fputc(stream ^ agete, gp);
agete = hibikase;
}
return 0;
}


XOR decoder/encoder with a twist. Used for deobfuscating Gauss NSA malware resources 100, 101 of Gödel dskapi.ocx
>>
please stop using c "the meme" programming language

thank you
>>
>>57013228
combined
>>
>>57013240
not me mate, reality https://en.wikipedia.org/wiki/Computational_complexity_of_mathematical_operations

>>57013226
i don't think you're understanding what i'm saying
>>
I'm writing a program that takes matrices from multiple files and stacks them in a deque (i need it for push and pop operations). However when I check the deque after pushing everything on, every index has the same matrix.

int i, j;
deque<Mat1f> sst;
deque<Mat1f> bt11;
deque<Mat1f> bt12;
deque<Mat1f> bt08;
deque<Mat1f> dt_analysis;
deque<Mat1f> mags;


Mat1f sst_temp(HEIGHT,WIDTH);
Mat1f bt11_temp(HEIGHT,WIDTH);
Mat1f bt12_temp(HEIGHT,WIDTH);
Mat1f bt08_temp(HEIGHT,WIDTH);
Mat1f dt_analysis_temp(HEIGHT,WIDTH);
Mat1f mags_temp(HEIGHT,WIDTH);

vector<string> curPaths;
int time_size = 27;
int time_ind = 27;
int x,y,t;
//int loc = get_current_files(paths, curPaths,time_size,0);

for(j=0;j<time_size;j++){
//printf("%s\n",paths[j].c_str());
readgranule(paths[j],sst_temp, bt11_temp,bt12_temp,bt08_temp,dt_analysis_temp);
gradientmag(sst_temp, mags_temp);
sst.push_back(sst_temp);
bt11.push_back(bt11_temp);
bt08.push_back(bt08_temp);
bt12.push_back(bt12_temp);
dt_analysis.push_back(dt_analysis_temp);
mags.push_back(mags_temp);
}

Can anyone help me out please. I have a feeling that the deque is just pointing to whatever is in the *_temp variables.
>>
>>57013282
Since you're so dense, here's a CLRS-level description of an algorithm for computing the mean of two integers:

Input: integers a, b
Output: integer d
Algorithm:
1. c := a + b
2. d := c / 2
>>
>>57012800
A classic rpg written in C# since I am learning the language (testing out my OOP skills) also still have not learned the language fully yet just wanted to start on a project to build my foundation.
>>
>>57013358
>testing your OOP skills with a game
You mean your skill to realize that you should probably not use OOP?
>>
>>57013316
where's the binary tree
>>
>>57013396
Are binary trees are flat in the land of S^1.
>>
>>57013358
If LINQ was a penis, I would gargle that semen all day, every day. You know, metaphorically speaking.

I do hope you're abusing it to the fullest.

Are you using Unity or something similar for the graphics?
>>
>>57013000
It's not. syntaxic sugar is when you augment the syntax of a program without the need to also augment its semantics, you seem to confuse inheritance with some mechanism for automatic code generation. You also seem to confuse a concept with the implementation of that concept.
>>
>>57013435
I think we can all agree that OO, as an implementation, has failed.
>>
>>57013460
What is OO?
>>
>>57013475
object orientation
>>
Can your language do this?
data Circle : Type where
base : Circle
loop : Circle == Circle
>>
>>57013481
No, I mean what makes something "object-oriented"?

What is OOP?
>>
File: 1104945564.jpg (64KB, 525x800px) Image search: [Google]
1104945564.jpg
64KB, 525x800px
how far did this set us back?
>>
>>57013493
I boo-booed.
data Circle : Type where
base : Circle
loop : base == base
>>
>>57013282
>n-digit
Are you fucking retarded?
>>
>>57013495
Inheritance and strict encapsulation.
>>
>>57013511
Can yours? HITs are cool, I have yet to see a single practical application tho.
>>
>>57013460
>OO as an implementation
I don't understand.

>>57013495
It's when you program with objects, when your code is modeled around them.
>>
>>57013538
What's wrong with either of those?

Is that all OOP is?

Just inheritance and "strict encapsulation"?

Does everyone agree with this definition?
>>
>>57013511
I don't get it

{-# LANGUAGE GADTs, PolyKinds #-}
data Circle a where
Base :: Circle a
Loop :: Circle (Circle ~ Circle)
>>
>>57013561
Those are two features that have failed. There might be others but those come to mind.

Just look at the cancer that is friend functions in C++ to work around encapsulation.
>>
>>57013573
Does that even compile? Either way it's something completely different. In pseudo-Haskell syntax, it would be something like
data Circle where
Base :: Circle
Loop :: Base ~ Base
>>
>>57013123
I fucked up somewhere along the line. This one is working (tested with nyaa feed and rarbg feed):
#!/usr/bin/env python3

import argparse
import os.path
import re
import urllib.request
import xml.etree.ElementTree

parser = argparse.ArgumentParser(description='RSS feed downloader')
parser.add_argument('url', help='feed URL')
parser.add_argument('dir', help='destination directory')
parser.add_argument('-t', '--title', default='.', help='title pattern')
parser.add_argument('-d', '--description', default='.', help='description pattern')
parser.add_argument('-l', '--link', default='.', help='link pattern')
args = parser.parse_args()

names = []
for root, dirs, files in os.walk(args.dir):
for name in files:
root_name = os.path.splitext(name)[0]
names.append(root_name)

headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36',
}
request = urllib.request.Request(args.url, headers=headers)
response = urllib.request.urlopen(request)
body = response.read()

root = xml.etree.ElementTree.fromstring(body)
for item in root.iter('item'):
title = item.find('title').text
safe_title = re.sub(os.sep, '-', title)
description = item.find('description').text
link = item.find('link').text

if not re.search(args.title, safe_title):
continue
if not re.search(args.description, description):
continue
if not re.search(args.link, link):
continue

if safe_title in names:
continue

request = urllib.request.Request(link, headers=headers)
response = urllib.request.urlopen(request)
body = response.read()

filename = '{}{}{}.torrent'.format(args.dir, os.sep, safe_title)
f = open(filename, 'wb')
f.write(body)
f.close()
>>
>>57013423
no no lol, I am doing command line
>>
>>57013065
I found python too complicated, once I grasped loops, if/elifs, index's, functions, I moved on to C so I could relearn all that, and make it still seem like Im being produdctive
>>
>>57013582
In what way have they failed?

Don't massive companies use OOP principles in the vast majority of their large code-bases?

Is C++ really the "poster-child" of OOP?

Why haven't these organizations with unimaginable resources realized that OOP is somehow objectively a bad thing from a cost-benefit aspect? Haven't they performed studies on productivity with languages like Haskell? Have the vast majority of professionals in the world gone insane?

Who makes money off of "object-oriented programming"? Is it universities? The book-makers with excess supply? Why don't they write books targeted at entry-level CS majors for languages that don't use objects?

Is Python OOP?
>>
>>57013065
anyone?
>>
>>57013561
no, that guy has no clue. algebraic (abstract) data types are also about inheritance and strict encapsulation but he probably has never heard about them. The differences between an adt and an object help a lot to understand what objects are really about.
>>
>>57013659
>algebraic (abstract) data types
those are two distinct things, just fyi
>>
>>57013123
For you're os.walk, you should add the parameter, topdown=False
>>
>>57013653
oh ya, proofs

>>57013084
https://github.com/codingducks?tab=repositories
>>
>>57013255
There you go. It's a little clumsy, but it's okay.

For extra points, close the files after you're done. Your operating system closes them for you, but it never hurts to clean up after yourself.
>>
>>57013493
Can you're language do this
with open('cuck.txt', 'w') as cuck:
cuck.write('already done')
>>
>>57013655
C++ is and has always been a multi paradigm language. Its implementation of object orientation has failed.
>>
>>57013675
those two what ? what are you talking about ?
>>
>>57013729
algebraic data types is a distinct notion from abstract data types
>>
lads how do I find out if an element i attempt to add to a set in python is a duplicate? I'm making a program that lets the user input numbers that are added to a set, and prints out the values the user entered more then once. I'm trying to practice sets but I'm stuck on this one.
>>
>>57013729
>using the question mark with the whitespace immediately prior
>>
>>57013554
data Nat : Type where
zero : Nat
succ : Nat -> Nat

data Int : Type where
pos : Nat -> Int
neg : Nat -> Int
neut : pos zero == neg zero

The practical usage of the "neut" path is to force all functions on Ints to do the same thing for +0 and -0. When pattern matching on an Int, you have to also provide a proof that f (pos zero) == f (neg zero), i.e. cong f neut. For example (in this case it's trivial):
ndouble : Nat -> Nat
ndouble zero = zero
ndouble (succ n) = succ (succ (ndouble n))

idouble : Int -> Int
idouble (pos n) = pos (ndouble n)
idouble (neg n) = neg (ndouble n)
cong idouble neut = neut


>>57013573
No.

>>57013659
>algebraic (abstract) data types
They're not remotely the same thing.
>>
>>57013754
There's something called Counter in collections

>>57013758
>The practical usage of the "neut" path is to force all functions on Ints to do the same thing for +0 and -0. When pattern matching on an Int, you have to also provide a proof that f (pos zero) == f (neg zero), i.e. cong f neut.
That's p cool, thanks.
>>
>>57013653
>"I found python too complicated"
>"python too complicated"
>"python"
>"complicated"
this is /dpt/ in a nutshell
>>
>>57013716
Aight I'll fix that small issue and thanks for your insights.
>>
>>57013802
meant to reply to
>>57013750
>>
>>57013747
>>57013758
wow, just wow. it's obvious that i am only referring to algebraic abstract data types here, i surrounded "abstract" with parentheses to made a precision. if i wanted to refer to both, i would have wrote "algebraic abstract/data types".
>>
>>57013827
>algebraic abstract data types
That's not even a thing.
>>
>think of debt like technical debt
is this the most hacker news comment in history?
>>
>>57013853
Needs more VCs and Go microservices.
>>
>>57013802
More formally, the eliminator for Int might look like this:
ielim : (F : Int -> Type) -> (hpos : (n : Nat) -> F (pos n)) -> (hneg : (n : Nat) -> F (neg n)) -> (hneut : hpos zero == hneg zero) -> (i : Int) -> F i


You don't even need HoTT for this particular encoding since there are no higher equalities. Something like Observational Type Theory can support so-called "quotient inductive types" just fine.

>>57013827
Why did you even write "algebraic"?
>>
>>57013853
This is absolutely right because venture capital can be used to deal with both.
>>
>>57013758
So it exists to slightly improve on redundant implementations?
>>
Any CS related audible books out there?

Or program for text to voice
>>
>>57013758
>>57013843
analyze the differences between an data type and abstract data type, then between an algebraic data type and an a data type.
>>
So I was thinking of adding a books repo on my github, then uploading the code from all the projects I work through to kind of prove I've done them, is this a good idea?
>>
>>57013924
It's only a slight improvement for the integers, yeah. But it makes the rational numbers and AFAIK the real numbers a hell of a lot easier to define in a succinct way.

For example, the HIT rationals:
data Rat : Type where
div : Nat -> Nat -> Rat
reduce : (m n : Nat) -> div m n == div (m / gcd m n) (n / gcd m n)

Without HITs you would need to either use a cumbersome setoid implementation, or hide the implementation like some OO pleb.
>>
>>57014074
>books repo
What?
>>
>>57014091
>2016
>you can't write this and have the proofchecker internet connected autocorrector compiler self-aware AI supercomputer typechecker machine translate this for you
>>
>>57014116
A repo called "books" then when I work through a book I post all the code from the book to the repo to prove I've done it
>>
>>57014121
I need one of those to figure out what the fuck you just said.
>>
>>57014128
did your ismarterthanuPhone not translate that for you
>>
>>57013065
http://www.composingprograms.com/
>>
multithreaded HTTP video streamer in C
yeah I know there's apache or vlc but I want to make a small simple tool unix philosophy style
>>
>>57014147
>composingprograms
>python

But python is bad at composition
>>
>>57014074
Prove to whom?
An Employer wouldn't look after that.
I'm not saying don't do the exercises, because you need to learn it somehow, but this is solely for yourself. And don't stress on it.
What really counts in a github for others is how well you cooperate in other projects, via commits.
>>
>>57012864
>>57012976
just because i feel bad for being rude earlier, here is some advice: don't write the specification first. most PL specifications that exist were written after the implementation, or in rare cases at the same time as the implementation was being written.

i don't think you are considering how the features of your PL interact. if you want to include c headers you are already committing to statements instead of expressions, and what's the value of your interface declarations anyway? if it has a value, your runtime's getting bigger and bigger due to the extra type checking

that doesn't even address the practicalities of using a language with no gc (i'm assuming) or no standard library (there's a reason common lisp beat out scheme).

i could be way off base here since it's 3am and i'm drunk, but it should at least get you thinking about this stuff
>>
>>57014162
ok thanks
>>
>>57014145
>I don't understand thing so I'll just call him pretentious
>>
>>57013750
if x in set: error()
>>
>>57013750
You could use set.intersection() with the user provided element to check it is already in the set.
>>
>>57014183
Maybe if you don't understand you should try learning
>>
>>57014161
You're an idiot.
>>
>>57014207
>insult
As expected from a snekfag
>>
>>57014168
>if you want to include c headers you are already committing to statements instead of expressions
Naturally inclusion will not happen via the C preprocessor or some nonsense like that. Inclusion happens via some command which will then make the types and functions available to the program.
>and what's the value of your interface declarations anyway
what do you mean by this?
>that doesn't even address the practicalities of using a language with no gc
There are many of those. What you do mean by this?
>or no standard library
Naturally there will be a standard library. But the language will be fully usable without it.
>>
>>57013750
If you want to practice sets find a problem that sets are actually suited for
>>
File: Custom Database Ripping.png (1MB, 1917x1005px) Image search: [Google]
Custom Database Ripping.png
1MB, 1917x1005px
Retoasting from last night
>Crawler can now, solely though the use of options, be directed to download arbitrary data and then to save said arbitrary data into a database and catalog it based on tags pulled from the -t option
neato burrito
Here it is ripping the entirety of Paheal to a db and sorting by tag
>>
>>57013864
>microservices
When will this meme die? I'm blaming Node for this.
>>
>>57014340
l-lewd
>>
>>57014367
What's wrong with microservices?
>>
>>57014379
you dont seem to mind it~
>>
It feels so good to actually be doing something with my life.
I'm no longer in that state of despair and hopelessness.
Programming has saved me.
Has it saved you?
>>
>>57014458
since I've been using programming as a distraction my psychosis has improved
>>
>>57013758
>>57013874
>>57014091
What does learning this stuff enable you to do that would otherwise not be possible
>>
>>57014472
Write proofs (statically verified programs) about certain things easily.
>>
>>57014492
Can you give a concrete example?
>>
>>57014515
Look up CompCert.
>>
>>57014458
For some days I'm back on track again, which makes me kinda happy.

>>57014469
it got better or it got better at being a psychose?
>>
>>57014385
They create more problems than they solve- mostly technical issues that greatly complicate your infrastructure. The problems that they do solve can be negated more effectively by simpler alternatives. The only reason they are popular now is because Node.js needed a workaround/justification for being single-threaded.

This talk summs it up quite nicely https://youtu.be/JXEjAwNWays?t=342
>>
>>57014536
I'm having less hallucinations and delusions
>>
>>57013655
>if big companies are using X, then X must be the best thing ever
Will this meme ever die? Big companies almost always choose a cheap, but good enough solution, over a costly one that's superior from a technical standpoint.
>>
>>57014555
>if big companies are using X, then X must be the best thing ever
Literally no one said this or implied this.
>>
>>57014541
that guy looks like a faggot
>go conference
it all makes sense now
>>
>>57014576
nice adhom cuck
>>
>>57014531
Different strokes for different folks I guess.
>>
>>57014600
>cuck
So this is a gofag
>>
>>57014606
>it's OK if people die because of a bug in GCC
Some people simply disagree with that sentiment and strive to create correct software.
>>
>>57014576
No, he's just a macfag. There are those at any language conference. Apple slurpers is sadly a very big slice of the general programmer community. But that's just ad hominem. The guys that started the microservice craze are even bigger faggots - JS frontend hipsters turned full stack.
>>
>>57014576
he's just european
>>
>>57014655
>60%
>>
>>57013655
>Why haven't these organizations with unimaginable resources realized that OOP is somehow objectively a bad thing from a cost-benefit aspect? Haven't they performed studies on productivity with languages like Haskell? Have the vast majority of professionals in the world gone insane?

The most expensive thing to do is to change course. This is how big business works. Cost of development is nothing compared to the value of key projects.

Haskell has the best opportunity on newer applications, not on legacy one.
>>
>>57014622
I just can't get excited enough about creating a statically verified C compiler to crack open a tome on type theory

I'm glad there are people who can though, that seems important
>>
>>57014492
Ah, proofs. My old enemy.
>>
>>57014709
What major new applications are being developed with Haskell?

I see new projects spring up all the time in my network of enterprise dev friends, and I've literally never heard of anyone writing a large application in Haskell.

The most I've seen is small component libraries doing something trivial that are to be used by much larger code-bases.
>>
>>57014548
hm. If I lose my delusions I mostly stop programming again.
>>
>>57014777
Facebook
>>
>>57014458
Saved me? Not really.

It has finally given me a creative outlet to make money off of, though.

Too little demand for jazz and swing these days.
>>
>>57014777
Google is doing their AI in Haskell, they are hiring people based on their search history because they are so desperate for Haskell devs.

Facebook does their spam filtering and prevention (very huge, expensive, and critical technology) in Haskell.

>https://www.youtube.com/watch?v=mlTO510zO78

A lot of new AI and financial development work is being done in Haskell. It has very good applications in niche projects, but for general purpose business logic there is no point since they have legacy code that needs to be maintained and want easily replaceable developers.
>>
File: Custom database ripping SFW.png (805KB, 1031x812px) Image search: [Google]
Custom database ripping SFW.png
805KB, 1031x812px
>>57014379
Nuttin lewd about it anon
it's just lotsa data

I'm fucking S H O C K E D that they're letting me download fullsize images from their website at 35Mbps and that they have been for hours.
>>
How can I learn to program something useful?
>>
>>57014340
>obama
>trump
>clinton
>bush
...really?
>>
>>57014935
>rule34: If it exists, there is porn of it

It escaped straight into the featured images page first thing so that's why there's so much prez/prez hopeful porn
>>
>>57014541
interesting talk. I always figured that microservices likely have the same problem that OOP has.

In that people have this idea that classes in OOP are this great fix-all solution to encapsulation. But in reality they aren't because changing Class1 might end up breaking Class2 because the messages Class1 sends to Class2 now reveal some bad design in Class2, like it can't handle a null being sent to it, or it can't handle methods being called in a different order etc. This isn't a terrible big problem usually, but it is if you can't change Class2.

Feels like when updating microservices you have a decent chance of breaking the entire system, even though you only change one of the 50 services because even though they are encapsulated, they are interdependent on each other.
>>
>>57014869
>Google is doing their AI in Haskell
Source? I thought Google AI lang was C++/Python via TensorFlow
>>
>>57014869
>Google is doing their AI in Haskell
no, it's c++ and python.
>>
File: 1457300833_XDbmM0ZhsI4.jpg (29KB, 500x500px) Image search: [Google]
1457300833_XDbmM0ZhsI4.jpg
29KB, 500x500px
>>57013263
>please stop using c "the meme" programming language
>thank you
It's pure, so why am I not surprised a cuck like you can't relate to that concept.
>>
>>57014970
>>57014989
I am certain of this, because a Co-Worker was contacted by Google based on his search history. I don't know how big the projects they are doing, it could be purely academic for all I know. But I do know they are doing Haskell work for AI at some level.
>>
>>57012821

I was unironically thinking about making a real time strategy game where you can pick muslims, christians or jews:
Muslims are like the zerg, because they are literally everywhere and win by their sheer masses.
Jews are like the protoss, there are not so many of them (cosidering the size of Israel), but they are very powerfull.
Christians are like the Humans, they are more balanced, but also a little bit boring.

For each fraction you have to win at three ages:

MUSLIM CAMPAIGN
Level 1-3:
Play leader Muhammad, gather your troops, fight against the older religions and become leader of all muslims.

Level 4-6:
Play Saladin, fight off the crusaders. At level 6, the crusaders invade Jerusalem, you have to protect certain people while evacuating the city.

Level 7-9:
Lead a modern Djihadist group, at the final level you destroy the WTC and kill the christian and jewish leader (president of the US and Israel) with suicide bombers.


JEWISH CAMPAIGN
Level 1-3:
Escape from the pharao, fight off egyptian army and create you own state, protect it's boarders.

Level 4-6:
Survive WW2 as a jewish leader of the resistance. At level 6 you play underground fighters in the warsaw ghetto.

Level 7-9:
Escape from the nazis, fight off egyptian army (again) and create you own state (again), protect it's boarders. At the final level you destroy iranian nuclear rockets and kill the muslim brotherhood with hamas agents.


CHRISTIAN CAMPAING:
Level 1-3:
Play Charles Martel, lord of the franks, defend europe against the muslim invaders, save your culture from extinction.

Level 4-6:
The Battles of Kosovo (1389, 1448), defend europe against the muslim invaders (again), save your culture from extinction (again).

Level 7-9:
You are the NATO chief, protect some shithole country from suicide bombers, try to prevent the jews killing some iranian scientist. At the final level you destroy Mekka with a nuke and reign over the shattered arabian countries and israel.
>>
File: 1475776277981.jpg (115KB, 392x450px) Image search: [Google]
1475776277981.jpg
115KB, 392x450px
>>57015030
>a Co-Worker was contacted by Google based on his search history
>tfw you'll never be hired by Google, because you use ixquick
>>
Creating an Android app with Xamarin.
Do I need to create a REST API to connect to my database?
Get an SSL not implemented error when I try doing it through a .dll I created.
Only an app I want for myself to learn app dev with so don't really wanna pay $30 for a SSL cert unless I absolutely have to.
>>
>>57015072
https://letsencrypt.org
>>
>>57015030
sure, and my co-worker is rewriting linux in haskell.

tensorflow: c++, python
alphago: c++, lua, cuda
>>
>>57015025

C is like the vampire you posted:
-old
-powerful
-pretty much outdated and not really interesting unless you're into this kind of stuff
-impossible to kill, no matter how hard you try to get rid of it..
>>
File: mmm data.webm (987KB, 935x984px) Image search: [Google]
mmm data.webm
987KB, 935x984px
>>57014869
Why would they choose Haskell if they have such a hard time finding developers?

also
>Once this is done, it's time to aim it at tumblr blogs and reave that sweet sweet personal data
>>
>>57015052
made me smile, thanks.
>>
>>57015167
You have a reflected and moderate view on the language, I appreciate it. Well I guess it will survive in its own niche as you said. Just like Matlab ;_;
>>
>>57015189
>Why would they choose Haskell if they have such a hard time finding developers?
Because it's good for mathematical problems?

I might be talking out of my ass, but doing OOP in Haskell must be hell. To name a thing where it might suck.
>>
>install eclipse
>printf doesn't immediately print to console
>bug listed as "Solved" on eclipse forum
>ticket opened in 2005
>last message from 2014
>"this bug is still unsolved as of 2014"
>>
May someone realize Segmented Sieve Eratosthenes on turbo pascal.
Yes, my teacher so crazy.
>>
>>57012976

So basically Haxe (or Crystal)?
>>
>>57015255
Use a real IDE such as Emacs or NeoVim.
>>
>>57015255
>syntax highlighting now supports newest c++ standard
>everything still marked as error
>issue is known

I really got used to it over the years, but it's sometimes really unbearable
>>
>>57015189
Haskell is one of the few languages that can abstract away details like how exceptions are propagated, how computations are threaded, etc. without being a messy stack of nested lambdas with greater and greater nesting and a big }}}}}}}}}}}}}}}}}} at the end.
>>
>>57015304
>NeoVim
>The current stable version is 0.1
>"A nice looking website, that’s one thing Neovim did right." —Bram Moolenaar
>>
>>57015255
Because eclipse is for java
>>
>>57015334
>[](){}
>mfw lispfags were epicbtfo by bjarne
>>
>>57015304
>Use a real IDE such as Emacs
I don't need another OS


even though with evil it's quite good
>>
>>57015366
>Bram Moolenaar, the """""maintainer""""" of the piece of shit that Vim was just a few months ago
I don't think I've ever even seen NeoVim's website, btw, but the software is really fine.
>>
File: 6acb07c8.png (1MB, 1906x1080px) Image search: [Google]
6acb07c8.png
1MB, 1906x1080px
>>57015380
>>57015334
>>57015444


smells like cunts in here and not the good kind
>>
>>57015283
nobody help?
>>
>>57015366
source?
>>
>>57015490
neovim's own website
>>
>>57015479
tp isn't hard. Just do it.
>>
>julia logo on the homepage is svg
simply epic
>>
File: yuit.png (192KB, 757x1492px) Image search: [Google]
yuit.png
192KB, 757x1492px
How about you retards quit circle jerking over what your opinions on what's better and actually just spend time making something? Holy fuck /dpt/ went to 94% to 100% trash over the last couple years...
>>
How do I get a programming job?
>>
>>57015572
If we knew, why would we tell you?
>>
>>57015572
Step 1: Learn to program
Step 2: Get a job
>>
>>57015052
Can Slavic Orthodoxy be infested Terrans? They are basically Zerg, when it comes to warfare.
>>
>>57015572
you forgot to mention that you've never programmed in your life
>>
>>57015570
people make stuff here. Most people don't want to post stuff that on 4chan that they actually want people to know in real life that they madem especially if it's for work.
>>
>>57015591
I can write fizzbuzz without any help
>>
File: TurboPascal7.jpg (29KB, 425x261px) Image search: [Google]
TurboPascal7.jpg
29KB, 425x261px
>>57015543
I don't know, how realize Segmented Sieve.
Or made this code more faster
>>
>>57013019

Isn't this pretty much what OCaml does?
>>
File: 2014-08-12_06-15-41-231.webm (3MB, 800x808px) Image search: [Google]
2014-08-12_06-15-41-231.webm
3MB, 800x808px
>>57015594
You'd be wrong. Doesn't have to be, "hey guys, check my linkedin and github!". At least there used to be projects and progress.
>>
>>57015301
I haven't looked into Haxe but certainly not like Crystal. Crystal seems to have regex and hashmaps built into the language.

>Don't do anything in the language that can be done in a library.
>>
>>57015052
I can already see the ALLAH AKBAR banelings. God speed, anon!
>>
>>57015563
which?
>>
>>57015648
There was some guy posting about a interesting console emulator he was working on yesterday. Some other guy today was talking about a language spec he was working on.
>>
>>57015609
Because this algorithm crush on 10^8
But necessary 10^10
May someone help?
>>
>>57015570
well, normally when you post some finished code, problems or questions you don't get any replies fast enough around the baiters and shitposters before the thread 404s.
>>
>>57015570
Retards that cannot fit in keep saying "thing X was ruined, it was so much better YZ years ago"


>How about you retards quit
you first
>>
I'm making a game about some guy on r9k who filmed girls shitting and is going to prison, is it a bad idea to put this on my github I use to apply for jobs?
>>
>>57015570
So what have you worked on lately?
>>
What's some good projects to make for a github account?
>>
i am way too afraid to show you guys code
>>
>>57015709
>is it a bad idea to put this on my github I use to apply for jobs?
I don't know any other answer I could possibly provide in response to this question apart from: "yes"
>>
>>57015728
Don't be.

We'll tear the shit out of it. But we'll also make you stronger. The dark side of the force is strong.
>>
>>57015724
>commits to big projects
>everything collaborating

Not helpful:
>trivial shit
>soloprojects

avoid:
>>57015709
>>
>>57015724
Make a windows service that creates a random text file everyday and then pushes it to your master branch
>>
>>57015709
Github is infested by SJWs. Your repo will be taken down in a minute.
>>
>>57015735
The dev of LoliSim landed a job at a game developer because of it.
>>
>>57015677
I didn't say there were none, but the ingenuity of this daily has gone down significantly; 9/10 times there's no point of even reading a majority of the posts. Sorry, I just find it depressing. I know this is a recurring story here (4chan).

>>57015697
See above. "Cannot fit in" is a bit of a reach; I swear being retarded intentionally is becoming a trend.

>>57015695
So you see the issue. Not trying to claim pointing it out will fix anything, just wanted to vent a bit.

>>57015722
Nothing too interesting. I got a full time job and find it hard to work in programming as a hobby, which is unfortunate. Sometimes I get to program stuff at work only because they found out I could, which may open some more stuff up later; recently I helped work on some cloud backup frontend. Coming from C and perl, it wasn't the most exhilarating thing, I actually hate webdev but I enjoyed the time I worked on the project, considering it isn't my job.
>>
>>57015770
is there an alternative to github that's more lenient on projects?

also it's based on a true story not like I have some fetish or something
>>
>>57015786
>but the ingenuity of this daily has gone down significantly
seems about the same to me. May you're just getting depressed.
>>
>>57015747
i don't mind criticism of code, but i don't want to be identifiable. that's all
>>
>>57015803
that's pretty wise.
>>
>>57015802
Well that's a given. To say this isn't a minor contribution to that would be a lie though.
>>
>>57012988
it's basically setf but with the evaluations done "in parallel". so you can't rely on the values set earlier in a given psetf to have taken place already
>>
>>57015642
You mean CakeML?
>>
>>57015656

If you hate a "sane" standard library, you should look into Go. You can't even I/O without a library.
>>
>>57015642
OCaml's written in OCaml. I don't know of any Coq proof for the compiler or anything of the sort.
>>
>>57015789
You could write into your github profile bio that you're a black girl, then they'll leave you and your repos alone :^)
>>
File: gopher-150.png (37KB, 150x278px) Image search: [Google]
gopher-150.png
37KB, 150x278px
heard someone talking shit
>>
how is vs code so much better than atom
>>
>>57015895
i remember when it came out people pointed it out it was way better at opening large code files.

Also DevDiv in MS is actually one of the few departments in microsoft that is actually competent.
>>
>>57015849
The standard library is also a library.
>>
>>57015869

Is that an indian Go mamal?
>>
>>57015869
Go is a nice language that may or may not succeed, but it will take several decades to fully replace high-performance applications written in C++ or C.

I am willing to bet Google fucks it up in the meantime.
>>
What I'm doing wrong?
void MiniMap::render(P p){
Uint32 newTime = SDL_GetTicks();
if(newTime-timeMini>2000){
updateMinimap();
timeMini = newTime;
}

renderTexture(tex,ren,p,true);
}


timeMini never becomes newTime, it stays the same.
They are both Uint32.
>>
>>57015924

So where's the profit?
You enforce a fuckoad of "includes", why bother the user with that stuff?
>>
>>57015927
it's the logo for
http://www.gophercon.in
>>
Do github just remove individual projects or will they delete my account?
>>
>>57015570

Right.

Now why is Rust such a clusterfuck? How are they trying to convince anybody to use that shit?
>>
So I'm having this problem in Python 3,
x = 2e6
y = 3e-6
print("x is {0:.2f}, y is {1:.2f}".format(x,y))

returns
x is 2000000.00, y is 0.00
Ideally I would like it to return
x is 2.00e6, y is 3.00e-6
Tried googling but I don't understand the answers. The formatting options seem just to change the decimal places rather than change their precision.
>>
File: telemetry.jpg (175KB, 763x400px) Image search: [Google]
telemetry.jpg
175KB, 763x400px
>>57015895
>>57015916
note that vs code is a botnet until you tell it not to
>>
>>57015962
what is timeMini's initial value? i find your way of calculating the elapsed time confusing. check out: http://gafferongames.com/game-physics/fix-your-timestep/
also you shouldn't update your state in the render methods.
>>
>>57016032
the format modifier for floats in exponential format is e, not f.
At least it was when I last used python, not sure whether its still in 3, but give it a try and report.
>>
>>57016024
>How are they trying to convince anybody to use that shit?

People are tired of using C for large projects. Rust can give comparable performance, and maybe Go (?), while avoiding a lot of the problems, but creating some new ones too.
>>
>>57016032

print("x is {0:.2E}, y is {1:.2E}".format(x,y))
>>
>>57016129
>>57016141
o shit it works
thanks
>>
>>57015856

Guess I got confused since Coq is written in OCaml.
>>
>>57016042
maybe that's why its so good
>>
>>57015570
>unsigned int
Whoever that was should kill themselves
>>
>>57016261
can store integer values twice the size of int, and i would have no reason to ever be negative. good call in my mind.
>>
>>57016261
this, unsigned should be the default
>>
>>57016261
Name a valid reason not use unsigned for exclusively positive values.
>>
>>57016152
You're welcome.
>>
>>57016342
*your
>>
>>57016078
I'll try later to do a system like that.
The value never changed because I didn't put an & on the function parameter and I was using a copy of it.
>>
>>57016024
>Now why is Rust such a clusterfuck?
What did he mean by this? Seriously tho, why does pretty much all of critique of Rust in dpts boil down to "muh syntax", "muh stdlib", "muh clusterfuck", "it's not lisp", "it's not hasklel" or "muh cuckzilla" instead of any real arguments?
>>
>>57016348
those are real arguments. The first 3 things are actually pretty important.
>>
>>57013385
Why not? Serious question.
>>
>>57016348
>he
>>
>>57016324
bad programming habit. data types shouldn't do the thinking for you.
>>
>>57016324
Undetectable overflow
>>
File: what is thos.png (657KB, 962x447px) Image search: [Google]
what is thos.png
657KB, 962x447px
Is there any way to make the windows cmd line look as pretty as the OSX terminal? I'm not talking about text rendering, I mean that semitransparent fogged glass look, with the text itself being 100% opaque. The only option on windows is to make the whole window including text semitransparent and that's kind of lame.
>>
>>57016413
and it wont?
it just just communicates to anyone trying to read the code that the variable will never be negative, and of course it can also store an integer twice as large if you need it.
It's a good habit to make your code readable.
>>
>>57016413
>bad programming habit.
Why?
>>
>>57016447
but why would you want that?
>>
>>57016362
no, they're not and they're completely subjective. Especially "clusterfuck", since Rust is probably the cleanest language given its type system complexity.
>>
>>57016472
Because it looks nice
Why else? CMD windows look shitty and I prefer to work with things that don't look terribad (Although if I have to I will, I'm not a faggot that's going to let a terminal not looking good stop me from working with it)
>>
>>57016477
What are the issues with rust these days?

I remember hearing that you had to recompile external libraries a lot because of they way it was set up and compile times take forever. Any of that true?
>>
>>57016504
>beautiful clean minimalist white on solid black
>better than a transparent window over your sexy anime girl wall paper that makes the text harder to read
each to her own I suppose
>>
>>57016455
>>57016459
see >>57016422
if you are so absolutely sure, that your variable will never be negative, than you can safely use a normal int anyway.
and even if you do really do more than 2 billion iterations (in case of a 32 bit int), which is rather unlikely, just use a bigger word size.
>>
>>57016525
I wish I knew. I don't use Rust tho. Last time I checked they were going down hard on performance,
>>
>>57016541
fair enough
>>
>>57016540
>Implying that white text on a black background is ~minimalist~ and not utilitarian
Listen, there's nothing wrong with it but it also doesn't look good- and don't pretend it does.
>>
>actual discussion

woah there, what happened to this place

I'm a Haskell programmer for a living, ask me stuff I guess, if you want to

Don't have my trip on hand...

>>57016422
If you care about overflow then either you're going to use arbitrary precision data type or you're going to have to check it everywhere anyway just like you do with signed version. You lose half the allowed values of the integer on storing "have I overflowed but not that much"? If you're overflowing with `max + 1`, it goes right back into positives and signed gives you nothing except bad data.

>>57016459
I don't know why anyone would think that data types carrying invariants are "bad programming habbits".

>>57015572
Program a bunch somewhere where people can see, work on projects people actually use (this means join an existing one, 99% of the time) and meet some people (go to some conferences). At least this will give you a lot of opportunities, not saying it's strictly necessary.

>>57014777
A lot of "big" Haskell applications you actually never hear about until you're in the business. It's all mostly behind closed doors because clients pay out big money for software so why yell about what they are doing? They are certainly there, just not visible to the public if you don't know where to look and who to ask.

>>57016541
See above
>>
#define c = useless?

the c programming language second edition, first exercise (1.4)

is there any point in

#define LOWER = 0 // lower table limit


instead of declaring it with a comment?

lower = 0; \\ lower table limit 
>>
>>57016589
>>Implying that white text on a black background is ~minimalist~ and not utilitarian
It can be both. Which is wonderful.
>>
>>57016477

Rust might be clean, but it's syntax is just so incredibly complex that C++ looks easy.

>>57016024

>nobody got the irony here
>>
>>57016568
doesn't mean there aren't any reasons to use unsigned though. simply storing positive integer values where you don't do incrementation is a good reason for example.
>>
>>57016609
>max + 1

Sorry, meant to say `ceil ((max + 1) / 2)` of course. Or somewhere around there. You get the idea.
>>
>>57016589
>>57016540
>>57016504
>>57016472
>>57016447
I thought he mean the needless output. Half of that is absolutely useless.

Why output more than
print("url", n + "tags saved")
>>
>>57016541
>just use a bigger word size.
or just use an unsigned int and don't waste memory like a total retard.
>>
>>57016617
>it's syntax is just so incredibly complex that C++ looks easy.
woah, I wouldn't go that far. It's more C++ lite, which makes it worse than 90% of languages but better than its actual competitor
>>
>>57016617
C++14 is a fucking nightmare, Rust is atleast consistnet
>>
>>57016624
Or if you have a lot of comparisons between the iterator and size_t or other unsigned int types.

you either cast or avoid the need to cast.
>>
File: rust.jpg (39KB, 400x300px) Image search: [Google]
rust.jpg
39KB, 400x300px
>>57016643
>>57016617

use std::io;
use std::io::BufRead;

fn parse_entry(l: &str) -> (i32, String) {
let params: Vec<&str> = l.split(' ').collect();

let divisor = params[0].parse::<i32>().unwrap();
let word = params[1].to_string();
(divisor, word)
}

fn main() {
let stdin = io::stdin();
let mut lines = stdin.lock().lines().map(|l| l.unwrap());

let l = lines.next().unwrap();
let high = l.parse::<i32>().unwrap();

let mut entries = Vec::new();
for l in lines {
if &l == "" { break }
let entry = parse_entry(&l);
entries.push(entry);
}

for i in 1..(high + 1) {
let mut line = String::new();
for &(divisor, ref word) in &entries {
if i % divisor == 0 {
line = line + &word;
}
}
if line == "" {
println!("{}", i);
} else {
println!("{}", line);
}
}
}
>>
>>57016609
>You're going to have to check it everywhere
Ya, you will. And it'll a lot easier and faster to check an integer overflowed than an unsigned one. If you reaaaaly need 0..4 million options, use long int. Then you can store even more.
>>
>>57016669
>||
>:::::::
>->
m)))))))))))
>>
>>57016669
Looks better than the equivalent C++
>>
>>57016609
I am trying to learn Haskell but all the tutorials are hipster shit with jokes and memes
in the fucking text; so...

How did you learn enough haskell to get you started writing your own useful projects?
>>
>>57016669
>stdin.lock().lines().map(|l| l.unwrap());
what's going on here?
>>
>>57016700
learn you a haskell

you just have to put up with the shitty jokes
>>
>>57016633
That's verbose mode, it still rarely crashes due to a ~mystery error~ that I'm trying to pin down
A regular scan report for a page looks like this if you're downloading and tagging images
Worker X (side) Scanning [URL].....
Downloaded W images, denied Z tagged with: tag1, tag2, tag3.... (N other tags)

Alternatively
Worker X (side) Scanning [URL]......
Error: HTTP code(error), skipping page


although I don't have an image of that and can't get one because this scan has been running all night long and I'm only 30% confident in my "detect early shutdown code and save visited pages" code, which only works most of the time.


Speak of the devil, after like 10 hours it JUST crashed.
>System.OutOfMemoryException
>it was using like 1gb of memory and nothing more
lmao why
>>
>>57016324
https://google.github.io/styleguide/cppguide.html#Integer_Types
>>
>>57016737
language?

how much ram you have?
>>
>>57016757
C# and 8 gigs
>>
>>57016687
>easier and faster

you could just store a bool if you're going to check everywhere: it's more reliable, fast, 1 byte doesn't matter

My assumption is we're not talking about incredibly constrained environments.

Notably, it's not "bad programming habit" to have a nice data type because it might not be optimal speed and is reliable.

>>57016700
I read LYAH, then was just writing stuff. I took a stab at RWH once or twice. I know the latter is pretty outdated, not sure if former got updated.

Really just learn the basics then go and write stuff, it's the best way to get started. Join a project if you want to learn faster (I'd always recommend this).

I know there are some resources nowadays which collate all the tutorials and stuff into one place but I've been pretty out of touch and can't vouch for that stuff.
>>
>>57016669
>muh linear types
>muh type safety
>proceeds to use unsafe functions
unwrap is fucking cancer , why do people even use it? it's as though hasklelfags were using unsafePerformIO on every other line
>>
>>57016772
build it in Any CPU or 64-bit mode.
>>
>>57016702
>lock()
Acquire a lock on stdin
>lines()
Read from stdin one line at a time
>.map(|l| l.unwrap())
Instead of null, rust has the Option<T> type. If it is unclear whether a function will be able to return the desired result. It is wrapped in the Option type. By using unwrap() the actual result is returned. However, if, for example, reading from stdin failed, then using unwrap like that causes your problem to crash.
>>
>>57016739
You're referring to a line out of a language-specific style guide. C++ style guide is not a reason to not use unsigned integers. Unless you're writing C++ but I didn't think the question was that specific.
>>
>>57016781
I'm Too Stupid to Learn Rust: The Post.
>>
>>57016794
>Read from stdin one line at a time
What does "lines()" return? a string?
>>
>>57016613

Bascially "lower = 0;" would define a variable.

If somewhere in the code someone writes "lower = -1;" all your loops would be fucked and crash.

"#define" is a different beast, but if you try this..

#define LOWER 0
#define LOWER 4



..you will get an compile error (which is a good thing, since you made a mistake somewhere).
>>
>>57016702
>lock()
>> gets a lock to stdin
>lines()
>> get an iterator over the lines
>map(|l|
>> for each line
> unwrap()
>> get the actual string, panicing if there are errors

>>57016781
Sometimes panics are okay
It's better to explicit so you know that it might happen though
it's like assert(ptr != nullptr)
>>
>>57016788
It is currently in any CPU mode
Who knows, maybe something happened where it randomly raced away with downloading a certain thing... Or, seeing as it broke at the line where it gets the bits from an image, maybe there was a 32gb imagefile that it tried to download

If only there were a way to stream the bits from a download instead of caching them and then saving them
>>
>>57016808
I'm Too Stupid to Defend Rust: The Post.
>>
I'm writing tests in Go for some handlers. Nothing too special.

These are also the first lines of code that I have been paid to write, so that's nice.
>>
>>57016814
Not exactly, it returns an iterator over the lines of a String. In this case over stdin.
>>
>>57016823
What are you trying to do?

>If only there were a way to stream the bits from a download instead of caching them and then saving them
I rather expect there is anon. Why not download stuff straight to disk?
>>
>>57016850
this might sound dumb, but why does lines() return a iterator? Will that not just stop the program there, always waiting for more lines entered from the user?
>>
>>57016779
Write an algorithm to test if a value overflows for C's int and unsigned int. In c.
>>
>>57016324
name a valid reason to use usigned
>>
>>57016739
I tend not to use them when I don't have to, but I also have to say, their example is just brilliantly stupid.
>Doesn't behave in the way you'd expect them to do.
It behaves in this case exactly how I'd expect it to behave.
This just states the obvious: if you need negative values, don't take unsigned.
>>
>>57016669

Could somebody explain that, please?
What does this.. thing do?
>>
File: 128326706456.jpg (263KB, 1118x1600px) Image search: [Google]
128326706456.jpg
263KB, 1118x1600px
I'm getting through SIUCP and I don't get lambdas.
What are lambdas really needed for?
>>
>>57016880
saving memory when dealing with positive only integers.
>>
>>57016880
>unsigned char to store 8 byte values for colors in bitmaps
>unsigned short for any counters than need to count up to 65k,
>unsigned int for everything that needs to go up to 4bn
>>
>>57016908
functional programming
basic abstraction
>>
>>57016883
the doc doesn't say that but "Basically, C's type-promotion scheme causes unsigned types to behave differently than one might expect."
>>
new thread when?
>>
>>57016908
what languages have you used before
i can almost guarantee you've seen one
>>
>>57016916
64k actually
>>
>>57016856
It has to do with the way that my downloadmanager works. Since it's not designed to be a booru crawler and most of the data it gets is in the format of text(and I also wanted crawl threads to not wait for downloads to finish), if any two files have the same name it needs to be able to append them (Specifically, in the instance of text digests for later analyzation, I.E. all tumblr posts on a page)- so my downloader works by requesting the bits, caching them, and then sending them to a queue in a separate thread thread where a single (locked) bufferedwriter iterates over the queue.

If you have a suggestion as to how I could pass a stream of data from a URL to a separate thread without caching the data, I'm all ears. I haven't found anything.
>>
>>57016934
C, a bit of C# and Python
>>
>>57016935
>the range of an unsigned int is 0-65,535
>http://programmingshit.info/cdatatypes
>>
>>57016872
ez

int add_without_overflow(int a, int b)
{
int sum = a + b;
assert(a ^ b < 0 || sum ^ a > 0);
return sum;
}

unsigned add_without_overflow(unsigned a, unsigned b)
{
assert((unsigned)-1 - a >= b);
return a + b;
}
>>
>>57016867
The iterator only blocks when you ask it for a value, which the program does at
for l in lines

so the program does the normal ask for value, compute, etc. like you'd expect
>>57016903
it gets an array of (divisor, word) pairs (that's the parse_entry part) from stdin and it prints the words that have an array index that's divisible by their divisor ( i % divisor == 0 )
Not super useful but w/e
>>
>>57016872
Who said anything about C? Only C I do is because integrate with a large C product. If I wanted "nice" data types, C is last language I'd pick to define them.

By the way they use unsigned ints ;)

And just so you know and I already explained is `x < 0` is not a valid test.

I'd just use the same approach I already outlined for overflow, effectively use (uint, bool) pair, language agnostic. Define operations on this to automatically set bool (lol C an nice language features) and you have 0 hassle.
>>
>>57016967
ah shit it should say sum ^ a >= 0;
>>
Color (*cs)[3][3] = &cube->sides[motion.side];

// why can I index cs like
*cs[i][j][0]


shouldn't cs have 2 dimensions???
>>
>>57016867
I think iterators in Rust work with some kind of async-wait magic, but honestly I'm not sure actually.

Interesting question though.
>>
>>57016915
>>57016916
what would require more than 2147483647, but less than 4294967295 ? numbers of digits is more important
>>
>>57016987
It's a pointer
>>
>>57016958
>If you have a suggestion as to how I could pass a stream of data from a URL to a separate thread without caching the data, I'm all ears.
Add it to a concurrent queue in chunks as you download it. Have another thread pop shit off the queue as it writes it to disk.

Maybe there's a better way than that, but it would work.
>>
>>57016997
Libraries that have an artificial limit because they use an unsigned int.
>>
>>57016977
>The iterator only blocks when you ask it for a value
oh, so it's lazy? That seems pretty high level for something like rust. How to you map something in a non-lazy way?
>>
>>57016967
If you care about overflow in actual application, you probably don't want to just assert that it doesn't happen: it happened, what now? Can't recover...
>>
>>57016997
3000000000 for example.
>>
>>57016979
>I'd just use the same approach I already outlined for overflow, effectively use (uint, bool) pair, language agnostic. Define operations on this to automatically set bool (lol C an nice language features) and you have 0 hassle.
monads
>>
>>57016960
I seem to forget to not count in 1024s.
>>
>>57016997
2147483648
>>
var save = {
cookies: cookies,
cursors: cursors,
houses: houses,
lumber: lumber,
}

function save() {
localStorage.setItem("save",JSON.stringify(save));
}

function load() {
var savegame = JSON.parse(localStorage.getItem("save"));
}


Trying to locally save a game I'm making. This doesn't seem to work. Is it more complex?
>>
>>57016908
>Program needs to scan X billion files and move files that match Y
>Moving Y is slow but needs to be done rarely, so you don't want the scanner to wait for it
>your scanner calls a lambda function that moves Y when it finds a file that needs to be moved, whereupon a new thread is created and Y is moved
>the scanner continues, while the other function moves Y. The scanner does not wait for the other function

that's a simple to understand usecase, but there are many other applications for them.
>>
>>57016999
i know it's a pointer dickhead

i have a 3d array and i'm just trying to grab a pointer to a 2d part of the array if that makes sense (which is what that pointer does (i hope))

but then why the fuck can i still index the pointer to a 2d array 3 times?
>>
>>57016916
>not using 128-bit numbers
ISHYGDDT
>>
>>57017022
No, not monads. `Num` instance over `newtype Checked a = Checked a Bool` `instance Num a => Checked a where ...` with obvious implementation

Not monads. At all.

I mean a pair forms a monad but it's kind of irrelevant here
>>
>>57017033
Also I was following this guide
http://dhmstark.co.uk/incrementals-part-2.html
>>
>>57017033
var save = {
cookies: cookies,
cursors: cursors,
houses: houses,
lumber: lumber
}

you have an extra comma for one. Everything else looks good. it should be that simple. Get any errors?
>>
>>57017042
>not using GNU Multiprecision
ISHYGDDT
>>
>>57017069
>The language doesn't allow trailing commas in initialisers
What a shit language.
>>
>>57016967
add_wiithout_overflow(0, 0);

Oops :^)
>>
>>57017052
you fool

Maybe
>>
>>57017081
>not using G64-bit numbers
ISHYGDDT
>>
>>57017035
Wait, I thought lambdas are just anonymous functions.
>>
>>57016977

Thanks!
>>
is this a cancerous use of macros?
#define CS cube->sides[motion.side]
temp = CS[i][j];
CS[i][j] = CS[j][i];
CS[j][i] = temp;
#undef CS
>>
>>57017082
This so much, why do language designers impose such an arbitrary constriction?
>>
>>57017015
I actually don't know that much rust but iirc there's an "into" method that works like clojure's, so it just takes an iterator and give you the collection you actually want
>>
>>57017101
printfn G64.maxValue.toString()
>>
>>57017069
"Unexpected token u in JSON at position 0" in a tab called VM80. What's up with that?
>>
>>57017107
They are, I was speaking specifically about a common use case of them in a modern application. They don't need to run on a thread, but in modern programming they typically do.
>>
>>57017125
do what makes you happy
>>
>>57017135
printfn uintG64.maxValue.toString()

rather
>>
>>57017098
Useless unless you're writing a calculator or something. Depends on usecase and your stack.

"Maybe" doesn't solve anything by itself, you still need to implement stuff.

If you want any monad it is the pair monad: you can signal overflow as well as value before overflow: just do nothing after it overflowed and preserve value. True, you don't know why it overflowed etc. but you can extend.

Anyway depends on application and how fancy you want to get. I just hate hearing "monads" as an answer for stuff. They are very useful and you can implement stuff in terms of them but it doesn't solve anything automagically.
>>
I'm taking a data structures class, and it's shit. Lectures are just the prof rambling about shit and sometimes typing something in CLion, we have no textbook, no real syllabus, and have had 2 lame assignments since August. It feels like a waste of time.

Is there a good free online course for data structures with C++? Barring that, a good recommendation for a textbook I can pick up, or hell, just a site with a good amount of practice problems I can work through?
>>
>>57017149
sounds like the loading is fucked up. Load the json string and print it out and see what it says. Don't parse it.
>>
>>57017036
Address of the zeroth element is the address of the array itself.
>>
What do you guys post code to, made something I can't post to github so looking for a more lenient alternative
>>
>>57017156
idk man, it seems to me like this is a perfect usecase for macros
>>
>>57017135
good luck with that
>>
>>57017033
you use save for both the variable name and the function name smartass
>>
>>57017195
pastebin
>>
>>57017161
pair is wrong
>>
>>57017156
Nothing makes me happy
>>
>>57017150
>>57017107
Other uses include passing functions to other functions or calling functions without declaring them elsewhere
You can't do anything with lambdas that you can't do otherwise (as far as I know) but they sure as hell make it a lot easier.


>select all images of store fronts
>5 stores and a church
>don't select the church
>this was the wrong answer
>>
>>57017195
quick, someone write a chanhub

j/k:
>>57017218
>>
>>57017223
Why? Works for simple "has overflowed" usecase. Either/Maybe work too but you lose more information.

Again depends on usecase.

Getting kind of bored over integer overflows desu...
>>
>>57017230
google knows the commercial nature of religion, harnessing the power of belief to become a commercially successful religion as well.
>>
>>57017164
Shame, data structures are fucking awesome. Anyway, I'm pretty sure MIT has an open course about Algorithms and Data structures. No idea which language they're using.
>>
>>57017178
What do you mean by that?
Sorry, I'm a noob. I'm totally new to all this.
>>
>>57017251
>Either/Maybe work too but you lose more information.
no, the point is you don't have information for an overflow, e.g.

convert :: Word16 -> Maybe Word8
NOT
convert :: Word16 -> (Bool, Word8)

what value for Word8 would you give if it failed? why?
why give true for every successful conversion?

it's just dumb, use the proper Maybe type
>>
>>57017279
write
Console.log(localStorage.getItem("save"));

or something like that
>>
>>57017288
>convert

I meant more of

(+) :: (w8, b) -> (w8, b) -> (w8, b)
(+) x y | overflowed x y = (x, True)
_ | True = (x + y, False)

Dunno, I assumed you might want to keep old value. If not then Maybe works.
>>
>>57015895
It's not it's shit.
>>
>>57013309
Are you passing refs, like &sst_temp to readgranule()? otherwise you are sending copies and and results are lost.
Thread posts: 386
Thread images: 20


[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.