[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Due to resource constraints, /g/ and /tg/ will no longer be archived or available. Other archivers continue to archive these boards.Become a Patron!

/g/ - Technology

View post   

[ Toggle deleted replies ]
File: 1.07 MB, 1280x720, K&R hime2.png [View same] [iqdb] [saucenao] [google] [report]
56061461 No.56061461 [Reply] [Original] [archived.moe] [rbt]

old thread: >>56055124

What are you working on, /g/?

>> No.56061488
File: 7 KB, 272x130, &&.png [View same] [iqdb] [saucenao] [google] [report]


>> No.56061510

Still working on my C imageboard.
The actual web page displaying part isn't written yet.

>> No.56061516

Why C?

>> No.56061534

I don't want to learn PHP to write CGI scripts.

And node.js is gross.

>> No.56061543

The correct sentences would be:
Why are you using malloc if you want to write C++?

>> No.56061563

>it's another Cfag jealousy episode

>> No.56061626

kill yourself

>> No.56061642

>not using spring boot with h2 database and angularjs

>> No.56061649
File: 475 KB, 852x973, 1467398868589.jpg [View same] [iqdb] [saucenao] [google] [report]

You're >>56061475 , aren't you?
Do you not realise what the premise of this website is?

>> No.56061668

>premise of this website
there's no such thing

every board is different

>> No.56061682

I'm learning C. I get that other languages are easier, but realistically is there any reason I *shouldn't* be learning it? I'm hoping to go into game development but general software dev is fine as well. I figure the skills I learn are pretty language agnostic.

>> No.56061756

>every board is different
All I see is shitposting anywhere I go so no. This is the thread where we shitpost about programming.

oop is good

>> No.56061809
File: 342 KB, 714x738, 1421164417027.png [View same] [iqdb] [saucenao] [google] [report]

This thread is older and therefore legit

>> No.56061818

>You're >>56061475 → , aren't you?

>> No.56061826

(if i were, i would call it fag shit instead of weeb shit)

>> No.56061834
File: 427 KB, 514x662, tfw.png [View same] [iqdb] [saucenao] [google] [report]

So what are you working on, /g/?

>> No.56061887

Game development is usually C/C++(more C++) but there is stuff like Unity which uses C#.

>> No.56061893

Learning C will make you hate other languages because they're so easy.

>> No.56061901

I was going to write an imageboard in rust but got bored.

>> No.56061902

C++ is more common for game dev and software in general

>> No.56061910

>Learning C will make you hate other languages because they're so easy.
Wut? C is one of the easiest languages in existence.

>> No.56061921

also the skills you learn in C are not very language agnostic because you'll be stuck in the C mindset and you probably won't understand the benefits of things like OOP

>> No.56061976

Honestly, I dig learning new things/ways to make my programs more efficient or look cleaner, so I think I'd be fine if I moved to an OOP language.

Only one I've used before this is Python, and I wasn't taught "OOP" so much as I was taught "this is a class".

>> No.56062002


>> No.56062070

Can someone link me to a good article/book that explains corotuines in C++? I need to use them in my program, and I don't want to install a massive, bloated library.

>> No.56062082

Visual studio has an experimental, non-standard extension for coroutines that microsoft are going to propose for C++19/20

>> No.56062083
File: 2.38 MB, 445x250, Kill me!.gif [View same] [iqdb] [saucenao] [google] [report]

Made a prime decomposition program in Python.
It first worked like a charm but then things started randomly breaking and I blindly added more stuff until I got this mess.
print('Lists all prime numbers in a number.')

negativeNumber = False

correctInput = False
while correctInput == False:
correctInput = True
n = input('Enter a number: ')

if n == '':
correctInput = False
print('You didn\'t enter anything.')
print('Try again.')

n = n.strip()

while n[0] == '-':
if negativeNumber == False:
negativeNumber = True
negativeNumber = False

n = n.replace('-',' ',1)
n = n.lstrip()

for x in n:
if ord(x) == 44 or ord(x) == 46:
correctInput = False
print('I haven\'t implemented finding \
reciprocal prime numbers of decimals yet.')

if ord(x)<48 or ord(x)>57:
correctInput = False
print('Not a number.')
print('Try again.')

n = int(n)

if (n == 1 and negativeNumber == False) or n == 0:
print(str(n) + ' is ' + str(n) + '.')
print('What am I supposed to do with it?!')
if negativeNumber == True and n != 0:
print('-1 (1)')
if n>1:
i = 2
counter = 0

while i <= n:
if n%i == 0:
counter = counter + 1
n = int(n/i)
if counter != 0:
print(i,' (', counter, ')', sep='')
counter = 0
i = i+1

print(i,' (', counter, ')', sep='')

if n>1:
print(n, '(1)')

Also, why aren't there shortcuts for code and math tags?

Also been reading my SICP. Got stuck on exercise 1.5.
Miffed that I had to look up the answer. I sort of get it now but not really.

>> No.56062116

Why is the ternary operator ?: not more popular?

>> No.56062130

More limited use than if/else if/else, as it can only really do if/else which is less common in larger programs (you're more likely to want else if as well).

>> No.56062133

>things started randomly breaking and I blindly added more stuff until I got this mess.
And thus you learned the value of versioning. What breaks exactly?

>> No.56062136

Because people abuse it.

>> No.56062151

>It first worked like a charm but then things started randomly breaking and I blindly added more stuff until I got this mess.

>> No.56062168

is the gif 60 fps or 30? looks smooth

>> No.56062185

>ord(x) == 44
Fucksake this is harder to read and to write, just use x == "," pls.
>inb4 yes it's legit in Python

>> No.56062192
File: 8 KB, 184x274, patrick-star-hammer-jpg.jpg [View same] [iqdb] [saucenao] [google] [report]

But I'm using Code Blocks.

>> No.56062211

Haskell confirmed a table of truth

>> No.56062224

>negativeNumber = False
Fuckssake, int does this builtin

>> No.56062248

Way C, use a real language, Moo! language

>> No.56062282

30 ms per frame according to gimp so 33 fps

>> No.56062332

SICP 1.5:

We have:
(define (p) (p))

(define (test x y)
(if (= x 0)

Now the question is what would be the difference in evaluating (test 0 (p)) under applicative order and normal order.

Applicative order means that you evaluate the arguments and then substitute the results in the definition. Normal order means you just subtitute, no evaluation.

So under normal order we get:
(if (= 0 0)

The 'if' statement will evaluate the first argument, and depending on the result evaluate either the second or third argument and have that be the result of the 'if' statement. 0 is indeed 0, so it evalutates to the second argument of the 'if' which is 0.

However under applicative order, something else happens. The arguments are first evaluated before they are substituted. The first argument is 0 which evaluates to 0 and is substituted. The second argument is (p) which evaluates to (p) which evaluates to (p) which evaluates to (p) etc.

So the arguments are never evaluated because evaluating (p) is an endless cycle, and the command will never be fully evaluated.

>> No.56062363

>What breaks exactly?
Well, it's basically the printing of answers: I originally had it just spew out 2s, 3s, 5s and the rest of the prime numbers before clumping them in a primeNumber (numberOfOccurences) fashion.
When I decided to change it, the last prime wasn't printing. I didn't give it much thought, changing this, that and the other.
And then, after a while, I changed the while i <= halfN: to what it is now, for less needless computing, which threw a similar spanner in the works again.
In the end, it makes sense why it didn't work later on but it now makes me wonder how it ever worked in the first place.

It's 33.333...fps.
Or, rather, 30ms per frame.

Sorry. Bad habit from trying to cycle through characters with for loops.

>> No.56062407

>What are you working on, /g/?
just finished type inference (minus some of the more advanced features, which come later down the pipeline)
i guess it's time to make the lexer and parser? ill probably hold off until later today to work on that, but it feels nice having this much of my compiler done so far. plus im extra happy because i cleaned up all the really ugly parts of my type system with the last couple commits, so it should be a lot nicer to extend in the future

>> No.56062417
File: 19 KB, 281x41, gdt.png [View same] [iqdb] [saucenao] [google] [report]

So close

>> No.56062644

Coding is fun and challenging
I am right now learning about value methods in java.
I have not always the time to sit down and code.
Nonetheless I want to learn more about programming better and understand it more deeply.
As I am learning Java, I really want to concentrate myself on this language for now and get used to the new features, I am looking for something I can read on the go.

Do you have any good texts and links I could inform myself?

>> No.56062657

are you messing with ASLR or something?

>> No.56062707

Trying to generate proper GDT entries for a kernel.

>> No.56062717

k&r, you fucking pajeet

>> No.56062807
File: 16 KB, 299x274, Whoa_Keanu Reeves.jpg [View same] [iqdb] [saucenao] [google] [report]

>int does this builtin
Would that be the __ge__(0) method? I don't see one specifically dedicated to giving a boolean depending on whether the integer is positive or negative.
Regardless, at that point, I was still working with the input as a string (because I'm too stupid to try/throw/catch exceptions to check user input): it's easier to scan the beginning of the string for dashes and weed out non-numerals further along than to... I don't know how else to do it.

>In applicative order evaluation, you evaluate the arguments and then substitute the results in the definition
>you evaluate the arguments (the x y of (test x y)) before substituting
>In normal order evaluation, you substitute first
>Which means, when running test under normal order evaluation, you don't get to (p)
I think I get it now although I'll likely need to reread the bit about applicative-order and normal-order evaluations again.

>> No.56062820
File: 19 KB, 283x48, gdt2.png [View same] [iqdb] [saucenao] [google] [report]

and, bingo!

>> No.56062860

Xinu based OS project. Porting a lot of old code from OSDev followings. Probably going to do PE instead of elf as I have a PE bootloader finished.

>> No.56062866

>putting the burden of memory management on the programmer

Absolutely disgusting.

>> No.56062869

Is it realistic to use IPFS as a video streaming platform?

>> No.56062905
File: 105 KB, 640x480, 1458139789336.jpg [View same] [iqdb] [saucenao] [google] [report]

i = 100000000

while i:
i -= 1

$ time python test.py
python test.py 12.07s user 0.00s system 99% cpu 12.092 total

kore i wa 100000000 desu

while i
kore i wa i - 1 desu

$ time ./interpreter test.fs
./interpreter test.fs 7.90s user 0.92s system 99% cpu 8.823 total

>tfw even your shitty inefficient toy language is faster than Python

>> No.56062908

How do i write c++ code in c style? I need a static global variable, but i really don't want to make any ever again.

>> No.56062935

>$ time python test.py
>python test.py 12.07s user 0.00s system 99% cpu 12.092 total
that's not how you benchmark a script, you dumbass

>> No.56062936

Noice, weeb.

>> No.56062958

Well you're talking about the language that had to iterate over an array of numbers in a for loop at one point.

>> No.56062959

I know.
I just implemented while loops and wanted to get some idea about the performance of my interpreter.

>> No.56062972

Hey lads I'm learning C right now and got confused by something involving main.

How come I can write main() { ... } without int or void and have it compile fine?

I can't tell if I'm using C90 or C99 which are different apparently or if they affect anything

>> No.56062983

But that's the proper way to iterate over arrays.

>> No.56062993

sometimes you just want to write a shitty toy program and the function declaration would be longer than the program

>> No.56063006

...And I lost the code to the bootloader.

>> No.56063039

i think he's talking about it actually creating an array of numbers which it then iterated over, just having a for loop could make it crash from running out of memory

>> No.56063067

Oh, lol.

>> No.56063084


It's technically not allowed but GCC isn't strict because it kept compatibility to compile stuff from before C89 back in K&R C. The standard only explicitly states two signatures and any equivalent as long as it doesn't break the standard is also allowed.

>> No.56063095

Most languages:
>int i = 0; int i < 5000; i++
>checks if i < 5000 and increments it

>for i in range(0,5000)
>creates an array [0,1,2,...,4998,4999] and iterates over it

>> No.56063105


>> No.56063109


>> No.56063137

It actually doesn't do that anymore in 3.x, unless you specifically ask for it

>> No.56063139

up to version 2, but that's a good point.
just use xrange, but that's a stupid default. And python is pretty stupid in general.

>> No.56063156

this compiles even with -std=c90 -pedantic
i = 100000000;
while (i--);

>> No.56063163

do you know what google is, you fucking retard

>google for me pls

>> No.56063174

Can you do an algorithm thingy even if you are not inside a data structure packet container linked to the server client model server asynchronously?

>> No.56063206

That's because there are no builtin coroutines in C++. You can have coroutines, but only with a huge library that leverages platform-specific shit. If you want to read about this, the doc for Boost.Coroutine explains what it's doing under the hood very well IMHO, so go read that, it's most probably the best you can get.

>> No.56063215

Fuuuuuuck. I don't wanna use Boost.
Oh well, thanks anon.

>> No.56063250
File: 135 KB, 300x273, lao-tzu.png [View same] [iqdb] [saucenao] [google] [report]

Boost it a tool, therefore using it isn't automatically bad ; abusing it is.

>> No.56063342

Hahaha oh wow

>> No.56063424

Using boost is the same as abusing boost.

>> No.56063460
File: 48 KB, 1366x651, Untitled.png [View same] [iqdb] [saucenao] [google] [report]

Nothing right now. Kind of "finished" consuming an api a week ago. It does what it does(Searching jobs in Sweden via the swedish employment office).
What do you think about the user interface?

I'm aware that the dates in listview aren't formatted. Just too lazy for that.

The method populating the listview is embedded in another thread because the frame freezed when consuming the api.

This is created in JavaFx.

Do you have any advice what to do next? Something thread heavily and useful would be great.

>> No.56063462

>not using recursion

>> No.56063472

Who /codetriage/ here?

>> No.56063477

It's a leftover from pre-standard C.

Functions with no return type used to mean int, but I think that since c99 this is not the case?

>> No.56063484

Please, it's not THAT much of a toy language.

>> No.56063499


>> No.56063518

map isn't iteration, you want fold

>> No.56063525

The fact that you have implemented while loops as a basic functionality just shows that it is a toy language

>> No.56063555

>while loops
Go back to "programming" your recursive fibonacci in Haskell please.

>> No.56063570

Nah, too easy.

>> No.56063584

if i install a debugger plugin on sublime text that calls itself a ruby debugger, does that mean that it won't work at all for other languages?
I'd like a debugger for C, C++, Java and/or python that allows me to click on the line number to set breakpoints and that shows me the value of each variable for every step.

>> No.56063605

Just use an IDE.

>> No.56063606

in Haskell loops et all are just higher order functions

>> No.56063613

You know, this is why Ken Thompson, Rob Pike and Robert Griesemer created Go.

Each individual writes better C than all of /g/ combined several times over, but they know it isn't the best tool to write web servers and that all other alternatives are bloated shit, overengineered or incomplete.

>> No.56063640

Fun fact: Go literally has no reason of existence.

>> No.56063645

>it won't work at all for other languages?
The plugin? No it won't. Sublime? Yes it will. It can handle it; don't be stupid. Also note that it deprives you of your freedoms.

>> No.56063666

>and you probably won't understand the benefits of things like OOP

Which kind of OOP? Inheritance-based OOP is only really useful in a very, very limited amount of situations, and 90% of that is UI and video games (things where you have clear-cut entities, and even then that's no excuse to use it everywhere in those types of software).

Functional and imperative people usually recognize that OOP can help in those situations, while OOP people try to hammer OOP into every fucking thing out there.

>> No.56063693

Go was designed for people who aren't capable of understanding better languages.

>> No.56063715

>Which kind of OOP?
Java and C#, duh. OOP is the best solution to 99.993% of programming problems.

>> No.56063722


>> No.56063735

Anybody here use Geany for Python and C++?

>> No.56063761

No, what is that?

>> No.56063793

sounds g a y

>> No.56063846

why would you? there are plenty of better text editors

>> No.56063876

Use emacs or vim, I don't even care which

>> No.56063903

So where do I start with programming

>> No.56063907

put on a skirt and read K&R

>> No.56063925

nvim is definite GOAT

>> No.56063929

What do you want to do with programming

>> No.56063945

>languages needs reasons to exist
I could argue that langs need to be productive, and that haskell would dissapear overnight.

>> No.56063955

>languages need reasons to exist

>> No.56063956

I have these two functions written in Java and i'm looking for PHP implementations for both such that data can be encrypted/decrypted by both PHP and JAVA interchangeably.
public static String encrypt(byte[] publicKey, String data) throws Exception {
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(publicKey)));
return DatatypeConverter.printHexBinary(cipher.doFinal(data.getBytes(Charset.forName("UTF-8"))));

public static String decrypt(byte[] privateKey, String encrypted) throws Exception {
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(privateKey)));
return new String(cipher.doFinal(DatatypeConverter.parseHexBinary(encrypted)), Charset.forName("UTF-8"));

>> No.56063957

Haskell is more productive than go will ever be

>> No.56063964

Make shitty games for fun

>> No.56063978

evil mode, friend

>> No.56063986


>> No.56063991


>> No.56063994

Anons what is the best resource for learning C (including advanced stuff idk t b h)?

I tried the second edition book but it felt useless and unnecessary.

I already know the basics, but never went past structs or pointers

>> No.56063997

C++ or C# are good for that. Couldn't rec any good resources because I don't know either, but they'd be a good start

>> No.56064012

cs50 has some stuff about data structures as well, after that idk

>> No.56064032

learn about data structures and algorithms and start some projects that sound difficult

>> No.56064046
File: 31 KB, 1600x374, helm-spacemacs.png [View same] [iqdb] [saucenao] [google] [report]

Slow and buggy. Not joking, I have used and venerated Emacs for a long time, but it's irremediably unsalvageable with regards to that. We just need to let go and move on. And I did. May Gnu bless your computer my child.

>> No.56064067

Still doing sicp again to brush up on lisp.

Yawn.. Definitely haven't done anything lisp related in a long period of time.

(define (f n)

(define (f-process n)
(+ (f (- n 1))
(* 2 (f (- n 2)))
(* 3 (f (- n 3)))))

(if (< n 3)
(f-process n)))

(define (f-iterative n)
(define (f-iter a b c count)
(if (< count 3)
(f-iter (+ a (* 2 b) (* 3 c))
(- count 1))))
(if (< n 3)
(f-iter 2 1 0 n)))

>> No.56064096

Are you using MIT/GNU Scheme, Racket, or something else?

>> No.56064108
File: 131 KB, 1280x720, 1440279254349.jpg [View same] [iqdb] [saucenao] [google] [report]

What university are you studying/plan to study at?

>> No.56064119


Racket currently

>> No.56064127

Is it comfy?

>> No.56064129

I studied System Science at Lund University.
Working as a programmer.

>> No.56064130

Illinois State, got enough credits to graduate a year early

>> No.56064142
File: 57 KB, 800x334, ;D.png [View same] [iqdb] [saucenao] [google] [report]

nichijou university

>> No.56064162


>> No.56064179


It's simple and trivial to set up. Kinda wish I had vim configured to do highlight the scope of parenthesis like Dr. Racket does instead of just the starting + ending brace.

>> No.56064181

I'm going into InfoSec and am going to graduate this year

>> No.56064216


to do highlighting of the scope of parenthesis*

I am apparently not able to write my native language today.

>> No.56064217

oh man, /dpt/ is surely fantasy land

>> No.56064249


No /dpt/ is full of haskell shills that worship the language like a religion.

If they like monad that much then gnosticism might be the answer.

>> No.56064260
File: 102 KB, 300x256, 084.png [View same] [iqdb] [saucenao] [google] [report]

>Haskell is more productive than go will ever be

>> No.56064284

Stumbled my way to a Bachelor's degree through Georgia Southern's CompSci program. Jesus FUCK that department was unorganized. Came out feeling very insecure with my skillset, and I'm still kicking myself for not realizing how important it is to get an internship before graduating. So now I'm trying to build up a portfolio while hunting for a part-time job.

Speaking of, can anyone recommend a good book on computer grafics, preferably one that's language-independent?

>> No.56064287

There are a few people in this thread that do nothing but talk about how much they hate Haskell

Imagine being so deprived

>> No.56064297

stay delusional

>> No.56064306

Stay delusional

>> No.56064312

The fact you replied proves my point, that you exist

>> No.56064316

Here. Condensed version.
print('Lists all prime numbers in a number.')

correctInput = False
while correctInput == False:
n = int(input('Enter a number: '))

if n == 1 or n == 0:
raise ValueError

correctInput = True
except ValueError:
print('Not having that input, sonny Jim.')
print('Try again.')

if n<0:
print('-1 (1)')
n = -n

i = 2
counter = 0

if n>1:
while i <= n:
if n%i == 0:
counter = counter + 1
n = int(n/i)
if counter != 0:
print(i,' (', counter, ')', sep='')
counter = 0
i = i+1

print(i,' (', counter, ')', sep='')

if n>1:
print(n, '(1)')

>> No.56064321

daily programming general != haskell hate general

>> No.56064326


>> No.56064337


it's not general it's a daily thread
there's a huge difference

You're doing it wrong

>> No.56064348

Haskell has generics, HKTs, typeclasses, type inference, tail call optimization, along with many other things. Go doesn't. You're forced to write many more lines of code in go than in Haskell.

I think go should never have existed. It has brought nothing to the table but misery, anguish, and woe.

>> No.56064352

>There are a few people in this thread that do nothing but talk about how much they hate Haskell
are you stupid? the only ones spewing hate are the ones criticizing other langs for existing. just look at this: >>56063640
idgaf if you use go, haskell or whatever the shit, but telling other people to not learn/use certain lang because you don't like it and therefore no one should is absolutely retarded

>> No.56064361

>it's not general
Then stop trying to make it into one.

>> No.56064365

>liking Haskell

Enjoy your non-googleable hieroglyphs that you can't even read out loud to yourself, or anybody else. Even if Haskell could have been this great, pure savior of functional programming languages, those bullshit operators are standing in the way of Haskell gaining any meaningful usability.

>> No.56064367

just because you write fewer lines of code in haskell doesn't mean it isn't shit

so hating on python is better than hating on haskell? protip: they're both shit

>> No.56064381

>just look at this: >>56063640 (You)
It's fact however, there is no reason to use Go at all.

>> No.56064390

Go wanted to be a systems programming language. Now it tries to be a web server language. Too bad the language and standard library are complete shit. Look at all the 3rd party replacements for the net/http package and you'll realize how bad the standard library is.

>> No.56064398

Maybe you should read my post again, your reply doesn't make much sense. It's like you're trying to argue with me by agreeing

Yes, there are a variety of reasons to dislike Python which I've gone over again and again and again and again and again, but the people that come here to hate on Haskell ONLY do it because it's a running meme. They don't actually know anything about Haskell.

>> No.56064399

Nobody still can explain what monads are, lol.

>> No.56064401

what do the people who use haskell use it for?

>> No.56064409

they write python compilers

>> No.56064414

For instance, if you wanted to attack Haskell you'd start by complaining about performance. Not productivity. Haskell can be a very productive language, and the low LOC count shows that.

>> No.56064415

Posing about it on /g/

>> No.56064422

Should I stick to an 80 character limit?

>> No.56064438


>> No.56064444
File: 1022 KB, 640x480, 1463053894024.gif [View same] [iqdb] [saucenao] [google] [report]

>Haskell can be a very productive language, and the low LOC count shows that.

>> No.56064449


>> No.56064455

Nice argument, I really like all the points you made in this post

>> No.56064456

>non-googleable hieroglyphs
That's what hoogle is for.

>read out loud to yourself
Do you read your code out loud to yourself?

Symbolic operators in Haskell are no different to the ones you're used to in other languages, like +, &&, ^, etc. You learnt those, you can learn others too. Nobody going into programming for the first time knows what || means.

Less code means fewer places for bugs to reside, and also, why would I do work that I get the compiler to do for me?

>> No.56064468

in most cases, yes, but i think going up to 120 occasionally is fine, for example if it's obvious from the context what the line is doing so that it doesn't need to be super-convenient to read.

>> No.56064485

kill yourself idiot

>> No.56064497

They're monoids in the category of endofunctors.

Alternatively, they're a typeclass with some associated laws.

>> No.56064522
File: 13 KB, 300x225, monads.png [View same] [iqdb] [saucenao] [google] [report]

Monads are applicative functors with a join operation, you can think of them as types of effectful computations

>> No.56064523

>kill yourself idiot
Excuse me?

>> No.56064526
File: 12 KB, 225x321, haskell.png [View same] [iqdb] [saucenao] [google] [report]

>> No.56064530

You guys love feeling persecuted, huh

>> No.56064541

i used it for text manipulation when was beginning learning it, it has nice functions for that :^)

it's really great for interpreters/compilers because of algebraic data types and pattern matching

>> No.56064542

Haskell's performance is often better than languages such as Ruby and Python, though. It can't quite compete with C and C++ in many cases yet, but it comfortably beats many dynamic languages.

>> No.56064555

so true fâm!! 100

>> No.56064564

>performance is often better than languages such as Ruby and Python
So it runs like trash?

>> No.56064589

Nope. I would suggest that you actually try Haskell, but you would need to learn to read first.

>> No.56064597

They're right about people resorting to memes to attack Haskell

>> No.56064598

There are a few people in this thread that do nothing but talk about how much they love Haskell

Imagine being so deprived

>> No.56064601


>> No.56064614

I do program in Haskell

No, we talk about what we're doing in Haskell
We don't write posts that are just "haskellfags btfo xd #rekt"

>> No.56064618

People often shit on Haskell and later end up copying its innovations, and this thread is no different.

>> No.56064637

the delusion is real

>> No.56064647

Once again a condescending post with no points whatsoever. What are your grievances with Haskell?

>> No.56064652
File: 120 KB, 284x339, sad penguin.png [View same] [iqdb] [saucenao] [google] [report]

Moving to new city for a job.

I'm scared of being alone ):

>> No.56064655

Just revive the functional programming general and fuck off.

This shit is becoming unbearable.

>> No.56064681

>Haskell invented all the good things that other languages stole!


>> No.56064682

You're the fucking problem, all you do is spam the thread with your bullshit and then cry when people actually reply to you and ask you to defend your position

What is wrong with Haskell?

>> No.56064687

There's no need, functional programming is programming.

>> No.56064688


>> No.56064697

Who are you quoting?

>> No.56064703

>What are your grievances with Haskell?
Its users are pedantic, autistic, and on the whole quite irritating.

>> No.56064708

Oh, a strawpoll
Wow, well done

You couldn't even think of one point, could you?

>> No.56064711

*Sends internet hugs*

>> No.56064714

I didn't say that, though. That's a strawman.

>> No.56064722

such as?

where do you think you are?

i find the anti haskell posters irritating

>> No.56064725

>this thread copied haskell

>> No.56064728

Not an argument

>> No.56064764

this thread is so fucking shit fuck off with your fucking haskell and trap fag shit

>> No.56064765

you have us anon, don't be sad.

>> No.56064774

>basing an entire community off of /g/
It's just like Arch Linux

>> No.56064782

Anti-Haskellers copied and adapted a pro-Haskell post, presumably because it was better than anything they could come up with by themselves.

It's amazing how today's mainstream language features were last decade's impractical academic ivory tower curiosities.

>> No.56064785

>I'm scared of being alone ):
you're with you, though.

you're not alone.

>> No.56064806

boost abuses YOU. A massive library that you only need 1 fucntion from

>> No.56064812
File: 121 KB, 2032x820, 1455217692734.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.56064815

Your post, on the other hand, contributes greatly to the thread.

>> No.56064828

Neat pthread macro for gcc:

#define thread(ARG) ({ \
pthread_t _inpar_thread_temp; \
auto void* _inpar_thread_func(void* arg); \
pthread_create(&_inpar_thread_temp, NULL, &_inpar_thread_func, (ARG)); \
void *_inpar_thread_func(void* arg) \

#define endthread _inpar_thread_temp; })

int main(void) {
pthread_t foo = thread("foo") {
char* str = (char*) arg;

printf("Thread #%u says: %s\n", pthread_self(), str);
return NULL;
} endthread;

pthread_join(foo, NULL);

return 0;

>> No.56064835


>> No.56064838

TIL noticing patterns is autistic

>> No.56064846

everyone please stop replying to each other

unless you're contributing to this fucking thread

>auto void*
What does this do?

>> No.56064847
File: 26 KB, 500x600, 1426782082333.jpg [View same] [iqdb] [saucenao] [google] [report]

>tfw to smart for OOP

>> No.56064855

fuck off back to r/haskell fucking shit tard

>> No.56064861

You might be illiterate, but you are indeed too smart for OOP.

>> No.56064864
File: 201 KB, 335x365, anime.png [View same] [iqdb] [saucenao] [google] [report]

Are you part of the procedural master race?

>> No.56064872

nice meme smug fag

>> No.56064873

Literally nothing, no idea why that's there. auto is implicitly there in all declarations in C

>> No.56064876

TIL how to trigger 4chan

>> No.56064886

>and now instead of admitting they had no legitimate points against Haskell, they're just going to continue thinking the Haskell community is just full of pretentious fags for defending their language

>> No.56064887

>y-you made that up!

Sure thing, fuckheads. It's exactly what was implied.

>> No.56064888

>tfw 2 smart 4 every paradigm

>> No.56064894
File: 8 KB, 555x202, existentially quantified types.png [View same] [iqdb] [saucenao] [google] [report]

please fuck off and stop ruining our reputation

t. haskellfags

>> No.56064896

// file.c
// compile with gcc file.c -lpthread

#include <stdio.h>
#include <pthread.h>

#define thread(ARG) ({ \
pthread_t _inpar_thread_temp; \
auto void* _inpar_thread_func(void* arg); \
pthread_create(&_inpar_thread_temp, NULL, &_inpar_thread_func, (ARG)); \
void *_inpar_thread_func(void* arg) \

#define endthread _inpar_thread_temp; })

int main(void) {
pthread_t foo = thread("foo") {
char* str = (char*) arg;

printf("Thread #%lu says: %s\n", pthread_self(), str);
return NULL;
} endthread;

pthread_join(foo, NULL);

return 0;

>> No.56064898

Enjoy your dying paradigm, Pajeet

>> No.56064906

this, even haskellfags can be ok if you don't act like such insufferable spergs about it

>> No.56064914

doesn't compile without it

Not sure entirely, but if you take it out it gives this error:
error: static declaration of ‘_inpar_thread_func’ follows non-static declaration
void *_inpar_thread_func(void* arg) \

>> No.56064921

He didn't say Haskell created every good language feature like you were implying though, just that other languages tend to take features from Haskell

>> No.56064925

you're pathetic

>Functional and imperative people usually recognize that OOP can help in those situations

>> No.56064927

No, it wasn't. You're being delusional again. I stated an existential, you are inferring a universal.

I'm on your side, friend.

>> No.56064935
File: 56 KB, 625x333, JUST.png [View same] [iqdb] [saucenao] [google] [report]


>> No.56064939

>Just use OOP family

>I'm on your side, friend.
no you are not

>> No.56064942

nice meme

>> No.56064946

You can't write English properly.

OOP is snake oil and only helps bad programmers. I'm sorry you wasted part of your life on it.

>> No.56064961

here's your (You)

>> No.56064967

how do you become a better programmer? leetcode is tough as fuck. I guess I am looking to be a better algorithm solver.

>> No.56064976

>I stated an existential, you are inferring a universal.

This is a conversation, not a logic proof. What you said and what you meant are two different things.

>> No.56064979

he wasn't alone

>> No.56064983

Thank you, good fellow. Every little helps in the battle against ignorance.

>> No.56064984

lots of practice and research

>> No.56064987

>I'm sorry you wasted part of your life on it.
Is this how haskellites think? No wonder they're so quick to defend their useless lang.

>> No.56064995

By not doing those problems and actually making things.

You don't often run into complex algorithm problems with most software.

>> No.56064998

huh.. excuse me?

>> No.56065000

Your paranoid fantasies are getting the better of you. >>56064921 has the right of it.

>> No.56065014

He didn't even say if he used Haskell
>and somehow they're the issue

>> No.56065015

I hate to see human potential wasted fighting against useless, crippled tools.

>> No.56065033


None of haskell's features are unique, so it can't be that features are "taken" from haskell.

>> No.56065042

That's not true. OOP with caution is actually quite helpful. As long as you stay away from things like multiple inheritance and bad practices its nice. You put OOP development in the hand of a bad programmer and you get a cluster fuck. So no, it really isn't for bad programmers.

>> No.56065053

type classes

>> No.56065060

are you 28 years old?

>> No.56065066


>> No.56065077

they're not the same thing

>> No.56065097

i was just following directions

>> No.56065099
File: 1.27 MB, 300x214, sht just got real_.gif [View same] [iqdb] [saucenao] [google] [report]


>> No.56065103

So. When Trump fixes the H1B (lol) will I be able to get hired in the US instead of the Indians? Because it's clear you need better software devs. And I'd be interested in working there. But with the current state of things you need specialist knowledge to get a job.

>> No.56065112

They assuredly can. A feature can be invented somewhere, popularized by Haskell, than copied from the Haskell implementation by another language.

I'm not saying Haskell doesn't copy from further up the chain. The difference is that Haskell users aren't so inconsistent as to decry a feature as useless only until it comes to their language.

>> No.56065119

Are you retarded? The indians that work for US companies don't live in the US.

>> No.56065129

How to get the memory address of the metadata of some file? What C++ libraries and methods are available for that?

>> No.56065137

>The difference is that Haskell users aren't so inconsistent as to decry a feature as useless only until it comes to their language.

Does anyone do that? I'm always happy when C# gets new functional features (which are, assuredly, not from Haskell).

>> No.56065151

Making real software teaches you more than random algorithms do. Even in trivial software you have to architect it well. Which is a process where you challenge yourself more as you get better.

>> No.56065179

Depends on the file. Learn the file format. Usually you have a header which defines a chain of links (in the case of wav) or offsets in the file. Somewhere there you should find a way to find the metadata.

>> No.56065191

OH and if it's Id3. http://id3.org/id3v2.3.0

>> No.56065227

I congratulate you on being open-minded, and not obviously falling victim to the Blub paradox.

But yes, there were, let's say, mixed feelings regarding adding Optional (inspired by Haskell, either directly or indirectly through Scala) to Java, and also adding lambdas (certainly not inspired by Haskell, because its are much more pleasant to work with). Unfortunately, due to disagreements, neither feature has been implemented satisfactorily in my opinion.

>> No.56065231

I wrote a memmem() function for this express purpose.

Usually, these metadata tags have a magic number, which is a sequence of bytes (usually ASCII characters) that identify the start of the tag.

ID3 tags are identified with 0x73, 0x44, 0x33 at the start.

>> No.56065273

honestly I think people in support of OOP mainly just mean OP. object programming. Being object oriented is hell and I can't sympathise with anyone who argues it's OK.

>> No.56065295
File: 31 KB, 820x295, vectormerging.png [View same] [iqdb] [saucenao] [google] [report]

I have a quite complex problem trying to merge two vectors in O(n log n). (Pic related)

Just asking if anyone would be interested in trying to help me solve this. Basically its a C++ implementation of the algorithm outlined in this paper.


I feel like I'm pretty close to finishing it but there are some things I still struggle with.

I managed to implement a version that does calculate the solution but takes O(n^2) instead of O(n log n)

Gonna dump the rest or whatever if someone replies to this post. Maybe with e-mail/contact info

>> No.56065299
File: 331 KB, 474x432, 1430853197680.png [View same] [iqdb] [saucenao] [google] [report]

>muh lambdas

>> No.56065319

wtf I hate lambdas now

>> No.56065335

There's no difference and you're an idiot.

>> No.56065338

The origins of haskell


>> No.56065348

Shit, guess I better go write Ruby or some shit

>> No.56065352

why are these threads so shitty

>> No.56065361

Better ideas: Go, Python, Java, C#.

I can totally agree with wanting PHP to fuck off.

>> No.56065362

Your post is the shittiest part, kid

>> No.56065371

In one case you couple your data with methods sometimes. You use this pointers sometimes.

In the other you plan your software from the view of there being objects which are pieces of data which act upon themselves alone, you rely on objects for encapsulation, you write managers, you pass messages, you do a lot of stuff. If you don't do that stuff you're not doing OOP.

Maybe you should consider if you're the idiot.

>> No.56065383

Even better: Haskell

>> No.56065385

Another text for the truly dedicated Haskell user!


>> No.56065390

you're on 4chan

>> No.56065396

Even betterer: Elm

>> No.56065408

Explain to me why Python is bad.

...for web? I haven't heard of that being a thing.

>> No.56065411

well what have you done so far?

>> No.56065435


A thread's value is directly related to the amount of haskell posts.

Generally the more haskell there is in a thread the more shit posts and useless junk increases.

I blame the average haskell user's insistent urge to forcibly convert anyone around into their religion.

>> No.56065444

It seems we're solely talking about the semantics of the word object oriented now. You must love haskell.

>> No.56065474

I assume he's writing server-side code, given he originally mentioned C.

There's Spock and Scotty:


>> No.56065480


Optional is a nice addition, but like streams, a bit half baked.

I think Rust did a much better job of it, despite a considerable portion of language being nightmarish.

>> No.56065505

Nah I haven't even used it. But OOP is well defined, there's plenty of books on the programming principle. Maybe you can look at Wikipedia and educate yourself.

>> No.56065506

DESU the reason I'm annoyed by Haskell fans is they'll, on a regular basis, shit on other languages for just not being Haskell.

Like, people will say "I wanna use C#, is that a good idea?" and they'll get at least two responses saying
>no higher-kinded types
>no functional purity
>no Tail Call Optimization
>mutable state everywhere
"might as well use Brainfuck senpai"

I get it, your language is cool and you like it. Don't try to imply that it's literally the only language that could be considered good, though. That's bullshit.

>> No.56065523

Agreed. The bit that drives me nuts whenever I have to deal with Java code is that they didn't make Optional serializable. (Yes, I know, Java serialization is bad, I'm not always in control of whether I have to use it.)

>> No.56065568

Basically implemented the Pseudocode or whatever given there. But it doesn't seem to make any sense as it assigns values like this (might check that algorithm out in figure 2):
a[1] = 1
b[1] = n
last = 1
for (i=2;i<n;i++) {
if(somethingthatistruesometimes) {
while(j>=i aka never) {
if(j>=i aka never) {
} else {
b[last] = i-1
a[i] = i
last = i
end for

So j will always be < i as a always gets assigned the value of the previous iteration

>> No.56065577

No it isn't.
It's just stupid monkey wankery.

>> No.56065580

>is bad reddit
yes and you have to go back

>> No.56065587


I didn't know that (don't deal with serialization a lot, and mostly deal with null-everywhere legacy code), but I'm not seriously surprised by it, either. Apparently the Java Expert group considered and summarily rejected the idea.

Here's the rub:
>The JSR-335 EG felt fairly strongly that Optional should not be on any more than needed to support the optional-return idiom only.

I thought we were supposed to use these new fancy features on a design level? What happened to that?

>> No.56065601


It's literally a religious movement.

I mean it couldn't be more obvious:

References to various "Illuminated one" / Gnostic / Kabbalah concepts are everywhere in the language and its community.

>> No.56065609

I fucked up the indentation
a[1] = 1
b[1] = n
last = 1
for (i=2;i<n;i++) {
if(somethingthatistruesometimes) {
while(j>=i aka never) {
if(j>=i aka never) {
} else {
b[last] = i-1
a[i] = i
last = i

>> No.56065646

let me just ask this: why are you trying to implement this algorithm?

are you trying to solve a variant of knapsack problem, but it takes too much time and you decide to find a algorithm which performs better?

>> No.56065657

Perhaps it's best not to know the possibly Lovecraftian answers to those questions.

What I do know is it means I have to convert to and from representations of classes that use nullable fields instead of Optional whenever serializing/deserializing. Thanks, Java.

>> No.56065674

Just trying to implement a couple algorithm variants to solve it and then comparing their runtimes on different problem instances

>> No.56065676

>Illuminated one
Ah, the great Kmett.

>> No.56065712

>quantifying on show instead of showsPrec
Literally retarded.

>> No.56065714
File: 73 KB, 897x659, Screenshot_2016-08-13_22-24-16.png [View same] [iqdb] [saucenao] [google] [report]

which one is it that you're trying to implement?

cant find it

>> No.56065730

I just want a language where I can define the input and output of a program. Write the steps in between and it optimises for me.

For instance. Imagine I have a rather large structure and in that structure I have an audio sample. I have a large number of these structures. I decide I just want to make a simple reverb using these samples and output it into a circular buffer which has an associated write and read pointer.

The process of writing the reverb is stupid simple obviously. But since the samples are stuck in this structure I either have to change my structure or do tons of work while I wait on the memory fetching to have a decent running program.

Why can't I just tell it 'I'm gonna be using this stuff here' (samples, local variable reverb time and strength etc) and it ensures it's cache line efficient? Just restructure the data. I don't give a fuck.

Likely it'd create a SOA instead of an AOS as I described.

Instead of me having to do that and write code changes all over.

What languages let me do that? None? If that's the case then you all suck for discussing anything else frankly.

>> No.56065746
File: 56 KB, 822x748, fig2.png [View same] [iqdb] [saucenao] [google] [report]

Figure 2 which is the next one

>> No.56065763


I wasn't really referencing a specific individual within the haskell community. However, I was drawing parallels to various cults and religions. In that specific instance it was referencing the mainly Jewish / Freemason group commonly called "Illuminati".

Yes I'm accusing haskell of being a religious cult or at least heavily influenced by them.

>> No.56065791

Idris is probably the best language (that isn't a proof assistant) for that these days. You write the input and output types and it fills in as much as it can

>> No.56065798


Do what everyone else has already done and switch to C#. :)

>> No.56065801

alright. give me a few minutes

>> No.56065827

Ah, I see.

In that case, I think the analogy can reasonably extended by having SPJ be Abraham, and Kmett be Maimonides.

>> No.56065851

Made a new thread because fuck you :^)


>> No.56065856

why is it using the double version fabs when i call fabs with a float for fuck's sake?

>> No.56065862

There's no Scala or Haskell that runs on .NET yet, as far as I know...

The JVM has Scala and Frege, and I spend most of my time using them and not Java. Otherwise I'd have left the company years ago.

>> No.56065871


That could be a reasonable way to extend the analogy.

>> No.56065875


No, but there is F# is "fun"-ctional, as it were.

>> No.56065876

>the best they can do now is call Haskell a religious cult and circlejerk over how much they dislike it

>> No.56065897

Bump :^)

>> No.56065899

Il check it out. Thanks.

>> No.56065915

No HKTs, man. I know they're a meme but I can't bring myself to go back to a type system without them.

>> No.56065924

works with abs but not with fabs lmfao

>> No.56065926


>> No.56065927

Except this all started with a bunch of people shitting on Haskell for no legitimate reason
>bwaaaaaah why do Haskellfags keep defending themselves

>> No.56065932


>> No.56066054

see >>56066048

>> No.56067751

I'm not a autistically enough to understand this klingon speech.

Name (leave empty)
Comment (leave empty)
Password [?]Password used for file deletion.