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

If you can see this message, the SSL certificate expiration has been fixed.
Become a Patron!

/g/ - Technology

View post   

[ Toggle deleted replies ]
File: 2.17 MB, 1164x1738, code_master.png [View same] [iqdb] [saucenao] [google] [report]
67445114 No.67445114 [Reply] [Original] [archived.moe] [rbt]

Previous thread: >>67433775

What are you working on /g/?

>> No.67445131

Haskell is basically the minimum viable static language today

>> No.67445210

No, at the time there was a lot of money in lisp (like defense contracts kind of money) and, if I remember correctly they wanted Common Lisp to be as close to their particular flavors of lisp as possible.

>> No.67445216
File: 125 KB, 1600x874, 1536011816318.png [View same] [iqdb] [saucenao] [google] [report]


>> No.67445322

Is this programming?


Sorry for the pastebin, 4chan won't let me post code tags

>> No.67445334

i want to nakadashi iori

>> No.67445348
File: 47 KB, 848x480, police.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.67445351

Background radiation can flip bits in memory and fuck up computations, but what about computations in the middle of being run? Registers at each stage of a pipeline?

>> No.67445379

the fuck?

>> No.67445390

I'm getting undefined references when trying to link SDL2 with mingw. Any tips?

>> No.67445427

i want to nakadashi kohina

>> No.67445438

i want to gokkun your mom

>> No.67445513

In c lets say i want a recursive function like.

