[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/
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: 25
File: death grips rms.jpg (105 KB, 500x559) Image search: [Google]
death grips rms.jpg
105 KB, 500x559
old thread on autosage >>>51397656

What are you working on, /g/
>>
>>51404800
checkem
>>
>>51404800
On my awesome beard.
>>
>>51404829
indeed
>>
>>51404800
can someone optimize the image?
>>
>>51404804
>>51404822
>>51404829
>>51404836
>>51404844

>>>/trash/
>>
File: lan.jpg (217 KB, 460x450) Image search: [Google]
lan.jpg
217 KB, 460x450
>>51404800


>>51404844
*Optimise
>>
>>51404857
no
>>
>>51404844
i think 4chan already optimizes jpgs
i ran it through jpegtran and i get a duplicate file error when i try to post it
it's the same size too
>>
>>51404859
Absolutely nothing, anything the fat free wizard touches is automatically free.
>>
>>51404906
I read it as fat-free
Why can't he advertise freedom from fat instead?
>>
>>51404859
slap him for free
>>
File: Haskell.sh-600x600.png (54 KB, 600x600) Image search: [Google]
Haskell.sh-600x600.png
54 KB, 600x600
>>51404800

Hi, I'm moderator of the /r/haskell community on Reddit. We're looking to reach out to the community and find success stories in Haskell.

We think having some great example cases will broaden the exposure of our language to more people.

Also feel free to get in touch by PM'ing a mod on our reddit or emailing [email protected].

Post functional programming success stories here >>>51404926
>>
File: how-to-hang-yourself.jpg (234 KB, 608x1070) Image search: [Google]
how-to-hang-yourself.jpg
234 KB, 608x1070
>>51405736
>Hi, I'm moderator of the /r/haskell community on Reddit.
>>
>>51405736
Why would I constrict myself writing in Haskell when I can achieve the same degree of purity in C if I need it, while mixing it with side-effects and mutability when they are the best tools for the job?

Hasklel is a meme
>>
>>51405736
Hi, I think you have the wrong board
>>>/trash/
>>
>>51405753
If you're not bright enough to understand the language, then why even criticize it.

Have you ever even understood the benefits of parametric polymorphism?

Do you even know what a monad is?

We're tired of all these junior programmers who can't even wrap their brain around basic FP. You can avoid certain bugs from even happening. You can be concurrent.

Haskell is the wave of the future. If you keep trying to sabotage it, you're just a bad person.
>>
>>51405787
>parametric polymorphism
C++ templates
>monads
C++ templates
>>
>>51405801

C++ Templates? Say good by to readability.

Want to see something readable? View the source of pandoc.
>>
>>51405808
>C++ templates
>unreadable
>>
>>51405787
>I don't know C
>I struggle to use a meme language to compensate
>>
>>51405787
>If you're not bright enough to understand the language, then why even criticize it.
Very few languages require you to be "bright" to understand them. Haskell is not one of them.

>Have you ever even understood the benefits of parametric polymorphism?
void *

>Do you even know what a monad is?
Actually, I don't. And I'm still able to program perfectly fine.

>You can avoid certain bugs from even happening. You can be concurrent.
I can write C in a functional style if I so want. I can also write it in an imperative oop-with-side-effects abomination style if I want.

Fuck you and your meme language, autist
>>
>>51405787
If you're not bright enough to recognize bait, why even come here?
>>
>>51405831
I've been using F# for maybe 4 years now as my primary language. I still don't know what a monad is. I have vague ideas about they can be used to achieve, but I don't know what they are exactly.
>>
>>51405831
>bright
>bright enough

lql
>>
>>51405831
>I can write C in a functional style if I so want.
lel, no.
>>
I never know how to throw exceptions in C++.
Should you create a complete hierarchy of possible exceptions?
One for when glGetError doesn't return 0. One for IO exception when reading a texture. One for bad parameters to the method. Etc.
Should you just create one specific exception for your library and throw only that?
Should you just throw std::runtime_exception every time?
>>
>>51405831
>void*
Loving every laugh
>>
>>51405881
exceptions are just a meme
>>
>>51405891
No they're not. Exceptions are extremely useful for big projects.
I don't want to go into an argument over this again. Every time the result is the same.
>>
>>51405868
unsigned int function(unsigned int array[], size_t size) {
size_t i;
unsigned int largest = 0;
for(i = 0; i < size; ++i) {
if(largest < array[i]) {
largest = array[i];
}
}
return largest;
}


fully functional C code. your move, hasklel memer

>>51405885
void * is the purest form of "polymorphism"
>>
>>51405808
did you ever write a big project in Haskell?
that's the definition of unreadability right there
>>
>>51405851
They've been known for years as a standard (though unnamed) design pattern, it's only when haskell started taking off that their algebraic properties were elevated, turning them from something practical into abstract nonsense, and thereby making them hard for normals to understand.

They're very popular in haskell because of questionable features of the language (purity and laziness); other languages can use them but usually don't have much advantage to because there are other ways to order statements or encapsulate state which are, though not really ``better'' at least more comprehensible to practitioners.
>>
>>51405932
>void * is the purest form of "polymorphism"
Lots of love.
>>
>>51405831
no reason to be insulting.

your tone is condescending

this is why we dont like working with you people.

you think you understand what you're doing, but all long, you were ignorant.

you need to learn to understand problems deeply
>>
>>51405992
Am I triggering you, you little cunt?
typedef void * EGGPLANT;

EGGPLANT EGGPLANT EGGPLANT EGGPLANT EGGPLANT
>>
>>51406012
Bizarre.

Shoo, child. The adults are talking.
>>
>>51405868
>>51405932
BTFO
T
F
O
>>
>>51404800
Can you fucking use "Daily Programming Thread" in the OP?
>>
>>51405932
>i mutable
>largest mutable
>for statement, not recursion
lel, you just ridiculed yourself.
>>
>>51406110
My function has no side-effects. Any more "functional-ness" than that would be overkill. This is why C is better than Haskell: I can pick and choose how much of each paradigm I need.

Thanks for proving my point.
>>
>>51406110
>mutable
like god intended
>fast for statement instead of slow recursion
common sense
>>
What is the purpose of the void pointer type?
int compar(const void *a, const void *b)

Is it C's attempt at generics?
>>
>>51406110
>fp cá Žuck can't into fb
sá Žmh tá Žbh fá Žam
>>
>>51405868
implementing map in C is easy
and replace all loops with recursion
>>
>>51406254
>curious about c
>don't learn c
anon...
>>
>>51406145
>>fast for statement instead of slow recursion
Anon...
>>
File: lul.png (59 KB, 1558x702) Image search: [Google]
lul.png
59 KB, 1558x702
Dear haskell and functional memer
This is static.
(The error messages are a way to print static type information, it's also why it's so verbose)
>>
>>51406254
What type would you recommend for memory, or if you don't know or don't care what type of pointer you're going to be given?
>>
>>51406301
unsigned char*
>>
>>51406269
you can't have functional data structures in C. there no concept of what is a function, there no way to separate functions from procedures. you can't do functional programming with C.
>>
What's a good GitHub app for checking commits and pull requests?
>>
>>51406318
you can. there is. you can.
>>
>>51406340
git
>>
>>51406318
>you can't have functional data structures in C
First time I hear "functional data structures", did you mean immutable?

>there no concept of what is a function
huh?

>there no way to separate functions from procedures
1: how so? 2: and?
>>
>>51406318
>there no concept of what is a function [in C]

This is the kind of person that uses Haskell.
>>
>>51406318
>there no concept of what is a function
fp cá Žucks, everyone!
>>
>>51406294
what library are you using? hana?
>>
>>51406377
>First time I hear
well, time to educater yourself.
https://www.cs.cmu.edu/~rwh/theses/okasaki.pdf
>>
>>51406423
>Purely functional programming == functional programming
fuck off
>>
>>51406350
you can't because in C allocation and initialization are sequential.
>>
>>51406445
This

>>51406423
Hang yourself.
>>
>>51406423
kek, it's the same thing as the one I posted, guess who has to educate himself.
>>
>>51406423
also
>linking me to a book I already own
>>
>>51406450
>in C allocation and initialization are sequential
sometimes
>>
>>51406450
proofs?
>>
>>51406450
you can because in C sizeof (int) > sizeof (short).
>>
File: Capture.png (23 KB, 1131x275) Image search: [Google]
Capture.png
23 KB, 1131x275
>>51406419
Just something I made myself, it's really not that complicated.
>>
Do you people ever write anything useful?
Or do you just jerk it to stupid syntax tricks and compiler optimization?
>>
>>51406526
it's actually sizeof(int)>=sizeof(short)
>>
>>51406539
no
yes
>>
Prolog a good
A good and useful!
>>
>>51406539
no & yes
>>
>>51406539
We also jerk to lawering about the standard.
>>
>>51406540
actually >>51406526 has the same level of truth as >>51406450 ie. >>51406504
>>
Richard Stallman trying to pick up chicks through mail. https://stallman.org/ex-boyfriends-list.html
>>
>>51406526
here an example

struct String
{
char const * const string;
}

struc String *s = malloc(sizeof(string)); // can't allocate and initialize at the same time

s->string = ...; // error, field string is const qualified


you have to break the const qualifer through pointer aliasing and enjoy your undefined behavior. c is a shit language.
>>
>>51406578
>!UMAruUwtF
>UMAru
>wtF
REEEEEEEEEEEE
>>
>>51406527
the | thing works like this:
{a,b ... z} | f(x) -> {f(a), f(b) ... f(z)}
the >> thing works like this:
{a, b ... z} >> f(xa, xb ... xz) -> f(a, b ... z)
>>
>>51406572
yeah, I missed the point.

>>51406602
Doesn't even compile :^)
>>
>>51406602
here's an example:
sizeof (int) == 4
sizeof (short) == 2
>>
>>51406626
you just don't know what to say anymore.
>>
>>51406602
>// can't allocate and initialize at the same time
Maybe if you're using C1900 or something
>>
>>51406620
>>= returns it in the same kind of package (i.e. { f(a,b ... z) }

You can also concatenate them (I think I use & atm, was using , before)
>>
>>51406602
>break the const qualifer through pointer aliasing and enjoy your undefined behavior
that's not undefined behavior
>c is a shit language
you don't know enough c to be taken seriously
>>
>>51406639
I gave an example just like you did.
>>
>>51406602
struct String *s = (struct String []){{"nigger"}, {"nigger"}, {"nigger"}};
>>
>>51406720
yeah, now implement a map function with that then enjoy your stack corruption. you guys are really bad at programming.
>>
>>51406788
you're not that great yourself, considering you don't know that there's no stack involved there
>>
>>51405736
kill yourself
>>
>>51406655
>that's not undefined behavior
it is (C11 ISO Standard, 6.7.3 Type qualifiers)
>>
>>51406527
it's really awesome to see how MSVC improved in the 2015 version

it actually has a better adoption of the current standard than GCC (for example you can't use variadic template expansion with lambdas in the newest version), the only major thing missing now is expression SFINAE (they announced that it will be released in update 1, though)
>>
>>51406788
I had posted a map implementation a few years ago. I don't think I would have any stack problems, why do you think so?
>>
>>51406841
Does it finally support C11, or even C99?
>>
>>51406887
no
>>
>>51406815
>>51406846
yeah, no stack involved, you totally right... (pic)
>>
>>51406841
Tbh in terms of C++ I'd prefer nicer syntax for templating, and more operator-overloading-esque stuff in general. Haven't really seen much SFINAE stuff

I want MSVC them to fix the preprocessor and implement extended constexpr
>>
>>51406909
Huh? Why are you quoting me?
And what does a specific C implementation has to do with the standard? (that by the way does not require C to support stacks or anything like that).
>>
>>51406831
read it again, it's not.
protip: there is no "object defined with a const-qualified type" in the example we are talking about.
>>
>>51406887
I was just talking about C++ features.
I really don't care about most of the C11 features (who the fuck thought _Generic is a good idea?)
>>
>>51406975
you are confirmed for being retarded.

char const * const string;


here string is a const qualified object of type pointer to a const qualified object of type char. how the fuck one can even deny that ?
>>
>>51407046
no need to get mad and backpedal. why are you talking about another snippet now? all previous discussion about undefined behavior was about the code in >>51406602
are you under the impression there's an object with const-qualified type in that code sample? if so, you have much to learn, anon
humor me, which object is the const qualified one in that example?
>>
>>51407187
string
>>
clearly, someone should fucking kill themselves already
>>
>>51407221
there's no "string" object; "string" is the name of a member of the "struct String" type. any other confusions?
>>
>>51407241
>REEEEEEEEE
>>
>>51407241
>someone
>themselves
lol
>>
A string is a single value and not an object or an array
>>
>>51407320
>my name is Donny
>I'm out of my element
>>
Functional programming with pointers and manual memory management lads
>>
>>51407320
eww
>>
>>51407268
6.7.2.1 Structure and union specifiers

"A member of a structure or union may have any complete object type other than a variably modified type."
>>
>>51407355
tfw jabva is purely functional
>>
>>51407355
>pointers AND manual memory management
>>
>>51407355
weew m80
>>
>>51407303
>mad that English is changing to allow "them" forms as singular
lol
>>
>>51407366
>>51407268
also

3.15
1 object
region of data storage in the execution environment, the contents of which can represent values

2 NOTE When referenced, an object may be interpreted as having a particular type; see 6.3.2.1.
>>
>>51407381
What dialect is allowing that
>>
>>51407366
and? nobody said it doesn't have a "complete object type"; just that it's not an object. you seem to be very confused by all this terminology.
>>
File: 1446819434747.jpg (73 KB, 487x460) Image search: [Google]
1446819434747.jpg
73 KB, 487x460
>C program works perfectly
>valgrind reports hundreds of thousands of memory errors
>>
>>51407381
only butthurt feminists and faggot lovers on the internet do that.
>>
>>51407371
"no"

>>51407372
I suppose I could just say MMM but I started off just saying "pointers" and then wanted to drive home that it's pointers as in the C nomenclature, not pointers as in tracked heap references

>>51407374
wew lad
>>
>>51407409
k tard, read 3.15 in the standard.
>>
>>51407392
>region of data storage in the execution environment, the contents of which can represent values
so, its not a object

>2 NOTE When referenced, an object may be interpreted as having a particular type; see 6.3.2.1.
so, sizeof objname works.
>>
POST PROGRAMMING TUNES

https://www.youtube.com/watch?v=H3tfMJPX-rE
>>
>>51407402
It's pretty common in the Midwest
>>
>>51407435
i can take the address of string with &s->string, it's an object. you are fucking retarded.
>>
>>51405881
PPP2 discusses it at a basic level. I'd recommend at least reading that. Exceptions are a powerful feature, and they're use is a complex topic. It's pretty much impossible to give a single answer for any non trivial program.

At least have an upper level general handler that will catch '...' , and it's basically better to handle the exception as near the throw site as reasonable.
>>
>>51407446
https://www.youtube.com/watch?v=-_unV0UPGUY
>>
>>51405909
Exceptions are shit compared to using error handling monads.
>>
>>51407455
s->string is a object, string in the String struct is not.
>>
>>51407474
Both exceptions and monads are shit compared to using goto + labels in C
>>
>>51407474
Exceptions are error handling monads
They're still shit
>>
>>51407446
https://www.youtube.com/watch?v=WVsCKYHWxHI
>>
>>51407488
I think "returning a `Result a`" and having the plumbing still just werk is better than "returning an `a` but maybe the function also throws this exception type".
>>
>>51407422
>literally used for centuries prior to the modern era
>first singular form recorded in the 1300s

>butthurt faggots and feminists
the 1300s were a crazy time I know
>>
>>51407521
>>literally used for centuries prior to the modern era
nah
>>
>>51407521
America: Ruining the world since 1300
>>
golang error handling is the best if you want your code to be easy to understand
>>
File: Untitled.png (6 KB, 954x90) Image search: [Google]
Untitled.png
6 KB, 954x90
My CodeEval solutions always look so retarded when I finish, but it works. I have a feeling if someone asked me to solve a task as an interview question, I would fail. Unless I had 20 minutes or something, but it'd be a trial and error thing. Glad I already have a job at least. Anyway...
https://www.codeeval.com/open_challenges/197/
#include <stdio.h>
#include <stdlib.h>

int main (int argc, char **argv) {
FILE *fp = fopen(argv[1], "r");
char line[1024];

while (fgets(line, sizeof(line), fp)) {
int limit = atoi(line);
char container[3] = {'A'-1,'A'-1,'A'-1};

for (int i=0; i<limit; i++) {
if (container[2] == 'Z') {
if (container[1] == 'Z') {
container[0]++;
container[1] = 'A'-1;
container[2] = 'A';
}
container[1]++;
container[2] = 'A';
} else {
container[2]++;
}
}
if (container[0] != 'A'-1) putchar(container[0]);
if (container[1] != 'A'-1) putchar(container[1]);
if (container[2] != 'A'-1) putchar(container[2]);
putchar(10);
}
fclose(fp);
return 0;
}
>>
>>51407392
let me spell it out for you because you can't seem capable to read the fucking standard:
there are 2 objects in >>51406602 :
1. "s" which is an object with automatic storage duration and a declared type of "struct String *";
2. an object with allocated storage duration, no name and NO DECLARED TYPE that is aliased by "*s" and has an EFFECTIVE TYPE of "struct String". read more on 6.5.6 and 6.5.7
you can ALWAYS DROP a type qualifier if the object was not DEFINED with said type qualifier. the object obtained from malloc has NO TYPE QUALIFIER.
to recap:
>>51406655
>>
>>51407417
>c++ program works perfectly
>decide to hunt potential memory leaks
>valgrind reports fucking shitloads of leaks
>what the fuck
>spend hours minimising program
>no more manual allocation, still the same
>just down to int main() { } now, still shit tons of fucking leakage

this fucking shit

dear compilers: fuck you
>>
>>51407562
It's the same as doing it with a "Result a" type non-monadically except that there's still no safety, you have to trust that the user is going to check for the error and not force them to with pattern matching.

type Result a = Either String a

mightFail :: a -> Result b

case mightFail x of
Left err -> putStrLn err
Right y -> doMoreStuff y
>>
>>51407576
You really should be dynamically allocating your char buffers so your program never crashes or wastes more memory than it needs to.
>>
>>51407627
(You)
>>
>>51407627
God forbid my computer is robbed of 1024 bytes. for 5ms.

It's a codeeval challenge, constraints are generally known, and I wrote a script which automatically generates a codeeval template; 1024 is the default. If this was a project, sure, I would dynamically allocate my arrays.
>>
>>51407656
Looks like you failed the autism test my man.
>>
>>51407627
Don't foget to write your own custom memory allocator as well. You wouldn't want to waste a few extra bytes trying to align your data.
>>
>>51407656
>5ms
l2optimize
>>
Why do so few languages have copy-semantics/value-types?
>>
>>51407675
Are are you a faggot?
>>
>tfw you're retarded and lazy and will never get an internship or a job

does anyone know this feel?
>>
>>51407688
yes
>>
>>51407618
handling errors monadically is not good for readability (atleast in the sense of imperative languages, in purely functional languages it's equal in readability, although I dislike monadic control flow).
it's a strong abstraction to reduce code duplication at the cost of explicity.
>>
>>51407686
No, you?
>>
>>51407699
What I just posted isn't doing anything monadically. It's doing the same thing as Go, but objectively better.
>>
>>51407724
>it's better than Go
>>
>>51407417
>>51407616
probably coming from third party library you're using
>>
>>51407664
Looks like you don't know what autism is, my man.
>>
>>51407735
It is. With pattern matching you can only use the value if it's not an error, while Go just expects you to do the check without actually requiring it.
>>
>>51407766
>it's better than Go
>>
>>51407724
in go you have to explicitly ignore errors with _ (except for functions which only return an error, which are side-effect only functions)
you can explicitly ignore the error in haskell as well
>>
>>51407770
>being a Go fanatic

>>51407780
Not unless you write a non-partial function. Granted, Haskell doesn't have any mechanism to prevent you from doing that, but Haskell isn't all functional programming.
>>
>>51407799
Is it better than Java too?
>>
I'm going through a Haskell book because I couldn't resist it. Trying to do all the exorcises, but is it ok if I come up with ghetto answers?

For example
capitalise :: String -> String
capitalise text = unwords . map (\(x,y) -> toUpper x : y) $
map (\n -> (head n, tail n)) $ words text


Is this alright or am I supposed to come up with pretty solutions?
>>
>>51407814
All Haskell is beautiful
>>
>>51407745
#2 here. No, g++ just allocates a bunch of memory beforehand. I think it's for exceptions or something.

$ cat test.cpp && make test && valgrind ./test
int main() { }
g++ test.cpp -o test
==2584== Memcheck, a memory error detector
==2584== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==2584== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==2584== Command: ./test
==2584==
==2584==
==2584== HEAP SUMMARY:
==2584== in use at exit: 72,704 bytes in 1 blocks
==2584== total heap usage: 1 allocs, 0 frees, 72,704 bytes allocated
==2584==
==2584== LEAK SUMMARY:
==2584== definitely lost: 0 bytes in 0 blocks
==2584== indirectly lost: 0 bytes in 0 blocks
==2584== possibly lost: 0 bytes in 0 blocks
==2584== still reachable: 72,704 bytes in 1 blocks
==2584== suppressed: 0 bytes in 0 blocks
==2584== Rerun with --leak-check=full to see details of leaked memory
==2584==
==2584== For counts of detected and suppressed errors, rerun with: -v
==2584== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)


annoying as shit if you don't know
>>
>>51407799
you can always ignore the error explicitly, even in languages that are completly pure
you can thank the halting problem for that
is there really such a huge difference between writing _ to ignore the error explicitly and calling forever?
it is also nice that errors are such a simple concept in Go, while a maybe monad isn't exactly a simple concept.
i remember reading a paper claiming that monads aren't as good for composability as well as normal values, but i'm doubtful about that since i haven't got to that conclusion myself yet.
>>
File: ScreenShot_20151118195319.png (21 KB, 950x527) Image search: [Google]
ScreenShot_20151118195319.png
21 KB, 950x527
what do you think about codecademy ?

i think it is great to start to learn coding, but if you really want to learn the shit you have to pick up a book
>>
>>51406294
Fuck off James
>>
>>51407842
>Memory for quite a number of destructed objects is not immediately freed and given back to the OS, but kept in the pool(s) for later re-use. The fact that the pools are not freed at the exit of the program cause Valgrind to report this memory as still reachable. The behaviour not to free pools at the exit could be called a bug of the library though.

oh i see now
>>
What's the most efficient way to calculate the sum of squares for a single row of a scipy sparse matrix? I'm not familiar with the library and I'd assume that trying to do it without using some built in method will break the whole sparsity thing and take forever
>>
>>51407842
>Rerun with --leak-check=full to see details of leaked memory
Do you know how to read, you fucking monkey?
>>
I'm going to invest my time into an algorithms book because I want to learn about them. Introduction to Algorithms or Algorithm Design Manual? I think Knuth is too long.
>>
>>51407885
>common name
>common OS
>common IDE
>common lang
fml
>>
>>51406340
SourceTree is love. SourceTree is life.

Git bash is shit for merge conflicts. Git GUI is shit in general.
>>
>>51407907
$ valgrind --leak-check=full --show-leak-kinds=all ./test
==2657== Memcheck, a memory error detector
==2657== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==2657== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==2657== Command: ./test
==2657==
==2657==
==2657== HEAP SUMMARY:
==2657== in use at exit: 72,704 bytes in 1 blocks
==2657== total heap usage: 1 allocs, 0 frees, 72,704 bytes allocated
==2657==
==2657== 72,704 bytes in 1 blocks are still reachable in loss record 1 of 1
==2657== at 0x4C28C10: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==2657== by 0x4EBE1EF: pool (eh_alloc.cc:117)
==2657== by 0x4EBE1EF: __static_initialization_and_destruction_0 (eh_alloc.cc:244)
==2657== by 0x4EBE1EF: _GLOBAL__sub_I_eh_alloc.cc (eh_alloc.cc:307)
==2657== by 0x400F279: call_init.part.0 (in /usr/lib/ld-2.22.so)
==2657== by 0x400F38A: _dl_init (in /usr/lib/ld-2.22.so)
==2657== by 0x4000DB9: ??? (in /usr/lib/ld-2.22.so)
==2657==
==2657== LEAK SUMMARY:
==2657== definitely lost: 0 bytes in 0 blocks
==2657== indirectly lost: 0 bytes in 0 blocks
==2657== possibly lost: 0 bytes in 0 blocks
==2657== still reachable: 72,704 bytes in 1 blocks
==2657== suppressed: 0 bytes in 0 blocks
==2657==
==2657== For counts of detected and suppressed errors, rerun with: -v
==2657== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)


This does not tell you anything useful
>>
>>51407905
here's a hint anon--the matrices are part of numpy, not scipy itself. and yes there is a sum function.
>>
>>51407905
Nevermind, you can square all the data at once and just sum that
>>
>>51407456
What is PPP2?
>>
>>51408021
The issue was not summing, the issue was squaring each element without doing retarded shit. I figured it out.
>>
>>51404800
>Richard here
I will start a free fork of emacs, the new maintainer promotes the use of closed source software.
>>
How do I put shell expansions in my makefile?
>>
Is there anything like codecademy but for C? Basically I just wanna get badges and/or achievements because it's fun. I'm a Kongregate badge-whore too.
>>
File: lambda-star-red-flag.png (23 KB, 1920x1080) Image search: [Google]
lambda-star-red-flag.png
23 KB, 1920x1080
>>51404800
I'm working on a programming language. It's called Valutron.

Valutron is a Lisp. It has two key differences to many other Lisps: it has actual syntax instead of S-expressions all the way down, and I place emphasis on the dynamic Object-Oriented system that is available.

Here is a code example:

// let's define a 'get-hello-world' generic
defgeneric get-hello-world (object some-object) => string;

// let's define a 'hello' class
defclass hello (object)
{
slot string hello : initarg hello:;
slot string world : accessor getWorld, initarg world:;
}

defmethod get-hello-world (hello some-object) => string
{
let result = copy(some-object.hello);
append(to: result, some-object.getWorld);
result
}

let aHello = make-instance (hello: "hello", world: "world");
// the arrow -> is an alternative form of method dispatch syntax
print(stdio, aHello->get-hello-world());


Here's the same expressed in CL with CLOS:

(defgeneric get-hello-world ((some-object object)))

(defclass hello (object)
((hello :initarg :hello)
(world :initarg :world
:accessor getworld)
)

(defmethod get-hello-world ((some-object hello))
(setq result (copy (hello some-object)))
(append :to result (getWorld some-object))
(result)
)

(setq aHello (make-instance 'hello :hello 'hello :world 'world))

(print stdio (get-hello-world aHello))


Remember that Lisp is about so much more than the s-expressions, which are only used for writing it because of an accident of history - someone invented a stopgap interpreter that evaluated S-expressions instead of the planned M-expressions (which were much more similar to mathematical and ALGOL-like syntax) and M-expressions fell by the wayside.

My other projects include an Objective-C (dialect slightly differs from Apple ObjC) compiler, an IDE for ObjC inspired by the Smalltalk environment, an instant messenger client using Tox, and more. Feel free to query me on things.
>>
>>51408216
codeeval
it pretty much forces you to write everything in C if you want good scores
>>
>>51408269
do you work alone on these projects?

if not, may we see your code of conduct?
>>
>>51408284
Yeah I'm already on it. I'm ranked about 700.
>>
>start getting into C#
>implementing interfaces and extending classes both use the same keyword :
why is this allowed
>>
>>51408304
I work on these alone.

Code of conduct is "whoever I don't like doesn't get to work with me"
>>
>>51408336
I can't see why not.
>>
>>51408336
>needing explicit keywords to implement interfaces, making it impossible for people using your library to throw your types into their decoupled code
Go doesn't have this problem
>>
>>51405736
>hi i come from reddit and since my sub is shit i want content from other websites such as 4chan
>please help me make my sub less shit
fuck off
>>
>>51408336
You can only extend one class though.
>>
File: for dpt.png (8 KB, 333x103) Image search: [Google]
for dpt.png
8 KB, 333x103
>>51404800
how do i make the mountain list file be the input for a.out? i tried a.out < mountain list and it didn't work, it said no such directory "mountain" could be found
>>
>>51408717
you need to backslash that space in the file name
a.out < mountain\ list
>>
>>51408717
mountain\ list or "mountain list"
spaces are passed as different arguments/files
>>
>>51408717
a.out < "mountain list"
>>
>>51408717
./a.out < mountain\ list
or
./aout < "mountain list"


You need to escape the space in the file name or surround the file name in quotes so it is passed as a single argument
>>
Why does /g/ act like C is one of the hardest languages to use?
>practically every other language is a superset of it.
>the textbook is 150 pages long. It can be learnt in an afternoon.
>the people who use it are either old enough that it was the only option when learning or pretentious hipster garbage.
>even K&R thought that it would be forgotten
>unsafe as fuck
>any kind of real software takes inordinate amounts of time to produce.

Name one piece of popular software written in C which hasn't been in development for >10 years. pro tip: you can't.
>>
File: shimoneta binkan purest girl.jpg (108 KB, 478x951) Image search: [Google]
shimoneta binkan purest girl.jpg
108 KB, 478x951
>>51408759
>>51408755
thanks lads have a binkan for your time
>>
>>51408771
who is this semen lemon
>>
>>51408766
mpv's codebase is 88.4% C
>>
>>51407852
>you can always ignore the error explicitly, even in languages that are completly pure
>you can thank the halting problem for that
>mount_stupid.jpg
Totality can't be checked for all programs, but it can be checked for a language that's strictly less expressive. That doesn't mean "not Turing-complete", it means that correct forms of recursion and corecursion are strictly defined.

>it is also nice that errors are such a simple concept in Go, while a maybe monad isn't exactly a simple concept.
>i remember reading a paper claiming that monads aren't as good for composability as well as normal values, but i'm doubtful about that since i haven't got to that conclusion myself yet.
You don't need to know the mathematical definition of a monad to use one.
>>
>>51408766
tf2
rekt
>>
File: 53398957_p0_master1200.jpg (363 KB, 900x1200) Image search: [Google]
53398957_p0_master1200.jpg
363 KB, 900x1200
>>51408771
You are welcome.
>>
>>51404800
Working on a Matlab code to solve partial differential equations.
>>
>>51408766
>Name one piece of popular software which hasn't been in development for >10 years.
I don't know any in any language, lol.
>>
what is the best java ide with autocomplete for a noob
>>
>>51408269
NOT A LISP
>>
>>51408806
nice try but the source engine in C++.
>>
>>51408766
>old enough that it was the only option when learning
That's never been the case, languages that pre-date C are historically infamous for being more "beginner-friendly"
>>
>>51408835
IDEs are not good for a noob

however Intellij IDEA is the best
>>
>>51408766
>Name one piece of popular software written in C which hasn't been in development for >10 years. pro tip: you can't
can't argue with that.
>>
>>51407852
>>51408801
Also please explain to me how this allows you to ignore the error and just use the value when using a type like Either/Result.
>is there really such a huge difference between writing _ to ignore the error explicitly and calling forever?
>>
>>51406145
>like god intended
it's like you faggots haven't even read sicp
>>
// Function readInput reads names and elevations of mountains from the standard input and inserts them into mountainArray.
// It returns the number of mountains in the array.
int readInput(Mountain *mountainArray)
{
int i =0;
while(i< maxNumMountains)
{
printf("readInput:i= %i\n", i);
if(scanf("%s %i", &mountainArray[i].name, &mountainArray[i].elevation)<2)
{
break;
}
i++;
printf("readInput: at array position %i: name= %s, elevation= %i\n", i, mountainArray[i].name, mountainArray[i].elevation);
}
return i;
}


when i enter info manually it works, but i have a plain text file that looks like this
Eiger            3970
Everest 8848
Denali 5500
Fuji 3776


and all the mountain names are blank and all the numbers are 0 (which i initialized it to). what did i do wrong that it reads from typing in a mountain name followed by a number followed by an enter followed by ctr-d from the keyboard input, but it doesn't read in when it has a file directed into it?
>>
File: sussman shig.jpg (71 KB, 500x375) Image search: [Google]
sussman shig.jpg
71 KB, 500x375
>>51407486
>goto
>>>/trash/
>>
>>51408985
found the communist
>>
>>51408997
Quality post, keep on contributing.
>>
>>51408269
>curly braces instead of pythonic indentation

disgusting
>>
this whole board is a joke

you guys can't even write functional code, so you go off an insult it?

c? I studied that in elementary school

you printf, you add, you can't actually write anything in it anymore idiots! This is stuff from the 80's!

If you guys insist on programming imperatively, you may as well use C#, preferably Scala though.
>>
>>51409118
shut the fuck up
>>
>>51409118
>>51406527
>>
>>51409118
>people here don't share my opinions
>heh i wish this board was more like the subs where more people agree and upboat me
>this place sucks
>>
File: 81888423.jpg (101 KB, 470x363) Image search: [Google]
81888423.jpg
101 KB, 470x363
Apparently you need to implement template functions in the .h file. Worked until I tried to use the class, then it just outputted some random non-descriptive errors.
>>
>>51409118
that's the other thing

who does garbage collection anymore

seriously,

no modern programming language needs this. for the past 20 years, every language from JS to python to Java - guess what - they all manage memory for you!

unless you somehow are working on some really old code in C, like from an abandoned steel mill or smtn, you'd be outsourcing it and reprogramming it in Java.

Java literally is 1/3 of all code out there.

Every wonder why? Even I don't like it - but it actually works! Huge corporations use it.

No one who is legitimate cares about C anymore.

if you guys want a hobby, try ocaml or haskell. you can learn how to think differently about programming - and it will help you with every other language.
>>
Simple OSX/Windows game with SDL2 joypad support here:
http://www.raskie.com/octjective

Scores get displayed here:
http://www.raskie.com/octjective/map

Please let me know what you think, here:
http://raskie.com:85
>>
>>51408927
please guys i have multiple rare pictures of 2dqts i'm willing to share if you help me with this
>>
File: stop.jpg (3 KB, 160x160) Image search: [Google]
stop.jpg
3 KB, 160x160
>>51409176
>>
>>51409118
Can you write brainfuck? I can, so fuck you if you are saying that it is not the best programming language ever
>>
>>51409153
Yes, you do.
I think you used to be able to declare some stuff as extern but it was too complicated for compilers or something.
>>
>>51409176
and actually learn it.

don't be someone who just looks at it and gives up

im tired of hearing about whiners who can't understand hard work, or are just not intelligent enough to grasp Key Functional Concepts.

Did you know facebook uses Haskell? John Carmack mentioned it?

Scala is huge. LinkedIn uses it. Twitter.

That's right, basically the most popular useful service in the world, the app that *everyone* has and uses more often than there PHONE, guess what, it uses SCALA!

You think you can really have done that in C? By tinkering away on emacs or whatever? That's like a joke.

You guys are just a bunch of rejects and outcasts. Get serious - you'd be working right now if you knew how to program languages we actually need
>>
>>51409153
C++ in a nutshell. clang has much better errors than g++, in any case.
>>
>>51409176
>>51409222
There's that signature double newline again chap.
>>
>>51409238
I'm a big fan of consistency.
>>
>>51409229
Apparently you need to declare things before you use them. C++, amiright guys?
>>
>>51409222
OK thanks, you have convinced me.
Haskell is the best.
I'll subscribe to your sub.
This place is shit.
Let us both go back to reddit and be happy there.
>>
>>51409222
Carmack looked at haskell and really tried to use it. His conclusion, like anyone sensible, is that it's too shit for actual use.
Facebook uses ocaml rather than gayskell.
>>
>>51409153
>Apparently you need to implement template functions in the .h file
if you cant see the reason, you should consider stop learning C++, or better stop programming for good
>>
>>51409267
I declared them in a corresponding .cpp file as I had done with every other class.
>>
>>51409267
I was more referring to this:
>Worked until I tried to use the class, then it just outputted some random non-descriptive errors.
>>
>>51409281
>His conclusion, like anyone sensible, is that it's too shit for actual use.
uh, citation needed?

he is pretty enthusiastic about it in his video
>>
>>51409303
>>51409313

Templated things need declaring in the header file so that they're available for the compiler to specialise
>>
File: anna senpai shimoneta.jpg (36 KB, 225x350) Image search: [Google]
anna senpai shimoneta.jpg
36 KB, 225x350
>>51408927
someone help me please it's not giving me any error messages it just doesn't work
>>
>>51409355
>facts doesn't real
[shilling intensifies]
>>
>>51409385
what is Mountain.name? since you are passing address of it to scanf I am thinking that is the error
>>
Haskell is great for certain problems and bad for others. Most languages are like this.
The rest are just shit at everything.
>>
>>51408927
nice to meet you

i'm interested in what you're trying to do.

for one, you're trying to lex/parse files manually. I'm not readily able to see if you're dealing with tabs or spaces.

I think you're doing this for learning primarily, why not take a look at how tmux parses config files?

https://github.com/tmux/tmux/blob/master/cfg.c

Also, if you want, you can consider a library like libyaml, json-c, etc. Or make that data csv.

Here's the issue, you can try parsing it by hand - my concern is you may end up reinventing the wheel, you have to be able to handle issues that arise when the formatting inconsistent.
>>
>>51409419
[spoiler]
const int maxNumMountains = 100;
const int maxNameLength = 100;

struct Mountain
{
char name[maxNameLength];
int elevation;
Mountain()
{
elevation = 0;
}
};[/spoiler]

this is all the other code related to that part of my program
>>
>>51409431
yeah, my heater uses haskell. I wrote a program that calculates tenth Fibonacci number and it keeps me warm for whole night
>>
so give it to me straight, /dpt/

Java or C++ for hireability


[spoiler] or some other language [/spoiler]
>>
>>51409431
yes thank you

haskell is perfect for some projects, no so much for others

but c is a dead, archaic language. nothing people actually need uses it.

name one c application that matters. facebook, twitter? they're using HAXL, scala.

if you guys want C, use C# - it's pretty much the modern evolution of C.

>>51409462
You probably already see this, but use code instead of spoiler

The other thing is, i thought you were using C. Any reason you're picking C++?
>>
>>51409462
*
const int maxNumMountains = 100;
const int maxNameLength = 100;

struct Mountain
{
char name[maxNameLength];
int elevation;
Mountain()
{
elevation = 0;
}
};
>>
>>51409176
The only good way to "automatic" memory management I have seen is smart pointers as in c++.
It is easy to use.
It eliminates memory leak.
It is efficient and doesn't remove things by accident, as soon as something is not referenced anymore, it will be removed.

I am sure you can find a library that implements this in C if you need.
>>
>>51409481
s/C++/C#

C# has .NET - Microsoft's juggernaut behind it.

C++ is for rickity old ships. No one really uses that stuff anymore.
Thread replies: 255
Thread images: 25

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.