[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 31
File: 1466969439647.png (695 KB, 782x1080) Image search: [Google]
1466969439647.png
695 KB, 782x1080
Previous thread: >>55431084


What are you working on, /g/?
>>
FIRST 4 TRAPS!
>>
File: 7312676db0.png (166 KB, 1629x977) Image search: [Google]
7312676db0.png
166 KB, 1629x977
Creating a model where each input is classified with just one label is easy - stuff all outputs into softmax for probabilities and use cross entropy to compare that with inputted one-hot class vectors for loss function.

What if in my system and input can have any number of labels (among predefined)?

With my 4 labels I created four softmax nodes; final loss function is the sum of losses for my four classifiers - each of them decides whether the label applies to the input or not.

Is this a good idea?
>>
while(1) {
printf("Please don't use an anime image next time!\nThank you!");
}
>>
I'm trying to read some tile map data from a file, but when I loop through a string containing the data, it acts as if every character is a '\n'. I can't see why it would be doing this, I guarantee that data is not a bunch of newlines.

Can somebody see where I went wrong?

int layer_count = 0;
for (tinyxml2::XMLNode* layer_node = level_node->FirstChild(); layer_node; layer_node = layer_node->NextSibling())
{
std::string layer_node_name = layer_node->ToElement()->Name();
if (layer_node_name == "layer")
{
std::string layer_string = layer_node->ToElement()->GetText();
layer_string.erase(std::remove(layer_string.begin(), layer_string.end(), ' '), layer_string.end()); // remove spaces from layer data
std::cout << "Layer " << ++layer_count << ": " << layer_string;

std::vector<std::vector<char>> layer_data;
for (int y = 0; y < height; y++)
{
std::vector<char> map_row;

for (char& c : layer_string)
{
if (c == '\n')
{
break;
}
else
{
map_row.push_back(c);
}
}

layer_data.push_back(map_row);
}
map_data.push_back(layer_data);
}
}


Every single character in the string is apparently a newline. It even prints out correctly before I start the loop. What the fuck is going on?
>>
>>55440479

in the second for loop, shouldn't that be

for (char& c : layer_data)

//rather than

for (char& c : layer_string)
>>
>>55440526
Wouldn't compile.
>>
>>55440479
I don't see an issue here
the error is probably at the location where you use the characters
>>
File: 1466564056907.gif (182 KB, 250x273) Image search: [Google]
1466564056907.gif
182 KB, 250x273
>Accidently write
for segments in segments:
in Python
>No error
>Use another function from the standard library that should only accept a single string
>Give it "segment.text" instead, which doesn't even fucking exist as a variable anywhere
>No error
>Just hangs
What the fuck
>>
>>55440684
>using Python
No sympathy for you, faggot
>>
LLVM Question: Is it possible to store llvm::GlobalVariable (s) in one Module and load them in another Module and how to ? Modules are created under the same llvm::Context.
>>
>>55440547
The error only occurs when I try to access layer_data[y][anything above 0]. It would be out of range because the vector is supposed to stop at a newline character. And it just so happens that there is a newline character at the beginning of each vector, which is dumb.
>>
Reverse traps only, please

Unsafe languages such as Python and Ruby should be banned in industry
>>
>>55440852

So everything but Rust and purely functional languages are out?
>>
>>55440684
>No error

Why would it error?

segments = ['1', '2', '3']

for segments in segments:
print (segments)


it'll just cancel out and print segments.
>>
File: 124125.jpg (59 KB, 1280x720) Image search: [Google]
124125.jpg
59 KB, 1280x720
>>55440938
>Rust
>Safe
>>
>>55440938
Yes, unsafe languages have held us back for too long and have cost trillions of yen
>>
I'm working on an IRC like protocol for VOIP, and a server for that protocol.
>>
>>55440975
so like 2 bucks?
>>
>>55441331
More like hundreds of dollars, don't be so racist bro
>>
>Working on an implementation of Hangman.
I'm trying to learn how to work with APIs hosted on a server (given a word, I want its definition).
>The dictionary is a text-file which contains about 350K+ words, one word each line.
>Using OO - load the dictionary once when an instance of the game logic is created - ctor spawns a dictionaryLoader thread which works in the background.
>>
>>55441891
you simply need to read the documentation for that api
there's no other way unless there's a public swagger interface or wsdl or something to that effect
>>
>>55440938
Purely functional languages aren't safe. They appear to be safe just enough to get grants (the spherical cow meme). GHC still crashes on some programs. Coq programs still run out of memory. They pretend these aren't problems.

Rust isn't safe either.

Coq and Rust are both less safe than Java.
>>
Go > *
>>
>>55440852
What's wrong with Ruby?
>>
>>55441967
Never heard of Asterisk desu
>>
>>55442018
>there is literally only one language Go is better than
>nobody has ever heard of said language
>>
>>55442065
>tfw Go barely beats out a framework
http://www.asterisk.org/get-started
>>
>>55442115
>asterisk is GPL
>Go is BSD

Is that the only reason why it's better? kek
>>
>>55441967
Nice generics

Go is a retarded language, designed for use by retards
>>
File: water best melon.jpg (474 KB, 1619x1725) Image search: [Google]
water best melon.jpg
474 KB, 1619x1725
>>55442308
>Go
>designed
>>
>>55442308
>look at me I'm a elite programmer, I masturbate to my functional language!
>>
>>55442462
>hating go makes you functional
>functional programmers using the term 'generics'
>>
>>55442508
Wait, I take that back

Hating Go might not make you functional, but liking it certainly makes you dysfunctional
>>
>>55440684
>what are types
>type b don't hurt me
>type b don't hurt me
> no more

optional typing is the single most important feature of a programming language nowadays

c#, scala, typescript, haskell

languages that hurt
c, java, javascript, python, perl ...

most advanced typesystem that actually is used -> Haskell
>>
>>55442569
>optional typing
The fuck is this bullshit. Typing should be mandatory.
>>
>>55442578
^
>>
>>55442578
But what would happen to the code bootcamps for autistic children.
>>
File: 1445978999691.jpg (36 KB, 398x545) Image search: [Google]
1445978999691.jpg
36 KB, 398x545
>>55442569
>most advanced typesystem
>Haskell
Spoken like a true "pretend to know everything while I know nothing" faggot.

>perl
Have you even bothered to check out Perl 6? I doubt it.
>>
>>55442611
Hopefully, they will end. They create American pajeets.
>>
>>55441993

Nothing is wrong with it.

Back in the past Twitter abandoned Ruby, because they didn't get what Ruby was designed for and what it was NOT designed for.

If you want Message Queues in an insane amount, you should rather use something like Erlang, which was especially designed for such purposes..

Now how cool is that today we have Elixir, wich is pretty close to Ruby but runs on the Erlang Virtual Machine - which leverages stuff like WhatsApp (you might have heard of it) and had 99,9999999 % server uptime at Ericson. It's a beast and THE mother of all languages when it comes to cuncurrency.


Elixir is so sexy (and of course it's functional).
>>
>>55440142
I was looking at some code the other day to convert a comma-delimited string like "1,2,3,4" into a list of integers.

The code was on Java 7, so it’s still written like it’s 1999: with a loop, parsing ints and appending to the result inside the loop.


why modern ((((((programmers)))))) are such whiny bitches

>bwaaah i'm a programmer and they expect me to know things
>>
>>55442629
>muh maps and filters make a language functional
>>
File: DroppingInAndOut.png (13 KB, 428x412) Image search: [Google]
DroppingInAndOut.png
13 KB, 428x412
Is there any FUNCTIONAL reason to echo my HTML in between PHP statements rather than dropping in and out?

Because the formatting it disgusting when it's echoed. It still WORKS when I drop in and out between modules, but will there be any significant performance hit?

I'd like to retain color-coded formatting so other devs can eventually manage it more nicely.

Like, I WILL echo it if there's a significant performance hit to doing this, but I'd really prefer not to. Editing echoed content is a fucking pain in the ass, because EVERYTHING is grey
>>
>>55442617
He meant usable languages with libraries and a big community, not little languages such as Idris and Agda.
Hindley-Milner's about as good as you can get right now in popular languages.
>>
>>55442663
ehm, this is the best practice, I do not see the problem.

>like it’s 1999
Did the programming standards suddenly change or something? kek
>>
>>55442689
>libraries
You can use libraries from Haskell and C easily in both of these.

>and a big community
So, not haskell.
>>
>>55442569
Haskell's type system is less advanced than C++'s.
>>
>>55442689
Haskell is unusable.

>undefined
>Monad contains fail
>typeclass hierarchy is disjointed and doesn't do inheritance in most places where it should
>MonadPlus is two classes merged into one
>no way to enforce that functions are total
>>
I'm starting to look at a huge program on github. I have some experience in Java, but this (https://github.com/yasp-dota/yasp) is so big I hardly know where to start. I want to look at the parser mainly, should I just click on random files? How do I wrap my head around whats happening in the big ass program, both in the individual files and in the whole thing?
>>
111111111111
111111511111
111111111111


If this data was in a string without newlines or spaces, how could I work out the number needed to access 5?
>>
>>55442736

>no way of representing multiple uses of the same typeclass
>language extensions effectively necessary but not "standard"
>language extensions often incompatible

etc etc
>>
>>55440142
>tfw some people on /g/ call themselves programmers despite never coding anything in Haskell
>>
>>55442796
size_t i;
for (;str[i]!='5';++i);
>>
>>55442796
I also know the width and height of the data, forgot to mention.
>>
>tried to make an Android app for fun
>doesn't support Java 8
for what purpose?
>>
>>55442818
*size_t i = 0;
>>
>>55442802
Most Haskell implementations other than GHC feel so crippled after using GHC with even just one or two language extensions.

I'm not sure what the best solution to wanting multiple instances for some typeclasses some of the time is. Coherency is a really nice property the rest of the time (of course, GHC doesn't actually enforce it, IIRC)

Then there's all the people whinging about monad transformers
>>
>>55442774
Clone or download it so you can navigate the files in your favorite editor. Or since it's in Java, maybe an IDE. Either way it will be better than opening a bunch of browser tabs so you can cross-reference different modules.
>>
>>55442688
Just don't use PHP, it became obsolete years ago, and it has a shitty design. Just use node.

>>55442736
Just use another Prelude that's better for you?
I agree that the inclusion of fail is stupid af, but at least you can change your prelude.
Concerning the problem with total functions, you just need to read the docs I guess? And type gives a lot of info about it, even though there's no theoritical way to know about it.

>>55442718
Yeah sure but it's still a pain in the ass for a small gain. The change we need in today's software is to a Hindley-Milner type system, which would be so beneficial, and this change would be critical. I don't believe that a change to a typesystem such as Agda's would be that beneficial.
As for the the multiple use typeclass, are you referring to the List/ZipList Monad implementation for example?
>>
>>55442872
Coherency is guaranteed by the usual restrictions on typeclasses (I think?), but the IncoherentInstances extension allows you to make typeclass instances that might result in incoherency
>>
>>55442872
>>55442898

Named instances
>>
>>55442796
pseudo-code:
while(read line){
idx_5 = line.indexOf('5')
if (idx_5 != -1){
// ...
}
}
>>
>>55442898
I might have been thinking of uniqueness. Either way, I find that typeclasses are really convenient and work the way I want 90% of the time, and I'd be loath to give that up.
>>
>>55442886
>Just use node.
Why node over something like rails or django?
>>
>>55442886
>>55442957
>use node, rails, or django
Why node, rails, or django over something like scotty, servant, or yesod?
>>
>>55442957
node is more popular
you can use those if you want. I like django alot, personally
>>
Playing around with memory management in C, since I don't have much experience
#ifndef SAFESTR
#define SAFESTR
#include <string.h>
#include <stdlib.h>

/**
* char *safecat(char *dest, char *src)
* Concatenates src to dest, but almost guarantees that dest will be large
* enough, assuming enough memory
* Return Values:
* On success: returns pointer to resulting string
* On error: returns NULL
*/
char *safecat(char **dest, char *src)
{
int sized = strlen(*dest);
int sizes = strlen(src);
char *newstring;
if ((newstring = calloc(sized + sizes + 1, 1)) == NULL)
return NULL;
strcpy(newstring, *dest);
strcat(newstring, src);
free(*dest);
*dest = newstring;
return *dest;
}

#endif

Is there anything wrong with this in terms of functionality (leaks in the function, etc.)?
>>
>>55442957
Well you could use them both but I don't like ruby or python.
>>
>>55442978
Do you have any experience with Yesod? I haven't been able to try it myself, is it really comfy writing code with it or is it really tedious?
>>
>>55440168
How is this better than just looking at the individual probabilities in the final output of a more standard model? They're telling you what the probability of your sample belonging to a class is, so presumably if there are two classes it could belong to both of those entries will be higher.

Also this doesn't scale well. If you wanted to use it on something with 1000 classes you'd need 1000 weight matrices. Might be better to use an image-to-sequence model with LSTMs.
>>
>>55442978
>>55442985
Rails/Django have been around for a long time, meaning there are a lot of gems/packages available.

In addition, to be honest, node has always scared me off because I've never managed to have an enjoyable experience with npm. Pip is alright, but bundle blows both out of the water.
>>55442992
It can't be helped
>>
>>55442886
I don't really know node yet, DO have to finish this entire site within a month, and am using MySQL, which is integrated into PHP.

Also, what about clients who are NOT using JavaScript?
Plus I have no idea if my host will be offering Node support.

C'mon, /g/uys, I'm just asking if there's gonna be a performance hit.. Not a suggestion on an alternative language/library I don't know/am not prepared to use/which may not suit all my needs
>>
Learning c++ and Vim. I just finished vimtutor and configuring vimrc.

I'm new to programming and c++ in general but I hope to get better practicing every day.
>>
>>55443013
I was just memeing, I've only heard that it's good. I can only say to try their tutorial.

The biggest complaints I've seen are that it has a lot of dependencies (so is likely to cause conflicts in an environment with already-installed packages), but that can be managed with cabal sandboxes or stack.

Yesod is on the heavier end of haskell web libraries though, so if it's a smaller project a smaller library might work better. Yesod is modular and many of its things exist as their own library that you could use outside yesod.
>>
>>55443121
Yeah I've heard about smaller frameworks for haskell. How's stack by the way? I've never used stack or cabal because I'm on Gentoo and there's a dev-haskell category on portage.

Also I've been writing my own typesystem in Haskell, I've already got a simply typed lambda calculus down with a typechecker, now I need to work out the type inference algorithm.
>>
>>55442989
27 year and some fags STILL use int for sizes.
Literally when will they learn?


>http://en.cppreference.com/w/c/string/byte/strlen
>
size_t strlen( const char *str );

>size_t

Nigger
>>
>>55443080
Good luck, Anon. c:
>>
>>55443260
This
int genocide when?
>>
hey guys I'm shopping for a new editor on winblows

I use notepad++ which I think is great because
1. easily definable hotkeys
2. You can supply command line arguments when you press the hotkeys (i.e, you can feed an external batch program your file's location and therefore run any language from the command line from within notepad++ in a fashion that isn't defined for each file)

but it doesn't alert you when you misspell variables which is bad
so any other text editors that can do 1 and 2 already would be nice, if they can also track variable use (which creates annoying bugs which takes a lot of time to iron out if uncaught)
>>
>>55443298
Sublime Text
Atom
>>
>>55443311
Can't argue with those quad dubs
>>
>>55443298
>winblows
kek

>notepad++
gay

>>55443311
doublegay

Just go for emacs
>>
>>55443260
What's the point of size_t if you can use
unsigned int
?
>>
>>55443360
>emacs
It's like you want RSI
>>
>>55443379
I actually have two hands, so no.
>>
File: ProcesingIsDumb.png (78 KB, 500x500) Image search: [Google]
ProcesingIsDumb.png
78 KB, 500x500
Dumb processing question... Even though the API says size(int, int) must be the first piece of code in the setup() method, when I put size() in setup(), I get an error.

However, when I put size() in settings, it works fine.
>>
>>55443368
size_t holds any address difference
>>
>>55443368
One will work on all systems, the other will fail in spectacular ways and generate countless security flaws.
>>
How do I learn C++?

Should I buy Programming: Principles and Practice Using C++? It seems pretty expensive but if it's the best resource then I'll get it.
>>
>>55443401
What the fuck? No

>>55443368
Because it cna be a different size.
>>
>>55443401
That's ptrdiff_t.

The largest size of allocated memory doesn't have to be the same size as the largest difference between pointers.
>>
>>55443598
Oops, meant this
>>
>>55443080
install YouCompleteMe
>>
>>55443234
stack makes it easy to have multiple versions of GHC (including GHCJS). Also nicer than cabal sandboxes because you don't have to recompile everything for each package as long as the dependencies are resolved to use the same versions. I use stack for new projects.
>>
>>55442701
yes, nowadays you do
Arrays.asList(string.split(",")).stream().map(Integer::parseInt).collect(Collectors.toList())
>>
>>55443828
>tokens meme
no
>>
I bought C++ primer but I can't keep the pages open.

Guess that's it then.
>>
>>55443828
>.asList
>.stream
>.toList
Disgusting
>>
>>55443828
Wow friendo time to switch to Haskell, this is purely functional code right here.
>>
>>55442701
In 1999, Java wasn't associated with "CS grads" or designated shitting streets.

I would imagine the quality of code was higher back then.
>>
>>55443879
>CS grads
What is wrong with that?
>>
I have this formula for generating a saw wave:

unsigned short wav = phase * 65535/44100 * freq % 65536

Is it possible to modify this formula so it doesn't contain any division operations?
>>
>>55443918
I mean when working with integers only
>>
>>55443918
Make
65535/44100
a constant
>>
I'm learning C and I want to make sure I understand this. A statement is everything enclosed in brackets for a function like main() and functions can be a statement. Am I correct?
>>
>don't like Go at all
>seems like the only viable choice for one of components for my upcoming project

uh
>>
>>55444171
What's wrong with Go, aside from not being OO?
>>
>>55443918
static constexpr something = 65535 / 44100;
unsigned short wav = phase * something * freq % 65535;

??
>>
>>55444179
It's made by google making go inherently malicious.
>>
>>55444179
Not being OO is a positive
>>
>>55444179
according to every elite programmer out there, muh generics and my error management

>>55444206
are you retarded?
oh, no need to ask. yes you are.
>>
>>55444214
> Not being OO is a positive

why do you feel that way anon?
>>
>>55444220
The error management is admittedly fucking obnoxious to deal with.
Aside from that it's pretty easy to work in.
>>
>>55444220
I will never trust anything made by jewggle
>>
>>55444205
That should work, it'll get it at compile time. You forgot to specify the type, tho.

>unsigned short
Why not just uint16_t?
>>
>>55444179
Lack of generics and operator overloading, I don't need those for this project in particular but these are general cons that I wouldn't mind having in the language. Verbose error checking is also a bit annoying. My biggest gripe with it is the asswards syntax just for the fuck of being different but I guess that's subjective. Other than that, not really much else, I guess I'll have to suck it up and just go with Go. My only other alternative at the moment is Python which would be a breeze for this component but I also need something that is both compiled and portable.

>>55444251
>Why not just uint16_t?
No particular reason, it was ushort in the original snippet he posted so I just kept it that way.
>>
File: 1455583175374.jpg (43 KB, 319x310) Image search: [Google]
1455583175374.jpg
43 KB, 319x310
Every time I come here, I wonder why.
I'm most certainly not a competent programmer. I don't even understand most of whats being said
>>
>>55444236
OO takes away job security. If code is hard to write, it should be hard to read.
>>
>>55444236
OO is disgusting
>>
>>55444245
it's completely open source, you fucking retard

>>55444171
>>55444288
what component is this?
>>
>>55444302
job security is bad for software quality. it just means shit illegible garbage that nobody knows how to fix exept its autor
>>
>>55443971
Brackets encapsulate a scope.
typically you would see something like:
int function(int param) {
int res = param + 1;
return res;
}

Here the res value is inside the scope, and thus the res value would be instantiated and removed with the scope.
You can do it on everything though.
{
int res = 0;
}

This also creates and removes the res variable.
This is very useful when you want to call the destructor as soon as possible.

This is also why stuff like if, for, while etc, works with and without the scope.
>>
>>55444330
>it's completely open source, you fucking retard
>implying the jews didn't secretly implement a botnet or spyware into it.
>>
>>55444337
>This is very useful when you want to call the destructor as soon as possible.

He's asking about C, though.
>>
>>55444357
structs can have a destructor too, I don't know what funky library he might use.
>>
>>55444357
Yeah, I'm reading the C programming language 2nd edition book and just double checking if I understand the difference between a function, an argument, and a statement.
>>
>>55444337
It's about blocks, not scope though.
Scope is mostly bound to blocks, but it's not the same.
>>
>>55444330
>what component is this?

Basically a web JSON API to manage a physics calculation cluster so I need something that comes with a HTTP server, preferably ORM and some JSON manipulation libraries. The catch here is that it needs to be easily distributable and I cannot force the people that will use it to install Python that's why the only other viable alternative I can see is Go unless I can use one of those "py2exe" tools and other crap but those aren't perfect.
>>
>>55444382
what par of "writing C and not C++" is too hard to grasp? structs in C don't have methods/constructors/destructors
>>
Hi guys. I'm creating SpringBoot (Java) app, and building this project is simple and easy as 1 2 3.
But. I don't know how should I create war-exploded right way. Everytime I try this to deploy app to Tomcat, I got errors #404, so I assume that there's a problem with my artifact configuration.
Could be great if somebody would waste 5 minutes of his life to save hours of mine.
I tried to search for tutorials in Google and YouTube, but everyone there uses artifacts that are actually made. Eh... Anyone? Please...
>>
>>55443642
Its being a bitch to install.

something about an unknown public key with the ncurses5-compat-lib doing makepkg -sri with the snapshot.
>>
>X.org
Horrors.
How awful is my code?

http://pastebin.com/82vnwmJj
>>
>>55444251
>uint16_t
Unportable, end yourself.
>>
>>55444330
>it's completely open source, you fucking retard
A language can't be open source you fucking retard.
>>
i'm starting my first medium-big project and i have no idea what i'm doing

it's an API to manage Localized Strings in different languages, so it should be able to add or modify strings with a defined structure, which are kept in text files

the problem is i have no idea what the structure of the program should be, should it have an internal database (if so, would it be a list? a list of what?) to keep track of the strings that exist in the different files in different directories, should i define an interface to access the files, and everything else
>>
>>55440142
When is Subaru going to get strong :(
>>
>>55442617
I'm a perl5 programmer is it worth it to look at perl6?
>>
>>55444500
Aren't uint16_t and the like supposed to be more portable?
>>
>>55444500
>Unportable
Nigger please, unless you are on a 128bit+ system, or somewhere where CHAR_BIT != 8, uin16_t will exist. And you almost certainly have bigger problems then anyway.
>>
>>55444533
In a sense. It's 16bits everywhere it exists, but could be horribly slow or just a compile time failure in other places.
>>
>>55444535
>And you almost certainly have bigger problems then anyway.
Nah

>>55444533
No, the standard considers them optional.
uint_least16_t and the like are supposed to be more portable.
>>
>>55444500
what are you talking about?
just because the people who designed C was incompetent morons doesn't mean you have to be as well.
uint16_t can only mean one thing: unsigned 16 bit integer.
unsigned short should always mean that as well but this is why you use libraries that define uint16_t, so it will work regardless of what compiler, you use.
>>
File: 1463112040414.jpg (6 KB, 190x159) Image search: [Google]
1463112040414.jpg
6 KB, 190x159
>>55444555
It's the "Anon lets autism get the better of him" episode.
>>
>>55444575
>just because the people who designed C was incompetent morons doesn't mean you have to be as well.
Incompetent morons are the people who use uint16_t

>uint16_t can only mean one thing: unsigned 16 bit integer.
Which is not possible in some systems. Instead it should mean "the smallest integer possible that is at least 16 bit"

>unsigned short should always mean that as well
Only if you suffer from retardness.

>this is why you use libraries that define uint16_t
Only some rare shitty libraries do that.

>so it will work regardless of what compiler
No, it is illegal to define uint16_t.
>>
>>55444469
Just like use wayland/mir/anything but X.
Hell, even Win32/WinRT are better than X and they are abominations.

Still, at least you aren't using XLib.
>>
>>55444575
>unsigned short should always mean that as well
unsigned short should always mean uint_least16_t (and even then, it might not).
>>
>>55444449
it is, yeah. I guess there is some doc where they list the dependencies

>>55444505
practically everything you need to compile and use Go and its packages is open source, you fucking retard
>>
>>55444640
This
>>
>>55444444
>>
>>55444645
>practically everything you need to compile and use Go and its packages is open source
Yes and?

>you fucking retard
Do you have problems with reading? This is absolutely unrelated with the topic.
>>
>>55444640
>uint_least16_t
C is terrible

>>55444667
Thanks for contributing to the fucking thread you slimy fucking piece of shit
>>
>>55444704
>C is terrible
get out
>>
>>55444704
Consider killing yourself, we have enough shitty languages already.
>>
>>55444704
>C is terrible
lel
this fucking sudo language users thought they are programmers, scripter shit
>>
>>55442666

I just LOVE it when people talk about stuff before even looking at it..


As I explained, Elixir is basically Erlang - with additional features and a much smoother syntax above.

So in Elixir you have:
no "normal" loop, immutable values, guard clauses, pattern matching (similar to prolog), list comprehensions, lazy evaluation, even monad libraries (if you want to).

Functions can be passed passed along as arguments to other functions or return other functions as values.

square = fn x -> x * x end
Enum.map(1..10, square)


def reverse([], reversed), do: reversed
def reverse([head | tail], reversed), do: reverse(tail, [head | reversed])


String.capitalize("elixir")
|> String.reverse
|> String.split("l")



Is that functional enough for you?

Elixir is not just "the next big hype", it is a real innovative langauge which brings you the best of Ruby and Erlang which are both pretty decent on their respective area and have a lot of amazing concepts.

I really think Haskell and Lisp are the most gracefull langauges, but for internet stuff Elixir is amazing and a very underrated language.
>>
>>55444720
>>55444734

>defending uint_least16_t
even in a trashman's language like C++ you could have something like

uint_t<16>
uint_t<16, least>
uint_t<16, fast>

>>55444761
Well done jumping on the bandwagon, want a gold star?
>>
>>55444767
>Enum.map
Sounds like it doesn't have type classes or ad hoc overloading

>List comprehensions
What about monad comprehensions?
>>
>>55444779
How is this relevant to anything?
Also, this is shit.
>>
>>55444767
Typeclasses?
Higher kinded types?

I hope you'll forgive my skepticism, I've seen way too many "our language is functional too, we bolted on lambdas!"
>>
>>55444779
>Well done jumping on the bandwagon, want a gold star?
i repeat
>scripters thought they are programmer
this is cute
>>
>>55440142
>no more traps as op image
i cant identify with this thread anymore
bye
>>
>>55444610
>at least <size>
is not as bad, but I can see why you would want this if the platform does not support this.
It should be defined in a library though.
>it is illegal to define uint16_t
this is why everyone who uses C writes their own library for standard types.
It is a fucking mess, but the people who made C didn't fucking think this far and they are too much cowards to backpedal now.
>>
>>55444822
Reverse traps > traps

I should know, I've been both
>>
>>55444842
>Reverse traps
>I've been both
What did he mean by this
>>
>>55444839
>It should be defined in a library though.
What? It is defined in the standard library.

>this is why everyone who uses C writes their own library for standard types.
Nobody does, again it is illegal to define uint16_t in your own library. Writing your own library to define types which are illegal to define because they are illegal to define makes no sense.

>but the people who made C didn't fucking think this far and they are too much cowards to backpedal now
They didn't think that some retards would redefine standard types in their own shitty libraries?
>>
>>55444681
>Do you have problems with reading? This is absolutely unrelated with the topic.
>>55444206
>It's made by google making go inherently malicious.
>>55444505
>A language can't be open source you fucking retard.
do YOU have problems reading?
everything needed to use the language is open-source. and what is a programming language, if not the whole framework needed to use it?
>>
>>55444903
>do YOU have problems reading?
Nice NO U maymay xd

>everything needed to use the language is open-source
And? This is not what the topic is about. You claimed that the language is open source, which is not because no language is open source and this is because no language is software.

>and what is a programming language, if not the whole framework needed to use it?
Do you seriously need to ask this question?

Anyhow, what does the post made by >>55444206 has to do with anything?
>>
>>55444858
I meant I tried being one, then the other.
>>
File: 43794360_p30_master1200.jpg (74 KB, 300x300) Image search: [Google]
43794360_p30_master1200.jpg
74 KB, 300x300
Hello /dpt/ , I'm trying to teach myself python

Let me know If I have the basic understanding of this.

I'm trying to copy the text of one file to another.

from sys import argv
from os.path import exists

script, from_file, to_file = argv

print "Copying from %s to %s" % (from_file, to_file)

in_file = open(from_file)

indata = in_file.read()

out_file = open(to_file, 'w')

out_file.write(indata)

print "Allright, all done."

out_file.close()
in_file.close()


So

>in_file opens from_file ( the original txt file.)

indata reads whats inside of in_file ( the original txt file. )

out_file opens to_file for writing. (if the file isn't present, it is created by default.)

out_file then writes the data read from indata.

Is that correct?
>>
>>55444880
I know uint16_t is defined in the standard library.
But I have worked on a lot of projects who use something else because the standard library is shit and unreliable.

Those projects used something else, like UI16T or whatever (I have seen 6 different conventions so far, it makes me hate humanity).
In that library, they define the types, so it works for that platform, and in case some weird platform is not defined, they can define it then.
>>
>>55444792
>>55444806

Well, I might add that I'm still a beginner in Elixir and have limited knowledge, so I might not be competent to answer every of your questions perfectly right now..

Of course no language is as "functionally pure" as Haskell, and Elixir doen't try to be a Haskell clone.
Unlike Haskell, Elixir is a homoiconic langauge (mmeaning all code in the language to be accessed and transformed as data, using the same representation), just like Lisp or Prolog..

The specifics wether a langauge is "functional or not" is a very difficult topic. But ever since I accidentally found out about Elixir I'm very interested about it.

Especially since I don't know Erlang yet, that's a lot of stuff to learn at the moment. Erlang is a much "smaller" language than Haskell (like C is to C++, if you will excuse the comparison).
But still the concepts of error handling are pretty deep and I'm not yet finished with Erlang to really start learning Elixir.

Of course you CAN learn Elixir without Erlang, but personally I feel like I want some deeper knowledge about what's going on under the hood..

But you can do comprehensions like that:

for n <- [1, 2, 3, 4], do: n * n
>>
>>55445201
>even the list comprehensions are hideous
Absolutely dreadful
>>
>>55445277

Why do you think so?

Here is another way to write a lazy list comprehension:

Stream.flat_map 1..1000000, fn i ->
Stream.flat_map 1..1000000, fn j ->
[{i, j}]
end
end



Please remeber that Elixir comes from Ruby and Erlang. That means if you hate Ruby syntay, Elixir probably isnt' for you..

But having a Ruby background (and loving it) I think the Elixir syntax is much more versatile than the original (pure) Erlang syntax.

In Erlang it would look something like that:
[{X, Y} || X <- [1,2,3], Y <- [a,b]]
>>
>>55445473
haskell
cartesianProduct A B = [ (a,b) | a <- A, b <- B ]
>>
>>55445606
alternatively
liftM2 (,)
>>
>>55445101

can someone look at this real quick and let me know if I understand it properly.

I mean, the code works fine and does what I want it to do but I'm having a hard time just looking at something and figuring out what it does.

its like i need to know every last itty bitty detail or i get confused.
>>
>>55445606
capitalized names are reserved for data constructors and type names, so no. In the argument of a function they will pattern match on that constructor.
>>
>>55445649
forgot, always disliked that

cartesianProduct ma mb = [ (a,b) | a <- ma, b <- mb ]
>>
File: 436.png (130 KB, 640x400) Image search: [Google]
436.png
130 KB, 640x400
>using Django
>>
>>55445201
I'm just concerned that Elixir is going to be yet another wasted opportunity. So many programming languages are fumbling around in the dark when we know there's better ways to do things, and they've been proven in Haskell or similar 'extremist' languages.

Let's take higher-kinded types as an example. The only mainstream language I'm aware of that supports these is Scala. C#, Java, F#, OCaml, etc. don't have them, so you can't so much as define Haskell-style functors in them. If you want the various functor methods, you have to reimplement them every single time on each container type you want to support them, whereas in Haskell you need to implement one method and you get the rest for free.

You know how lots of people look down on golang because it doesn't have generics, so you can't simply write a reversal function that works on lists of all element types, but you have to write a function for every element type? The lack of higher-kinded types in a language feels exactly like that, just one level up. If you wanted to implement something like traverse or foldMap or foldLeftM without them, you end up rewriting the same code over and over again, but in Scala and Haskell it's a breeze. A good type system lets you get so much functionality for free, it's ridiculous.

When I see people cautiously adding very tiny functional features to their languages, it makes me sad, because if I ever have to work with those languages I know I'm going to have to do a lot of code duplication by hand, which could have been avoided if the language designers didn't have their heads up their asses. Look at Rust, for example. They've said they plan to add higher-kinded types at some point, but I doubt it will ever happen. They'd rather quibble about SJW shit. Elm looks to be disappointing in this regard too.

As for people who say these sorts of features are academic ivory tower useless nonsense? These features are what I use to GET SHIT DONE.
>>
>>55445706
C++ has HKTs
>>
>>55445706
just use python you melt
>>
>>55445706
and you can use function overloading as a much simpler method and more flexible version of type classes
>>
>>55445722
Sad that C++ is more adventurous than most modern languages.
>>
>>55445733
>Python
4chan is 18+, you're looking for Reddit
>>
>>55445741
How does function overloading fulfill the purpose of typeclasses? Unless you have implicits or something.
>>
>>55445756
C++ also has variadic functions

In many ways C++ has a much more flexible type system

Inheritance is very similar to existential types too
>>
>>55445761
nice meme
>>
>>55445776

template <typename T>
auto foldL(std::vector<T>);

template <typename T>
auto foldL(std::list<T>);

template <typename T>
auto foldL(IO<T>);
>>
>>55445741
Also function overloading does not cover the case where the output of the function is an arbitrary type with a typeclass instance.
>>
>>55445808
You can use CRTP for that
>>
>>55445791
Ok, I see how that could work
>>
>>55445825
>CRTP
Is the world ready for such greatness?
>>
>>55445808
function overloading lets you return whatever you like provided the call is different
>>
>>55445844
or rather different overloads don't have to have the same return type
>>
>>55445786
The second while is infinite when c is x or X
>>
>>55445786
>
        ;

Why?

>
while(c == 'x' || c == 'X') 

consider using tolower/toupper, also, it will get stuck there since c does not update.

Anyhow, what did you expect and what did you get?

>
exit(0);

>in main
cancer
>>
How do I learn hacking?
>>
>>55445866
>>55445871
I am fucking idiot. Thank you.
>>
>>55445871
>Anyhow, what did you expect and what did you get?
Ignore this
>>
>>55445706
Use a language with good meta programming such as Lisp or Forth and all such complaints about 'missing language features' become moot because you can create anything you want yourself.
>>
File: 1461850718176.gif (4 MB, 356x200) Image search: [Google]
1461850718176.gif
4 MB, 356x200
>>55445877
What's the password?
>>
>>55445877
Install Emacs.

>>55445786
Is that for uni or something?
>>
>>55445894
Without any help from the compiler if you fuck up.
>>
>>55445844
>>55445861
I mean, that the function is defined for any return type that is an instance of the typeclass. Meaning you don't need to write a new definition to support a new typeclass instance.

But the templates with auto above seem to do that
>>
>>55445913
You can add however much help you want, you have direct access to the compiler in Forth (i.e you can repgrogram rhe Forth compiler on the fly) and in Lisp you have reader macros which effectievly accomplishes the same thing.
>>
>>55445894
Good idea, just write a whole interpreter for your new language and then assign it to a macro, so glad I didn't have to write an interpreter or compiler
>>
>>55445866
>>55445871
I fixed it with a break statement. Should I just give up on programming? I was stuck on that for ~5 minutes (before I asked).
>>
>>55445936
ugly but generic
template <template <typename> typename Temp>
struct MyTypeClass {
template <typename T, typename L>
auto fmap(Temp<T>&, L&) -> Temp<decltype(std::declval<L>()(std::declval<T>()))>;
}


less ugly, less generic
template <template <typename> typename Temp>
struct MyTypeClass {
template <typename T, typename L>
Temp<L> fmap(Temp<T>&, L(*)(T&));
}

still godawful syntax
>>
>>55445975
Relax senpai
>>
>>55445983
I am being serious. Don't sugar coat it. If I am making such simple mistakes already I'll be fucked in the future.
>>
>>55446011
You'll get better with time.
>>
>>55445911
>Is that for uni or something?
No a book "I picked up". Although I will be starting Uni soon.
>>
>>55445706

> Elixir is going to be yet another wasted opportunity.

I think Elixir is pretty thought-out. Which doesn't have to mean that every haskell guy would agree with every design decision in Elixir.. :)
But the creator of Erlang has written a pretty nice Review of Elixir, worth reading:
>http://joearms.github.io/2013/05/31/a-week-with-elixir.html

>The only mainstream language I'm aware of that supports these is Scala.

I think Scala will hopefully work as gateway language to functional programming in the future. We would all benefit from that. If only 20% of all Java projects would become Scala projects, that would already be great..

>As for people who say these sorts of features are academic ivory tower useless nonsense? These features are what I use to GET SHIT DONE.

That's why I think it's a good thing that "functional concepts" are everywhere to be found nowadays. Even Java (!) has "streams" nowadays.


>>55445722
>>55445777

You can do pretty cool stuff with C++ and I admire real C++ devellopers, but the langauge is old, way too bloated and you can also programm terrible shit with it. IMHO a language should not give you the tools to write too shitty code..
>>
>>55446045
C++ is a horribly bloated, ugly verbose language that is significantly better than elixir ever will be
>>
>>55446011
>If I am making such simple mistakes already
You are supposed to make such mistakes when you start, not after that.
>>
>>55446085
C++ had to be dragged kicking and screaming into the 21st century. It is a jack of all paradigms and master of none.
>>
>>55445980
>template <template <typename> typename Temp>
Care to explain how the nested template <typename> works, and when it may be useful?
>>
>>55446178
template template parameter

it's like a rank 2 type or a * -> *
it takes a template type as a parameter
>>
>>55446211
Oh, now that I looked it up, it actually seems pretty simple.
>>
>>55440142
So I've made scripts in bash and small programs in VB looking to actually learn a language, want one that's cross platform thinking python is this a good idea?
>>
I need some materials on application design. How do I connect all the small pieces together?
>>
>>55446281
>python
>ever
>>
>>55446281
Python is good for learning concepts, very fast to get going.
>>
File: help me.png (103 KB, 1278x567) Image search: [Google]
help me.png
103 KB, 1278x567
Can you help me /g/, I'm a new idiot trying to learn.

I did what it said. I even started adding <h1> tags everywhere to see if it would work.
>>
I'm trying to make a sort of rotating polygon thing on processing, but I'm having a lot of trouble... The line in the project works as intended, but I can't seem to increase the size of it without drastically increasing the speed

http://www.openprocessing.org/sketch/376656
>>
>55446828
Terrible bait.
No (You) for you.
>>
>>55446828
<body>
<h1>Heading</h1>
<p>Paragraph</p>
<p>Paragraph</p>
</body>
>>
>>55446828
Right after the <body> tag, you have a <p><h1> with a closing </p> tag...

You're missing an </h1> tag before this </p> tag
>>
>>55446881
>>55446882
>>>/wdg/
>>
>>55446901
>he doesn't know html
>>
>>55446828
The h1 tag goes inside the <body>, not in the <head>.
>>
>>55446882
>>55446881
Thank you.
>>
Haskellspergs will deny this: http://www.scriptcrafty.com/compiler-autism/
>>
App or website

Which one will help me land a job or internship
>>
What's a good book/resource for learning assembly?
>>
>>55447149
Website for a job and App for money.

I like to think of App devs as glass cannon DPS in a group, only the fittest can truly survive, but when they survive they really do well.
>>
>>55447133
Sounds autistic tbqh

Lots of bitching about how he doesn't want to be told when his code is wrong
>>
>>55447181
So both? I've been going through the Hartl rails tutorial but I felt like I was wasting my time. I had people telling me to just learn how to make an app instead. I think i'll try to fit in both though, that sounds like a good idea.
>>
>>55447249
Honestly in the globalist economy we live in, you pretty much have to learn everything to some extent.

It just seems if you are creative, you have more wiggle room and potential to do more in apps.

I would probably go with apps for right now, but once the economy starts to slow, learn websites.

Diversify yo code [spoiler]nigga
>>
>>55447168
>assembly
assembly for what ISA?
>>
>>55447282
I hole-hardedly agree, but allow me to play doubles advocate here for a moment. For all intensive purposes I think you are wrong. In an age where false morals are a diamond dozen, true virtues are a blessing in the skies. We often put our false morality on a petal stool like a bunch of pre-Madonnas, but you all seem to be taking something very valuable for granite. So I ask of you to mustard up all the strength you can because it is a doggy dog world out there. Although there is some merit to what you are saying it seems like you have a huge ship on your shoulder. In your argument you seem to throw everything in but the kids Nsync, and even though you are having a feel day with this I am here to bring you back into reality. I have a sick sense when it comes to these types of things. It is almost spooky, because I cannot turn a blonde eye to these glaring flaws in your rhetoric. I have zero taller ants when it comes to people spouting out hate in the name of moral righteousness. You just need to remember what comes around is all around, and when supply and command fails you will be the first to go.

Make my words, when you get down to brass stacks it doesn't take rocket appliances to get two birds stoned at once. It's clear who makes the pants in this relationship, and sometimes you just have to swallow your prize and accept the facts. You might have to come to this conclusion through denial and error but I swear on my mother's mating name that when you put the petal to the medal you will pass with flying carpets like it’s a peach of cake.
>>
>>55447282
Alright thanks for your answers. Wish me luck, I hope I don't end up broke and alone.
>>
>>55447326
Did it really trigger you enough to post that copy pasta.
>>
>>55447168
Computer Systems: A Programmer's Perspective
>>
>>55445877
>>>/g/netsec
>>
What is objectively the best color scheme? My current one makes me strain my eyes.
>>
>>55447940
You didn't fall for the black meme one did you?
>>
>>55447997
n-no
>>
Dumb question but is learning assembly the only requirement needed to do embedded systems as a job?
>>
>>55448118
No
>>
>>55447304
x86-64 or whatever it is that my intel processor uses

>>55447429
thanks pal
>>
File: vim_comparison.png (172 KB, 1326x898) Image search: [Google]
vim_comparison.png
172 KB, 1326x898
>>55447940
I like vim on the laptop with arc theme background. The desktop however, my god. I have no idea why my colors are so bad. It's probably the proprietary Nvidia drivers.
>>
>>55448163
I usually suggest this one:
http://pacman128.github.io/pcasm

>>55444403
why not rust?
>>
>>55448455
>why not rust?
Because my work involves C++ (and also Lua but it's irrelevant) and I do not feel like learning an even more verbose version of C++ just for a gig.
Thread replies: 255
Thread images: 31

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.