void funct0(int a, int b, void (**fPtr)(int a, int b, void (**fPtr)())) {
fPtr[0](a, b, &fPtr[1]);

Is there no way to explicitly tell the compiler that **fPtr() params are these params presently being parsed over.
Its not like i can write it out myself, it would go on forever.

>> No.67445613
File: 17 KB, 112x112, wutface.png [View same] [iqdb] [saucenao] [google] [report]


>> No.67445649


Learn about include and library arguments


Go here https://www.libsdl.org/download-2.0.php

Download the development libraries

Also download the runtime dll, and put it in the same folder as where you will run your exe.

>> No.67445712

Is python necessary?
Is C necessary?

>> No.67445725

no and no

>> No.67445727

Are you necessary?

>> No.67445728

I made a script to read all the lines in a python file (could be fairly easily adapted for other languages as well) and output the number of lines in the file.
I have 3 if statements here. It kinda irks me. Is there a better way to do this?
import sys

if len(sys.argv) != 2:
print("We take one argument and one argument only.")

f = open(sys.argv[1])

# Make a couter for the lines and read them
lc = 0
with open(sys.argv[1]) as f:
for line in f:
if line == '\n':
if line[0] == '#':
# If the line begins with a tab or a space, loop thru the characters in the line and see if it's a comment
i = 0
if line[i] == ' ' or line[i] == '\t':
if line[i + 1] == '#':
i = i + 1
lc = lc + 1

I'm a branlet n00blord who's learning python, no bully pls

>> No.67445742

get ready for bully

>> No.67445772

pls no ;_;
It's expected tho because it's not C.

>> No.67445786

I think I figured out my problem. I'm trying to use a 32-bit only compiler to build a 64-bit binary.

>> No.67445813

no and yes

>> No.67445829

You can clean it up with str.startswith and str.strip

>> No.67445832

Hi, guys. I learned JavaScript and get a job. Now it's time to learn a real language in a free time. Should i pick Rust, Dart or oCaml? O maybe something else?

>> No.67445835

C would warrant bully too

>> No.67445845


>> No.67445863

I'm developing a bot with microsoft bot framework and I need to open a url in a new tab at certain point, Neither Response.Write or Response.Redirect works, what should I do?

>> No.67445866

Wanna something used in real world apps so not considering Haskell and others like it.

>> No.67445873

Haskell is used in real world apps.

>> No.67445923

I seen only one haskell app (something like WSIWYG editor for lAtEx). And read in some reasonMl manual that oCaml is like haskell but allow side effects and can be used in real world apps.

>> No.67445931


>> No.67445950

Fuck yeah, we did it. I don't know why, but your post made me realize I was using the wrong architecture on accident. Thanks anon

>> No.67445954

Couldn't you do this with grep -vE "^\s*(#|$)" <file> | wc -l?

>> No.67445966

>oCaml is like haskell but allow side effects and can be used in real world apps
wow, that's almost completely wrong

>> No.67445968

I think he trying to learn more about python, not make the simplest line counter in existence.

>> No.67445982
File: 28 KB, 308x300, 1534558487041.png [View same] [iqdb] [saucenao] [google] [report]

no but me mommy and daddy love me and i wanna make them happy!

>> No.67446004

Good call. Should have checked if python had strip functions. Didn't even need the str.startswith
# Make a couter for the lines and read them
lc = 0
with open(sys.argv[1]) as f:
for line in f:
# Strip the line and check it
line = line.lstrip('\t')
line = line.lstrip(' ')
if line == '\n' or line[0] == '#':
lc = lc + 1

That's much cleaner

Certainly but I figured that making it in python would be a good way to learn a little more about it, a la >>67445968

>> No.67446010

the funny thing is you mentioned rust as a candidate. haskell's commercial/real world usage far outweighs rust's, and probably outweighs ocaml's (as much as inria love shilling it).

>> No.67446013
File: 98 KB, 824x412, here it comes.jpg [View same] [iqdb] [saucenao] [google] [report]

puts ARGF.readlines.reject { |l| l =~ /^\s*#/ }.length

>> No.67446037

This was mine

strip with no arguments strips whitespace

lc = 0

with open(sys.argv[1]) as f:
lines = f.read().splitlines()

for line in lines:
l = line.strip()
if l.startswith('#') or not l:
lc += 1

>> No.67446040

Firefox css engine is written in Rust. Facebook messenger (OMG how many users) is written in oCaml.

>> No.67446041

Why would someone want to learn more about Python?

>> No.67446051

Because they want a job. Pairing a scripting language with C++ gets you a job

>> No.67446056

if someone wants to get into machine learning

>> No.67446064

>scripting language
I'm not seeing it

>> No.67446075

>machine learning
a meme which I've heard is saturated at this point

>> No.67446080

It it better to learn FP in an OOP language that I'm familiar with, or to learn a FP language?

>> No.67446092

Learn an FP language. Trying to do FP in an OOP language will cause you to miss the point.

>> No.67446101

Is Haskell the best or?

>> No.67446121 [DELETED] 
File: 143 KB, 912x1009, 1535926333377.jpg [View same] [iqdb] [saucenao] [google] [report]

What if it was called expression oriented programming instead of functional programming

>> No.67446127

it's a fairly solid choice

>> No.67446139

OOPsies still wouldn't understand it and they'd desperately try to claim that expressions are objects

>> No.67446140

facebook use haskell to filter spam (OMG how many users)

they also use it for other internal things as you can see here https://code.fb.com/core-data/open-sourcing-haxl-a-library-for-haskell/

other companies using haskell include AT&T, Google, IMVU, Intel (they even developed their own compiler), Microsoft, NVIDIA (for in-house stuff)

>> No.67446147

Oh cool. That's good to know.
So the 'or not l' works because carriage return also counts as whitespace right? therefore line.strip() strips that too and leaves l as null?

It's easy, I'm a brainlet, I heard it's used for a lot of security-related stuff, and I need a scripting language that's not JS.

>> No.67446149 [DELETED] 

You can have objects in expression oriented programming thought

>> No.67446156

How does Haskell or Lisp get accepted by managers as the language for a project? There's a Raytheon project that uses Lisp for a missile defense system. How do you get a manager to sign off on that?

>> No.67446170

I personally like Scala. But Haskell is fine too. Also in 2018 you can go with ReasonML if you want to get into hype train.

>> No.67446257

speaking from secondhand experience (a friend at one of the big three console gaming giants) the best way is to take something that already exists and make it faster or better in the language you want to switch to, in this case, rewriting an internal tool in haskell

they don't seem to care much about consistency or obscurity, but it might be different at much smaller companies.

>> No.67446355

his point is that first class functions are often represented as objects in OOP languages, but there's no hard requirement that a function be an object.
All you need is to be able to pass around a function like any other variable.

>> No.67446538

my point is that OOPsies will stretch the definition of OOP until it's meaningless, as long as they don't ever have to learn anything else

>> No.67446871

>expression oriented programming
This is literally how I would describe what I do in C#.

>> No.67446885 [DELETED] 

What about declarative programming

>> No.67446895

What an inaccurate description.

>> No.67446908
File: 994 KB, 500x281, anal beads.gif [View same] [iqdb] [saucenao] [google] [report]

OOP is a meaningless term. OOP is defined as things you don't like if you want to feel smug, and OOP is defined as dubious claims of code organization by people who also want to feel smug. Fuck you, fuck people who love OOP, fuck people who hate OOP. I'm so tired of seeing these stupid opinions that frame context only to the point of pigeonholing people into a strawman mindset so you can feel smug.

Don't even fucking consider replying to me without a smug anime girl.

>> No.67446929

t. OOPset OOPsie

>> No.67447091


>> No.67447120

C# is yet another statement-oriented language

>> No.67447148
File: 42 KB, 500x225, bglisp.jpg [View same] [iqdb] [saucenao] [google] [report]

>> No.67447312
File: 13 KB, 265x265, DcpBzVlVMAEpvYv.jpg [View same] [iqdb] [saucenao] [google] [report]

FP and OOP are both okay as long as you're using the one that makes sense for your use case.

The problem is that people use FPLs because it makes them feel special, and end up writing horseshit code because the paradigm doesn't make sense for the project.

>> No.67447351

>FP and OOP are both okay
reminder that PL centrists are fucking cowards

>> No.67447364
File: 14 KB, 640x480, d0a.png [View same] [iqdb] [saucenao] [google] [report]

Do we need a /dpt/ version of this?

>> No.67447373

I doubt that the people it would be aimed at would understand it.

>> No.67447388

based bill

>> No.67447434

I agree. OOP never makes sense for any use case, so you should always use FP.

>> No.67447477

I've been writing stuff in Javascript for about 2.5-3 years. I just got a job that uses Python. I learned over about a week or so but still am not familiar with a few of the OOP concepts.

They aren't really training me or even giving me anything to do right now so I guess that means they want me to learn it myself. Would CS50 (Hardvard) be a good way to learn more python skills, or is it all babby stuff like "this is how to write a for loop"

If not what is a good course to take?

>> No.67447508

Is it autistic to name the services built into my embedded OS after anime girls

PL is another way of saying "I don't know how to use the advanced capabilities of my lang"
t. C dev

I have never seen this before but it's really fucking funny
Is not giving a fuck better than being a "centrist?" I still vote but I don't really know why anymore.

>> No.67447513

Try learn python the hard way. There's a "try learn python the hard way for free" link near the bottom under the payment stuff to buy the book. His presentation is a little rough and it's not for everyone, but it's the best straightforward no-bs intro to Python I know of and you can skip forward to whatever you want to see code examples of various concepts. OOP in Python is weird.

>> No.67447535

book's outdated. Written when Python 2 was still popular.
Also the author is well known to be full of shit.

use this instead:

>> No.67447542

I hope you understand that I don't take anything C devs write seriously.

>> No.67447554

A little outdated, sure, but that doesn't make it any less of a decent resource. Plus, iirc, most enterprise Python is still Python 2. At least in my experience.

>> No.67447573

nah, in my experience enterprise Python is "yo write this new internal tool that we're gonna throw away almost immediately after you make it, so just get back to us quick"
And since Python 2 is going to lose support in a year, there's no reason for anyone to be making new Python 2 shit anytime soon.

>> No.67447576

Ok. I'll check that out. There's no way it's weirder than OOP in Javascript (which some would say is technically not OOP due to prototypical inheritance)

>> No.67447579

if you're too much of a brainlet to make anything remotely sophisticated in C, that's fine with me

>> No.67447596

Depends on his needs I guess. We have Python 2 tools that'll be in service probably past the loss of support date until I get around to replacing them. Yeah, new material should be in Python 3.

>> No.67447603

My C days are behind me. (I used to work in it.) I prefer using a language with a bit more intelligence these days. I doubt you're capable of using anything other than C, though.

>> No.67447620

My job uses Python 2 and Django 1.

>> No.67447640

in that case you may want to look into using Python 3 with the Six library; it's intended to be used to write code that will work in either Python 2 or Python 3.

No sense in wasting time locking yourself into poorly designed fossil shit.

>> No.67447683

>don't use java, use c#
>don't use python 2, use python 3
>don't use javascript, use typescript
>don't use <shitty thing>, use <shitty thing>

>> No.67447709
File: 1.25 MB, 1500x1015, 1479888584459.png [View same] [iqdb] [saucenao] [google] [report]

>inb4 anon tells us all to use his shitty gold plated thing

>> No.67447730

I use C, C++, and Python at work, so those are the langs I'm most familiar with, but I also have around a thousand hours' experience each on Java and Kotlin.

C++ can be a massive pain in the ass for embedded stuff, primarily because of the fact that you have to turn off a decent chunk of the lang's features to make it remotely suitable for embedded (e.g. RTTI and exceptions).

Python is a necessary evil- the syntax is broken and it's disgustingly slow, but it's brutally simple to throw shit together in Python so it's nice for stuff where speed doesn't matter (e.g. I have a python script that deploys binaries to some PLCs then talks to them over Modbus TCP to run tests).

>> No.67447905
File: 55 KB, 800x670, 1535784903542.jpg [View same] [iqdb] [saucenao] [google] [report]

Is $80k/year a good lowball for a remote software engineering job? I live in a low cost of living area so I don't care as much about salary. The company is based in SF.

>> No.67447913

Someone asks you to make a command line utility that lists the lines in alphabetical order from one file that don't exist in another file. Can your language do it more elegantly than this?
import System.Environment
import Data.Function
import Data.List

main = do
args <- getArgs
prog <- getProgName
case args of
(x:y:[]) -> do
f1 <- readFile x
f2 <- readFile y
mapM_ putStrLn $ ((\\) `on` nub . sort . lines) f1 f2
_ -> putStrLn $ "usage: " ++ prog ++ " file1 file2"

Hard mode: It must also be a compiled language.

>> No.67447927

Why mapM_ and not traverse_?

>> No.67447958
File: 976 KB, 1280x720, autism.png [View same] [iqdb] [saucenao] [google] [report]

How much of a pain would be to create a video player from complete scratch in C, without using any external libraries? My autism is kicking in, making me think like an impostor for using external libraries/APIs for projects.

>> No.67447965

Only because I didn't want to import Data.Foldable as well. I guess I could have done it without Data.Function either but I just feel like `on` gives it so many style points

>> No.67447989

Depends how many formats you want to handle.

>> No.67448003

I want to start basic, and just handle mp4(First project of this kind).

>> No.67448033

* Your "lc" declaration could be moved lower.
* You can invert the condition and replace "continue" with the increment.
* You really only need ".lstrip()", but I wouldn't hold that against you.

I didn't test this, but it should work:
lines = pathlib.Path(sys.argv[1]).read_text().splitlines()

print(len(line for line in lines if line and not line.lstrip().startswith("#")))

cloc <file>

>> No.67448042

if ARGV[1]
puts (IO.readlines(ARGV[0]) - IO.readlines(ARGV[1]) ).sort
puts "usage: #{__FILE__} file1 file2"


>> No.67448051

looks pretty nice, anon!

anon said to do it elegantly

>> No.67448061

Small (potential) bug: lines that consist of just whitespace (but aren't empty) are counted. I'm not sure if OP wanted that or not.

>> No.67448092

public static void main(String[] args) throws Exception {
Path a = new File(args[0]).toPath();
Path b = new File(args[1]).toPath();
Set<String> lines = Files.newBufferedReader(b).lines().collect(Collectors.toSet());
.filter(l -> !lines.contains(l))

>> No.67448097

| wc -l

This is what grep's "-c" is for.

>> No.67448125
File: 59 KB, 900x960, 18620062.jpg [View same] [iqdb] [saucenao] [google] [report]

What the fuck is so elegant about this code? Where is the filesystem error handling? Are f1 and f2 even stack-allocated? Where did you specify whether it's going to be on the heap or stack? Where's the buffer size? What sorting algorithm has been used here?

How the fuck is this literal amateur hobbyist garbage considered `elegant`?

Indeed, people that don't use C++ or Rust don't know how it feels to be in the cockpit.

>> No.67448139

fp tards think elegance = less lines

>> No.67448163

OOPsies have no appreciation of beauty

>> No.67448173

>muh OOP boogeyman
LMAO kid

>> No.67448212

t. increasingly desperate OOPsie

>> No.67448217
File: 172 KB, 500x506, IMG_2007.gif [View same] [iqdb] [saucenao] [google] [report]

c-c-can C friends join too? We explicitly specify the stuff gets allocated too

>> No.67448235

Only C11 friends allowed

>> No.67448241

how stuff gets allocated* oops

t. arrogant fp dickrider

>> No.67448254

Let me guess, you'll accuse me of being part of the "toxic FP community" next?

>> No.67448270

>t. increasingly desperate OOPsie
I knew it.

>> No.67448277

Go crying back to Java, then.

>> No.67448286

I want to learn a lower level language. Would I get more mileage out of C or C++?

>> No.67448292

Java paid my bills, not NEETkel

>> No.67448317
File: 1.07 MB, 1280x720, 396.png [View same] [iqdb] [saucenao] [google] [report]

that's perfect desu
I think we should also accept the GNU11 extensions

>> No.67448320
File: 30 KB, 534x534, dying-laughing.jpg [View same] [iqdb] [saucenao] [google] [report]

A Java wagie? This just gets better and better. Hilarious seeing OOPset OOPsies run around frantically trying to implement their manager's inconsistent, incoherent requirements

>> No.67448335

Learn C. C++ if you like spaghetti.

How many dicks do you consume, on a daily basis?

>> No.67448348

>error handling and resource management are incoherent requirements
No wonder you didn't make in the preliminary.

>> No.67448351

Oh boy. That's just the cherry on this whole bait cake you've constructed. Why don't you just post your implementation so we can all laugh at it?

Re: Error handling:
test5.txt: openFile: does not exist (No such file or directory)

>> No.67448362

keep dreaming that I'd ever lower myself to work with you, lmao

>> No.67448364

Oh, and here's the sorting algorithm you're so concerned about:

>> No.67448380
File: 201 KB, 1920x1080, 2018-09-04-1536032409_screenshot_1920x1080.jpg [View same] [iqdb] [saucenao] [google] [report]

am I a programmer now?

>> No.67448383

That's not error handling, that's just printing out an error message.
>One of the cannot be read
Result should be the contents of the other file
>Both cannot be read
>don't print anything

Log them both.

Where are the strings allocated? And what was the i/o buffer size?

>> No.67448386

>not using CRowViewCL
no, you are not a programmer

>> No.67448387

if the shoe fits

Both are good, but if you truly want bare metal programming, C is the better option. You have to disable a lot of features of C++ to make it a true lower-level language (RTTI, for example). That said, C++ is usable for low-level stuff- I'm writing an OS in it right now.

>> No.67448398
File: 20 KB, 431x267, gq4ec.jpg [View same] [iqdb] [saucenao] [google] [report]

>Where are the strings allocated? And what was the i/o buffer size?

>> No.67448399

why the fuck would you want to do that

>> No.67448404

To have a more complete skillset

>> No.67448408

brainlets here recommend C because it's all they know and unfortunately newbies fall for it

>> No.67448417

hasklel is a language for cucks, you can't even control where you store data and buffer size.

>> No.67448418

>won't post his implementation
We know you can't do it, no need to make yourself look stupid by continuing to whinge on about the few programming terms you do know.
Also your solution is braindead retarded. If one file can't be ready the program should exit! Let me guess, you subscribe to the Javascript theory of "the program should continue running no matter how many errors there are"?

>> No.67448423

>I am a good programmer because I focus on details irrelevant to the problem

>> No.67448429

What do you recommend?

>> No.67448431

c niggas make fun of Car car = new Car(); but still be allocating memory everytime someone moves the fucking mouse pointer

>> No.67448441

Debugged a major race condition within my company's codebase that has surprisingly been around for at least a decade. I'll have to talk to the more senior architects about my proposed solution and what they think about it, but holy shit. You guys seriously have nothing to worry about with job interviews. Just keep trying. There are TONS of fucking idiots that occupy SE3/4 positions in normie-tier industries (excluding something like Defense programmers; those mofo's have to program missile guidance and can't be wrong or slow).

>> No.67448458

> thinking functional is somehow inferior
> meanwhile, scientific data research relies heavily on things like FORTRAN which is purely functional in nature
Into the trash it goes, C++ purist.

>> No.67448459
File: 289 KB, 1920x1080, Tom-Cruise-Laughing-Face-Closeup.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.67448466

>We know you can't do it
I won't do your homework
>"the program should continue running no matter how many errors there are"?
Programs should continue if the errors are recoverable and logical. If you see a non trivial program (I know it's hard to fathom for an fp turd) you will see a whole bunch of error messages are printed in the loggers.

Yeah try your cute script with files with terrabytes of data in it.

>> No.67448471

Honestly? Hard FP.

>> No.67448476

c is a language for cucks, you can't even control where you store registers and page size.

>> No.67448484

Then hasklel must be for the bottom-of-the-barrel cucks.

>> No.67448488

Trying AoC2017. So far I manage to get gold star till 5th day. Enough for today., 10 puzzles made my head dizzy.

>> No.67448490

>b-but if you change the problem then the requirements change and your solution might not work any more!
>n-no, it doesn't count if the problem changes in such a way that my solution no longer works
>h-haskell b-btfo!
>s-stop being toxic!

>> No.67448510

Stop stuttering nonsense, you low energy beta faggot.

>> No.67448511

>just shove the error in the log and continue
fucking hell, do OOPsies really program like this? betcha try to continue after malloc fails too

>> No.67448512

can whoever the FUCK keeps shilling FP in every other post please suck my fucking nuts you bitch

>> No.67448521 [DELETED] 
File: 1.21 MB, 1280x720, New Game! 555 (JV).webm [View same] [iqdb] [saucenao] [google] [report]

in c++ this is just

assert(argc > 2);
const String doc1 = pathDump(argv[1]);
const String doc2 = pathDump(argv[2]);

const auto lineSet = ( ListStream( doc1.split('\n')) | Fold( [](const auto l, const auto t) { return t.push(l);}, Tree<String>()) ).get();
const auto uniqueLines = ListStream( doc2.split('\n')) | Filter( [&](const auto l){ return lineSet.contains(l);}) | CollectList();

std::cout << mergeSort(uniqueLines) << std::endl;

>> No.67448524
File: 45 KB, 384x288, 1499286989890.jpg [View same] [iqdb] [saucenao] [google] [report]

>says he won't do my homework
The absolute state of OOPsies folks. When you can't solve a problem just spout "muh memory management" and "muh allocation" and hopefully people will just forget that you're a retard

>> No.67448528

You have nothing of any substance remaining, I see. I graciously accept your concession.

you seem a little OOPset

>> No.67448537

But what if the files contain terabytes of data, anon? You'll run out of memory! Clearly your solution is completely invalid.

>> No.67448543

>>just shove the error in the log and continue
Yes, because that's the logical thing to do.
Too bad your teacher is not looking for a NEETkel script

>> No.67448552

>Yes, because that's the logical thing to do.
This explains why OOPsie software is so buggy and broken.

>> No.67448553

god bourne shell and its derivatives are ugly

why was this shit even designed like that

>> No.67448561

As compared to non existent FP turd applications?

>> No.67448565

earth bytes? thinkingface

>> No.67448573

Don't make me post the link.

He may not understand the problem being solved, but he understands malloc and he's going to make sure that we know that he does!

>> No.67448589

You don't work in any competent industry to be commenting like that, fa/g/got.

>> No.67448593

it's so clear that they're still bitter about failing the one mandatory intro to FP class in their degree

>> No.67448602

Competent industry does not require any more FP turds, there's already JS for that.

>> No.67448629

You have never programmed a missile guidance system, then. You utter faggot. Just shut the fuck up with your bullshit. You are still young. You will learn...hopefully.

>> No.67448637

>mandatory intro to FP class
You mean the CS101 classes where they teach hello world with JS? LMAO

>> No.67448642

Not sure if you're still here, but I'll try to explain anyway. The tinyscheme interpreter is a c program that takes a scheme program as a string and parses/executes the scheme program. You can compile the interpreter as something that reads and runs a specific string -the scheme source code- instead of the usual REPL. That way the source code -scheme- is embedded inside the interpreter source code -c- and can be executed without dynamically linking to an interpreter. The downside to this is that you have to include a copy of the interpreter in every program that you distribute, although it's not that bad since tinyscheme is only about 200K, it feels more like a library than anything. So in the interpreter code you see:
print(eval(read("(display 5) (newline)")));
instead of:
while(!eof) {

>> No.67448656

>a missile guidance system,
No sign of FP there too, buddy.
The so called FP is simply not useful or practical.

>> No.67448666

>hello world with JS
You failed THAT? I didn't think my opinion of you could sink any lower.

>> No.67448675

sweet OOPsie tears
>i-it's not practical!
>i-it's not useful!
>why can't it be the 90s again?????

>> No.67448681

> hasn't ever touched code dealing with guiding missiles
> proceeds to provide opinion on how the code *would* be structured
Just stop, anon. You're a namefag of utter proportions. FORTRAN is heavily used in Defense industries. You don't know what you're talking about and every time you get an idea to type away at your Cherry MX Red keyboard, you make it more evident.

>> No.67448700

What about FORTRAN is FP exactly?
Stop stuttering you weak-ass fucking homo.

>> No.67448709
File: 177 KB, 800x1000, muh buffer.png [View same] [iqdb] [saucenao] [google] [report]


>> No.67448710
File: 22 KB, 782x790, republic.png [View same] [iqdb] [saucenao] [google] [report]

>functional programming

>> No.67448715

do while (n <= 10)
nfact = nfact * n
n = n + 1
print*, n, " ", nfact
end do

>> No.67448722

>stop bullying me!
>the FP community is toxic!
>I wish my skills were still relevant

>> No.67448729
File: 210 KB, 522x747, 1521929101633.png [View same] [iqdb] [saucenao] [google] [report]


>> No.67448734
File: 45 KB, 475x357, bill.jpg [View same] [iqdb] [saucenao] [google] [report]

All shitposting fuck off to /wdg/
this is /dpt/, post daily programming or don't post

>> No.67448736

I don't think anybody will ever accuse you of being a functional programmer. A dysfunctional one, perhaps.

>> No.67448738

Who are you quoting?

>> No.67448746

Thanks, I'll be using a do-while loop in my functional programming aka CS101 class LMFAO

>> No.67448747

reminder that OO"P" isn't programming and imperative "programming" isn't programming

I didn't think my opinion of you could sink any lower.

>> No.67448751

I come to these threads to see if anyone is working on interesting projects and its always just cs homework and stupid riddles(which is probably some anons cs homework)

doesn't anyone do cool shit in their spare time?

>> No.67448752

I can never think of any cool ideas for a program
so I never write any programs even though I should be building a portfolio for after I graduate
am I fucked?

>> No.67448759

And you'll fail it all over again. Hope your pillow will be able to absorb all your tears

>> No.67448762

It's closer to Functional Programming than your precious C++, faggot. You apply transformations to basic data containers and analyze the outputs or apply more transformations to the outputs. Very much akin to lambda calculus (i.e. the inception of Functional Programming).

>> No.67448764

>I didn't think my opinion of you could sink any lower.
I honestly don't care what a jobless, clueless, angry and frustrated NEET who just lost an argument on /g/ thinks really

>> No.67448776

I don't see a problem with expressing a recursive process through a stack and a while loop.

>> No.67448777

Oooooh, you mean passing a fucking lambda to an STL container
Oh boyo we /FP/ now LMAO

>> No.67448784


>> No.67448792

To whom are you referring? Yourself? No wonder you're so flustered if you think so little of your own opinions, man!

>> No.67448798

You see, as in the example itself, it hurts your "purity" which is supposed to be a big no-no for fp turds afaik. You must avoid volatile states and side effects.

>> No.67448802

Except you don't have to spend endless hours programming the nonsense like an info event loop or the object inheritance tree simply to get a fucking array full of floating point values to output what the transformation was going to be doing regardless of language. You just don't understand how to live outside the rigid world of boilerplate code to manage memory.

>> No.67448807

I actually agree with you here. Doing "ooh maps and filters and maybe even folds" in an otherwise imperative language isn't FP.

>> No.67448814

Then you understand nothing of FP.

>> No.67448821

I've only done C# and web stuff so far. What should I learn next? C? C++? FP?

>> No.67448822
File: 1.61 MB, 3840x2160, 1535633668576.png [View same] [iqdb] [saucenao] [google] [report]


>> No.67448830

Agda honestly

>> No.67448831

>web stuff so far
So you already did FP, with JS.

>> No.67448836

Does mapping JSON data count as FP?

>> No.67448842

No, because JS isn't functional. How sad that you know so little.

>> No.67448843

Nah, that's a little to useful to be real FP

>> No.67448847
File: 2.46 MB, 5198x2124, all.png [View same] [iqdb] [saucenao] [google] [report]

It'd be nice if people would work on a project, post it here, express a few opinions, and then leave to work on another project to eventually post here. Instead you see language shilling over project shilling.

pic related faggots

>> No.67448851

JS is a language for parrots.

I see your ignorance does not decrease.

>> No.67448858

OwO whats this

>> No.67448868

Let's just get some fucking shit clear. The following languages are not functional:

>> No.67448873

But we /LENS/ too :^(
Let me into your cool an hip fp mancave
const assert = require('assert');
const R = require('ramda');
const { Maybe: { Just, Nothing }
, Tuple
} = require('ramda-fantasy');

const { Getter
, Setter
, Lens } = require('..');

describe('Lens', () => {

const fooLens = Lens.atObject('foo');

it('can view exactly one focus', () => {
Getter.view(Lens._2, Tuple('foo', 42))));

Getter.view(fooLens, { 'foo': 1 })

Getter.view(fooLens, { 'bar': 1 })

it('can update exactly one focus', () => {
Tuple('foo', 42),
Setter.set(Lens._2, 42, Tuple('foo', 0))

{ 'foo': 5 },
Setter.set(fooLens, Just(5), { 'foo': 1 })

Setter.set(fooLens, Nothing(), { 'foo': 1 })

it('can be composed with other optics', () => {
const l = R.compose(Lens._1, Lens._2),
t = Tuple(Tuple(true, 42), 'foo');

Getter.view(l, t)

Tuple(Tuple(true, 43), 'foo'),
Setter.over(l, R.inc, t)


>> No.67448882
File: 57 KB, 1280x720, 1516011803445.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.67448895

Says the CS-grad that has yet to land his first programming job because they are too shit of a person to pass the personality portion of every interview they participate in. Enjoy the NEET life, faggot. I truly hope you one day reach some modicum of success. Not too much success, though. Your actions here warrant you a layer in hell for your treachery towards those truly interesting in progressing.

>> No.67448907

To me the most important part of the methodology of FP is building a new thing from scratch using an older thing instead of trying to mutate the older thing into the new thing.

>> No.67448914

Doesn't matter. JS is not functional.

>> No.67448923

So far my college classes taught me python and javascript, starting c++ on wednesday.
Is this a good regimen or is it fake and gay?

>> No.67448927

FP is about functions.

>> No.67448929
File: 5 KB, 395x128, index.png [View same] [iqdb] [saucenao] [google] [report]

Oh crap, did I go too hard on you?
Nevertheless it always gives me pleasure to see a dpt nigger break.

See pic

>> No.67448947

First class functions are important; they're just not the be all end all of what makes FP FP.

>> No.67448948

Getting frustrated won't make JS functional.

>> No.67448951

> If I tell people they lose, then they've lost
Still didn't refute that you're still jobless. Nice try though, faggot.

>> No.67448958

You do know what the F in FP stands for, right?

>> No.67448959

How much harder is it to get a job in programming without an education related to it? Education here is free but I sort of feel like just working 50-60% and studying on my own if it's realistic that I'll eventually get a job within the field

>> No.67448967

"Considered harmful"? To yourself?

>> No.67448969

> t. someone who doesn't understand Lambda Calculus and the fundamental principle that functions are expressions (i.e. first-class)

>> No.67448979

if people with degrees can have trouble finding jobs then your chances without one are astronomically low. you'd need to have a god tier portfolio,luck and a bit of networking to even stand a chance.

>> No.67448984

But JS IS functional. You just don't want to associate with JS because FP attracts brainlets
const lam = require("lambda-calculus");

// Parses an input with the "Wikipedia syntax". The lambdas are optional
const input = lam.fromString("(λa.λb.(a (a b)) λa.λb.(a (a b)))");

// Computes the result using native JS functions
const output = lam.reduce(input);

// Print the result
console.log("Result: "+lam.toString(output));

// Print the result as bruijn
console.log("Result (in bruijn): "+lam.toBruijn(output));

// Print the result as binary
console.log("Result (in binary): "+lam.toBLC(output));

// Print the result as base64
console.log("Result (in base64): "+lam.toBLC64(output));

>> No.67449005

It's not functional. Restating an incorrect claim won't make it so.

>> No.67449043

>implement lambda calculus in C
>apparently this means C is functional

>> No.67449062

Hasklel compiler is implemented in C down under too,

>> No.67449068

why waste time posting cool shit when you can argue about fizzbuzzes and functional programming

>> No.67449072

Do you come from a land down under?

>> No.67449074

what's a lambda?

>> No.67449083


>> No.67449084


>> No.67449086

>the state of FP cucks

>> No.67449089

If the OOPsies would learn then we wouldn't have to keep explaining basic things to them

>> No.67449096

I'm sure you wish that were true, OOPsie.

>> No.67449107

> thinking the reason degree people are struggling is anything other than networking
Anon, I have some news for you. It's all about networking in this day-and-age. Once you get your first job, it's substantially easier, but getting that first one is almost always due to the people you know. So go outside, meet new people, and start to learn how to socialize and build a professional network.

>> No.67449117

hmm yes, I see. but can *reaches hand into toilet* your FP language *pulls out a fresh turd* do this??? *bites into turd* didn't think so! *licks lips* it's just *takes another bite* not practical *finishes it off* in the real world! *wipes shitty mouth on shirt*

>> No.67449128
File: 103 KB, 842x633, 1524541394279.png [View same] [iqdb] [saucenao] [google] [report]

Well I think my job here is done. Time for me to go back and see my account has been deposited with 5 rupees with which I will proceed to take a spicy curry bowl whereupon I'll go to the loo and have a big laduzi.
Mods ban me again for 3 days

>> No.67449167

Based and redpilled.

>> No.67449168

Post what you guys are working on

>> No.67449196

A purchasing server for a steam game but I haven’t started yet. I’m trying to decide between elixir, Kotlin or clojure for it. It shouldn’t be too complicated but I’m worried about reliability and performance. I’ll probably go with vert.x and kotlin

>> No.67449206

Extending a curses library. So far I have managed to clone `more`

>> No.67449276

Clojure or Haskell or something else?

>> No.67449302

dumb frogposter

>> No.67449348 [DELETED] 

Just finished reading this book.
Monads aren't burritos, you liars!

>> No.67449361
File: 89 KB, 627x114, haskeller.png [View same] [iqdb] [saucenao] [google] [report]


>> No.67449362

What book?

>> No.67449367
File: 169 KB, 333x500, 1534602116620.png [View same] [iqdb] [saucenao] [google] [report]

Just finished reading this book.
Monads aren't burritos, you liars!

>> No.67449374
File: 818 KB, 1280x719, karen haskell.png [View same] [iqdb] [saucenao] [google] [report]

the one that teaches you Haskell
the Bible

>> No.67449380

Is that book actually worth it? It's so fucking long

>> No.67449388

the Bible? yeah

>> No.67449398

Depends how much material you need to learn and master certain topics.

>> No.67449409

it's not long if you just do the exercises (which is the good part of the book, imo)

>> No.67449458

Have you looked into Perl? There's safe and unsafe ways to write Perl. I find it complements C well, but there's a fair amount of boilerplate and getting used to some of it's syntax for references within references.

I've used socket objects to listen over the network and write a nightly builder based on it. (incron->nc->perl listener->batch/shell file runner). My file version had using a ramdisk and a ton of other stuff we had to do in our environment (suffixing for failed builds, subversioning of a file was submitted twice). We used zipped code bundles, and a master->version->patch architecture. Required a lot of handwork, but the autocompiler worked well. I even wrote a tail function for part of the logger. (we could build any number of things, some would fail, while other's succeed).

The worst part is Perl capitalizes the environment variables - not a problem on Linux, bullshit motherfucking garbage on Windows. There's a way around it, I wrote it at work and it's simple enough to rewrite at home I've just been lazy.
>gather up your environmental variables
>re-apply them at the start of every perl system or eval or whatever call

>> No.67449654

How viable is it to develop a game in a functional language, setting aside performance concerns? Games seem to be inherently very stateful.

>> No.67449660

I just pooped :D

>> No.67449677

>How viable is it to ... in a functional language

>> No.67449688
File: 30 KB, 766x162, left_fold.png [View same] [iqdb] [saucenao] [google] [report]

Does anyone like my cute fold function?

>> No.67449715

It's not Hasklel, it's Elixir which is just Erlang and Erlang gets shit done.

I guess another way to phrase my question is "how much of a pain in the ass is it to do gamedev with restricted mutable state?"

>> No.67449718

reading this:

>> No.67449735
File: 34 KB, 123x200, Its+all+about+mitchell+_f97ab871ad7bdc395d4da9bedbdd419b.png [View same] [iqdb] [saucenao] [google] [report]


>> No.67449759

pretty viable, there's definitely no problem with state, the only problem is GC could limit the game somewhat

>> No.67449872


>> No.67449993

Reminder that Cniles have been utterly, unrecoverably BTFO. >>67418552

>> No.67450014

Yes, of course, let's blindly attack some languages and defend some others like a nigger.

>> No.67450082
File: 89 KB, 700x548, 47812347823.jpg [View same] [iqdb] [saucenao] [google] [report]

>library doesn't follow your code conventions

>> No.67450105


Just fine as far as I can tell. I made this game in Elm, which is really similar to Haskell (but much simpler):

www chadtech us/orbiter-13/

>> No.67450126


>> No.67450141

>setting aside performance concerns
Deep-copying everything that changes, every single time it changes, is not a small thing to worry about Anon.

>> No.67450163


>> No.67450177

If you are making use of OpenGL with shaders then most of the actual computation can be offloaded to the GPU. Thats not to say its a good idea but it can be done.

>> No.67450360
File: 49 KB, 665x574, 1493620026971.jpg [View same] [iqdb] [saucenao] [google] [report]

Let's say you wrote something that works and is fast, but it's only fast because of a compiler optimization. If that optimization is disabled, the function runs 10x slower.
Is this a sign of bad design?
I can refactor it to be the same speed regardless of the compiler options, it seems like that would be more technically correct, but requires more code for the same effect.

>> No.67450396

There is no point in not using optimisations if they're available (excluding for debugging, etc.).
Also, a good chunk of what it takes to write efficient code these days is writing something that allows the compiler to make it really efficient. You don't need to fuck around with minor little speedups that the compiler would just do anyway.

>> No.67450397

The binaries for the embedded systems that I work on don't even fit in debug mode.
We can only properly debug in simulation.

>> No.67450414

That sounds like a disaster waiting to happen. Good luck Anon

>> No.67450483

It actually works surprisingly well, as we keep most code MCU-independent.
It does bother some of our more junior colleges.

>> No.67450579

MYSQL optimization

If we have two HUGE tables:

>client_id (new column)



How do I best make it so I fill in l the client_id based on client_number? This takes days if I just do a regular update, since both tables are huge and for every row it has to go through all of the other table to look it up.
Basically I have this new Clients table where I want to move all the client info, that was earlier in the catch-all table Sales, and I want to match IDs in the new column to delete the other ones. The field to match is client_number.

>> No.67450590

Depends on what kind of optimization.
If the program is badly designed, though, no optimization will save you.

>> No.67450608

Newfag des should I learn C or Python first? Or some other language?

>> No.67450615


>> No.67450616

Learn Nim

>> No.67450619

linking libraries is 100x harder on waangblows

>> No.67450628
File: 1.98 MB, 400x250, 4981234218423.gif [View same] [iqdb] [saucenao] [google] [report]

>copy paste libraries
>#pragma comment(lib, "mylib.lib")

>> No.67450644

Design your database better

>> No.67450665

>that CUTE little twitch
ommgggggg :33
can I save this gif file????

>> No.67450695

>how to fix an inherited bad database?
>go back in time and prevent its design

Whoa, thanks #redpilled

>> No.67450851


>> No.67450880 [DELETED] 
File: 614 KB, 1000x1000, .png [View same] [iqdb] [saucenao] [google] [report]

tfw first pull request merged

>> No.67450938


>> No.67450997

That shit feels great. Then you do it again, but it doesn't quite have the same effect.
Then you need to make larger and larger PRs just to get the same hit as before.
Eventually, it gets so bad that you accidentally become the maintainer of at least part of the project.

>> No.67451288

C is outdated garbage, don't bother.
To start out, I'd say Java or Python. Then check out C++ if you're interested.

>> No.67451331

This is literally the stupidest and memeiest response you could have given.

>> No.67451339

C++ is superior to C even for embedded, many useful features like templates, namespaces, classes, passing by reference, better const correctness and stricter type system don't require any runtime support.
Not to mention that all this extra information the compiler has allows it to potentially better optimize your code.
The only reason to prefer C to C++ is when your platform doesn't have a C++ compiler.

>> No.67451350 [DELETED] 
File: 56 KB, 305x454, 1531789121089.jpg [View same] [iqdb] [saucenao] [google] [report]

ultimate progression path
C (memory management and the fact that types exist) -> python or javascript or even haskel (learn what an elegent program and concepts can look like) -> c++ combine the two

>> No.67451355

Excellent arguments. I feel totally defeated.

>> No.67451365 [DELETED] 

who the fuck usses RTTI and exceptions are entirely optional
wrapping C libs in raii and type safety is obviously worth it even if you treat c++ like c with classes

>> No.67451703

RAII without exceptions doesn't work very well in C++. You might even argue that the purpose of RAII is to make exceptions usable.

>> No.67451749
File: 69 KB, 696x1076, 642d3a1c733081c2ad55ef750eae819b.jpg [View same] [iqdb] [saucenao] [google] [report]

using System.Linq;
using static System.Console;
using static System.Diagnostics.Process;
using static System.IO.File;

class Program
static void Main(string[] args)
if (args.Length != 2)
WriteLine("Usage: {GetCurrentProcess().ProcessName} file1 file2");
var result = ReadAllLines(args[0]).Except(ReadAllLines(args[1])).OrderBy(s => s);
foreach (var item in result)

>> No.67451766

whats the best database to use for a cryptocurrency exchange? (all of the matching engines are closed source and no way am i paying for nasdaq's one) so im developing my own...

I need around 10-15ms latency for single writes and reads. im writing this in go btw so ideally a db with a go driver.

>> No.67451798

you forgot $ for string interpolation

>> No.67451859

What the actual fuck? Do you have any clue what you're talking about?

>> No.67451945

I'm not hearing an argument chum.

>> No.67451966
File: 100 KB, 480x640, 1534908126328.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.67452087

im getting the same thing with g++ on linux. I normaly dont use the command line for compiling code. i normaly use eclipse.

heres the code:

~/eclipse-workspace/SDL2 RPG$ g++ ./src/'SDL2 RPG.cpp' -std=c++1y -w -lSDL2 -lSDL2_image -lSDL2_mixer -I ./src/ -o 'SDL2 RPG'

also any tips for setting up SDL2 or c++ in sublime text ? it looks really nice imo alot better and more functional than eclipse.

>> No.67452106

-Get a real build system.
-Use pkg-config to find your libraries (although a good build system will do this for you).
Also, nobody can tell you what libraries you're supposed to link if you don't give the compiler error.

>> No.67452144

the thing is i already know where they are they are located in


i just need help setting it up on g++.

i also already works on my eclipse i just need help and have to find a way to include my class header files located in the same folder

>> No.67452201

>the thing is i already know where they are they are located in
You really shouldn't get in the habit of doing things extremely specific to YOUR system.
It's extremely fragile and will fuck you over when someone else tries to build it or your compilation environment changes. It's part of the reason that I think building shit with IDE-specific tools is stupid and proper more general build systems should be used, but this is getting besides the point.

>i just need help setting it up on g++.
You are not giving any useful information at all.
What does the compiler actually output when it fucks up?

>> No.67452221

That's not very elegant.

>> No.67452246

Not from you either.

>> No.67452264 [DELETED] 

So does C++.

>> No.67452275

collect2: error: ld returned 1 exit status

and a fuckload of undefined reference to classes i made in seperate files.

>You really shouldn't get in the habit of doing things extremely specific to YOUR system.
It's extremely fragile and will fuck you over when someone else tries to build it or your compilation environment changes. It's part of the reason that I think building shit with IDE-specific tools is stupid and proper more general build systems should be used, but this is getting besides the point.

got a link that could help me on this.

>> No.67452281

Every language requires you to specifically allocate memory.
But not necessarily deallocating.

>> No.67452292

I love C.

>> No.67452295

New thread: >>67452293
New thread: >>67452293
New thread: >>67452293
New thread: >>67452293

>> No.67452299

RAII is the management of resources by use of constructors and destructors.
Constructors are useless without exceptions because there's no sane way to indicate an error without one.
The main reason for using a destructor is to ensure resources are released whenever a function exits, including when the function exits due to the stack unwinding during exception handling. In the absence of exceptions the control flow becomes much easier to comprehend and it becomes tractable to just insert close functions at the end of function scopes.

RAII and exceptions form a circular dependency. It's additional complexity that is justified by additional complexity that is justified by additional complexity.

>> No.67452300

/dpt/ is ded

>> No.67452302
File: 103 KB, 1280x720, 1406803019377.jpg [View same] [iqdb] [saucenao] [google] [report]

Don't post before the bump limit, you fucking moron.
Delete your invalid thread.

>> No.67452307
File: 29 KB, 257x320, smug_loli.jpg [View same] [iqdb] [saucenao] [google] [report]

Make me.

>> No.67452325

Why is Iori such a qt? I love her.

>> No.67452432

You can just use an output parameter, and at that point it's no worse than an error code.

>> No.67452482

But it's also no better. If you can construct your object without it actually being in a valid state, then you don't have RAII.

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