[ 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: 523 KB, 1450x975, 1523366112141.jpg [View same] [iqdb] [saucenao] [google] [report]
67550932 No.67550932 [Reply] [Original] [archived.moe] [rbt]

What are you working on, /g/?

Previous thread: >>67542938

>> No.67550946

>includes in a separate directory

>> No.67550948

Behold, the power of C++!
#include <type_traits>

template <typename ...Ts>
struct List;

template <typename T, typename ...Ts>
struct List<T, Ts...>
constexpr static
unsigned size = 1 + List<Ts...>::size;

using Head = T;
using Tail = List<Ts...>;

template <>
struct List<>
constexpr static
unsigned size = 0;

template <typename T, typename ...Ts>
auto consHelper(List<Ts...>)
return List<T, Ts...>{};

template <typename T, typename L>
using Cons = decltype(consHelper<T>(L{}));

template <typename Fn>
auto mapHelper(List<> = {})
return List<>{};

template <typename Fn, typename T, typename ...Ts>
auto mapHelper(List<T, Ts...> = {})
return Cons<
typename Fn::template Template<T>,
decltype(mapHelper<Fn, Ts...>())

template <typename Fn, typename L>
using Map = decltype(mapHelper<Fn>(L{}));

struct AddPtr
template <typename T>
using Template = T*;

using PtrList = Map<AddPtr, List<int, void, char, double>>;

void f(PtrList)

template <typename Fn>
auto filterHelper(List<> = {})
return List<>{};

template <typename Fn, typename T, typename ...Ts>
auto filterHelper(List<T, Ts...> = {})
return std::conditional_t<
Fn::template Template<T>,
Cons<T, decltype(filterHelper<Fn, Ts...>())>,

template <typename Fn, typename L>
using Filter = decltype(filterHelper<Fn>(L{}));

struct IsInteger
template <typename T>
constexpr static
bool Template = std::is_integral_v<T>;

using IntegerList = Filter<IsInteger, List<int, char, void, IsInteger, bool>>;

void f(IntegerList)

>> No.67550951
File: 46 KB, 540x652, 1476111082775.jpg [View same] [iqdb] [saucenao] [google] [report]

>POO programmer
>shitty wall of text image macro
>non-anime OP for /dpt/
Ban OOP from /dpt/

>> No.67550954

template <typename Fn, typename Init>
auto foldHelper(List<> = {})
return Init{};

template <typename Fn, typename Init, typename T, typename ...Ts>
auto foldHelper(List<T, Ts...> = {})
return (typename Fn::template Template<
decltype(foldHelper<Fn, Init, Ts...>())

template <typename Fn, typename Init, typename L>
using Fold = decltype(foldHelper<Fn, Init>(L{}));

struct Biggest
template <typename T, typename U>
using Template = std::conditional_t<
(sizeof(T) > sizeof(U)),

using BiggestElem = Fold<Biggest, char, List<int, short, long, double>>;

void f(BiggestElem)

struct Id
template <typename T>
using Template = T;

struct ComposeTwo
template <typename X, typename Y>
struct TemplateHelper
template <typename Z>
using Template = typename Y::template Template<
typename X::template Template<Z>

template <typename X, typename Y>
using Template = TemplateHelper<X, Y>;


template <typename L>
using Compose = Fold<

struct AddConst
template <typename T>
using Template = T const;

using PPP = Compose<List<AddPtr, AddPtr, AddConst, AddPtr>>;
void f(PPP::template Template<int>)

>> No.67550956
File: 53 KB, 1600x900, wojak.jpg [View same] [iqdb] [saucenao] [google] [report]

>Yeah I was working with them the last year. They were a start up and doing a lot of interesting work with web data related to the work involved with your company
>Ok cool, and how much you were getting paid?

>> No.67550994

What are you trying to achieve?

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

learn Haskell

>> No.67551009
File: 96 KB, 596x841, file.png [View same] [iqdb] [saucenao] [google] [report]

Why is he using self for LineEdit and is not using self for Label?

>> No.67551011

where do you braindead haskell NPCs get the idea that functional programming is a worthwhile pursuit? who implanted the idea into your head?

>> No.67551028
File: 286 KB, 1024x768, 1520096169694.jpg [View same] [iqdb] [saucenao] [google] [report]

>NPC calling PCs NPCs

>> No.67551035

what, can't you tell?

>> No.67551037

because those objects aren't bound to self, they're bound to sub-members of self used the 'setBuddy' function apparently

>> No.67551044
File: 359 KB, 800x450, thumb.png [View same] [iqdb] [saucenao] [google] [report]

>shitty meme paradigm gets BTFO
>have a meltdown in public

>> No.67551050

>someone posting anime girls reading the /g/ meme book isn't an NPC

>> No.67551059
File: 704 KB, 2015x2204, 1488646807083.png [View same] [iqdb] [saucenao] [google] [report]

yeah I don't know why these OOP codelets even bother desu

>> No.67551065

No, too much template fuckery to read through the boilerplate.

>> No.67551120

I have defined map, filter and fold "functions" over types in the form of templates.
Because C++ does not have template templates/HKTs, I need to use templates nested inside types in order to pass type functions into templates.
I have also defined function composition where the each type in a list of types contains a nested template. Those templates are composed together to return the composed type function.

Truly, C++ is the most powerful programming language.

>> No.67551213

I'm working on surgically adding features to my company's hand rolled equivalent of make which consists of a jumbled mess of python, powershell and unreadable batch scripts.

>> No.67551255

Every Haskell / functional freak I've met is so high on adderall, a comment line this would send them to fucking outer space with the place of their rapid explanations and justifications.

... something tells me you knew that, too.

>> No.67551282
File: 48 KB, 1280x720, 1421165446325.jpg [View same] [iqdb] [saucenao] [google] [report]

Haskell programmer here
300k starting

>> No.67551290

I imagine everybody with a three-digit IQ seems like that to you.

>> No.67551312

defmodule Test do
def hello do
IO.puts "hello world"

>> No.67551313

Entry level gopher here
400k starting

>> No.67551318

>do ... end
Not even bash is so awful

>> No.67551322

I make 11enty billion dollars writing scripts.

>> No.67551334

>all this effort to achieve basic functionality
Sepples really is awful.

>> No.67551337


>> No.67551340

anyone need a collaborator for any interesting opensoruce projects (interesting is the keyword here), (You) me

languages: c, sepples, c#, java, js, python, perl, php, ruby, sh

>> No.67551345

Wow, not a single good language is in that list.

>> No.67551351

I can pick up any language in seconds, but I bet you ain't got any good ideas do ya mr. soiboi hipster man?

>> No.67551365

Wow, not a single intelligent thought is in that post.

>> No.67551385

So it's like a good language but shit?

>> No.67551397

heh, I expected that answer. /g/tards who jizz themselves writing fizzbuzz in l33tcode are usually devoid of any sense of imagination or productivity

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

I'm so good at programming that it hurts

>> No.67551404

Simply epic

>> No.67551441

Competitive programming is for people who are uncompetitive in the job market.

>> No.67551448

They're called OOPsies these days

>> No.67551450

Name 1(one) mainstream language which allows you to do this + example code.

>> No.67551501

competitive programming is a fucking meme, I wasted so much precious time over it when I could have been doing projects and building my portfolio.

I advise everyone here to stay away from it, the effort required to reach a high level is insane while the returns are miniscule. I reached master on codeforces by grinding algorithms 24x7 and I have got nothing to show for it except a declining graph on my profile. most employers I went to don't really give a shit about it either.

>> No.67551531

if I had to describe it, it was like one of those addictive F2P chink grindfest games but without the positive feelings you get from accomplishing stuff in those games

>> No.67551542

Sorry for being newfag
I am currently learning C in my class. I still don't really know why pointers are used so I wonder why my teacher used pointer to assign strings in this case:

const char *t1 = "Hello";
const char t2[] = "Hello";

>> No.67551577

Strings in C are char pointers.

>> No.67551628

>competitive programming
how dumb do you have to be
>grinding algorithms 24x7

>> No.67551666


>> No.67551690

how else are you getting into google?

their interviews always ask those problems

>> No.67551696

Should I get hard copies of SICP and HtDP?

>> No.67551697

how about building real skill instead of writing variations of fizzbuzz

>> No.67551707

>*tweaks question slightly*
>all your rote grinding is now useless

>> No.67551716

based and redpilled

>> No.67551718

An array is basically the same as a pointer, he was probably just trying to show you that. Also what the other guy said, strings in C are char pointers.

>> No.67551728

Ah, thanks alot

>> No.67551734

Hello, I have a question: Have two large groups of data in a cvs/.xlxs file, both are formatted slightly differently and I want to make graphs from the data within each group of data.

What is the most useful/easiest way to do this, and if I have to learn a programming language for it, which would be best? I'd like to generate charts as bitmap images too.

>> No.67551750

What's wrong with using Excel to generate the charts?

>> No.67551751

I could put it more succinctly actually: What is the best programming language to learn for sorting through large .csv files and generating graphs as bitmap images?

>> No.67551759

I could, but it's literally hundreds of graphs.

>> No.67551766

Python with numpy/pandas and matplot lib would probably be the easiest
The excel library for python is pretty good I found though its better if you have them all in csv

>> No.67551776

Thankyou very much. I should add though, I've never really actually written any code before, would you recommend any learning resources?

>> No.67551799
File: 35 KB, 300x300, Python-for-data-analysis.png [View same] [iqdb] [saucenao] [google] [report]

Oh boy. Automate the Boring Stuff by Al Sweigart is really good and what I used to get into coding.
Whole book online here

Then if you need help with Pythons data resources, pic related is really good

>> No.67551810

Lads it feels like the shitlangs are winning

>> No.67551827

Sandwhich artists make that much?

>> No.67551829

Amazing. This looks like *exactly* the kind of thing I'm looking for. Thanks again.

>> No.67551842

>how else are you getting into google?
By cutting off my dick

>> No.67551848

The name of the game in OO language design these days is to copy FP features but dumb them down and cripple them. OO itself is stagnating because it has run its course and has nothing to offer.

>> No.67551863

first class functions isn't exactly rocket science

>> No.67551868

I can't imagine doing large projects in anything but OOP

>> No.67551878

Then you need to broaden your imagination.

>> No.67551887

OO will never lose to functionfriends because OO represents reality

>> No.67551891
File: 769 KB, 1052x1342, 1489270803974.png [View same] [iqdb] [saucenao] [google] [report]

you've been institutionalised

>> No.67551905

There is a reason why it became popular, not even recently but almost 30 years ago.
You can't even make a sega genesis game and not beg for having objects

>> No.67551910
File: 11 KB, 213x320, carl_jung.jpg [View same] [iqdb] [saucenao] [google] [report]

How to increase one's programming productivity? What project management method is useful?

>> No.67551920
File: 103 KB, 750x750, 1536509160125.jpg [View same] [iqdb] [saucenao] [google] [report]

Don't bother trying to argue with the autists
>FP left, OOP right

>> No.67551921

use as little extraneous shit as possible

>> No.67551928

List what needs to be done then do it

>> No.67551932

Don't give the FPtards what they want, stop confirming their false dichotomy with OOP, they are not opposites, they aren't even related

>> No.67551935

>OO represents reality
Imagine being this fucking delusional

>> No.67551940

Put your smartphone in a different room
Unplug your ethernet cable, and give it to your mom
Check yourself for sleep apnea and/or low testosterone and/or nutritional problems

>> No.67551944

t. cowardly centrist

If you only understand OOP, perhaps

>> No.67551960

Reminder that OOPsies don't even understand FP, so their views on it are worthless.

>> No.67551973
File: 36 KB, 490x554, Mad-Men-Quotes-2.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.67551980

centerist implies you're in the middle. they aren't opposites. Functional programming languages stand in opposition to imperative programming languages, some of which have no OOP features at all.

>> No.67551983

>People who drive cars can't even ride horses

>> No.67551986

>functionvirgin is mad objectCHADs steal all his shit and then make fun of him

i'd vent my rage on taiwanese comicbook boards too if I was you

>> No.67551989

>OOPsies don't think

>> No.67551997

Anyone aware of a forum platform that provides a feed for new posts?

>ex. Oh yeah, VBulletin had an RSS feed by default that's published at ...

>> No.67552004

Haskell is the finest imperative language around today. Stop your shenanigans, OOPsie.

>> No.67552008

You're confused, functional shit ran its course back in the 80's and then died and was forgotten for a reason (LISP was like the third most used language back then). You're obviously too new to remember though.

>> No.67552018

Haskell isn't imperative because computers don't work the way haskell works

>> No.67552021

Haskell doesn't work.

>> No.67552042

This is hilariously wrong. All that happened is industry went chasing fads. It's coming back to FP these days, kicking and screaming. FP has been a constant force in academia. Not that you'd know that, of course.

If Haskell isn't imperative then why can I write imperative code in it?

You mean it doesn't work when you write it.

>> No.67552058

10 OOPsies = 1 FP boi

>> No.67552069

>calls me hilariously wrong
>goes on to write delusional fanfiction
No one's "coming back", kid.

>> No.67552080

academia is on it's last legs, it can't get by teaching practical skills anymore because you can learn them on your own through the internet, so now they're teaching pretentious shit like haskell

>> No.67552083

>it's not happening!
>Facebook using Haskell doesn't count!
>nor do all the other companies using FP!

>> No.67552097

>Facebook using Haskell
appeal to authority fallacy

>> No.67552102

Careful with that chip on your shoulder.

>> No.67552110

He's 100% right though

>> No.67552114

that's my own pet theory anyway, I'm trying to understand where all these FPtards are coming from

>> No.67552131

Hardly. It's simply a data point, albeit one you'll have difficulty claiming is a tiny irrelevant company.

>> No.67552143

Writing spaghetti code is a practical skill these days? How times have changed.

>> No.67552155

functional programming has a very small market share
saying "but facebook uses it" is nothing but that, appealing to authority

>> No.67552161

Haskell is by definition spaghetti code

>> No.67552167

Are math operations mush faster than string searches? I was told that we want to use them on our current project, so I applied my math skills and used prime numbers as part of a class to categorize items.

Instead of

We use
t.type % 5

Not sure how much of an improvement that is. It definitely hurt readability. Is there some hard data on this?

>> No.67552171
File: 73 KB, 258x220, 1490396182042.png [View same] [iqdb] [saucenao] [google] [report]

>they argue about two best paradigms of programming instead of GTFOing non-anime posters and anime haters

>> No.67552185

what is this even?

>> No.67552195

>Are math operations mush faster than string searches?
strings are series of numbers so yes, doing an operation on one number is faster than on several
you use enums or constants to represent those numbers as identifiers so you dont have to type the actual number

>> No.67552198

Its market share is growing. Facebook hasn't always used it. It does now. Just one example of industry moving to FP. There are many others. Stop being disingenuous.

>> No.67552202

They don't teach haskell, all of them still teach the same things

>beginner python intro
>systems C course
>some kind of functional 'comparative language study' course doing SML, Lua, other interesting langs
>a distributed computing course usually taught in Go or C++
>a GPU programming class taught in C++
>a lot of 'software engineering' electives taught in Java
>Coq and other verify via proofs classes

That's the curriculum for basically every ivy league/CMU. The trend these days is to move toward verified and correct software, so that's why you're seeing hype for shit like 'ReasonML' which is just a DSL for OCaml. That's also why we know have Princeton's Verified C toolchain/compiler to formally verify programs in C with Coq now.

Also, academia isn't going anywhere. Enrollment is surging in every school actually because of wall street and startup cash out hype bs

>> No.67552236

I want to make a tagging system for my pictures. Think a booru but with a local repo and smarter tags. The tags would be non binary trees (for example clothing -> skirt) instead of just plain tags.

The problem comes with the interface. Ideally I just want to it be as minimalistic and functional as possible. A search bar in the middle and a grid with the pictures below. When initializing a repository, the pictures are all given the ‘untagged’ tag. But I have zero experience making user interfaces. Do I use HTML and JavaScript? I know that electron is a memory hog, but I’m tempted to use it.

>> No.67552240

I've been writing personal projects in C++ for a while now, but I've never gotten very good at templates. Where can I find readable and detailed documentation (perhaps a tutorial?) that goes beyond the basics?

>> No.67552243

They should scrap all the C, C++, Go, Python, Java, Lua shit. It has zero academic merit. Companies should train people to use their tools, not expect universities to waste time doing it for them.

>> No.67552248

>They don't teach haskell
then where are they coming from?

I'm not being disingenous, you're jumping to conclusions based on practically nothing

>> No.67552272

Holy heck, you mention that some companies use FP and OOPsies get super desperate to avoid acknowledging it. I wasn't appealing to authority and you know it.

>> No.67552277

I'm not avoiding acknowledging it, I'm saying it has no relevance

>> No.67552296

>Say the line, OOPsie!
It's absolutely relevant and you know it. FP is seeing more and more use in industry. Sorry if that upsets you.

>> No.67552299

>they should skip all the shit which makes graduates employable and instead force them to learn a meme language which nobody cares about

yes goyim, give even more software jobs away to pajeet and friends, they deserve it more than you do

>> No.67552316

Those posts were intentionally obtuse bullshit. I've never seen templates used like this before.

what kinda projects have you been doing? because standard containers are probably the easiest place to get started

>> No.67552319

>enrollment in schools is surging
enrollment in schools, especially tech schools is at its lowest ever


>> No.67552322

It doesn't upset me, I use functional methodologies where they're relevant too, it's still a tiny fraction of all the code that needs to be written

>> No.67552341

>functional programming doesn't make sense
every object has attributes that describe a function, that interacts with an object that has attributes that define functions. life is about objects interacting with another through functions, in the end the functions are the important part as they are defined by parameter and return results that can either be processed by another function or not, which leads in the concept of functional programming to a halt, which would be an exception, which then again implies the software isn't well designed.

this guy is an ignorant idiot, even if he created smalltalk

>> No.67552345

Well everything is still in C, plus you need to know how C abstract memory to program in Rust and anything else that uses 'references' and 'pointers'. Compiler classes are still done in OCaml or SML just like in industry, all of these syllabi can be looked up.

Go anybody can learn in a weekend, which is why it's perfect for a one semester distributed computing course where the academic goal is learning all about distributed computing/queing theory ect and the actual programming is just glueing stuff together.

The best curriculum is Stanford and CMU, esp CMU's interesting parallel algorithms design course and Stanford's wacky webassembly, lua and rust course CS 242

People wondering where Haskell comes from it's industry, esp finance and oil and gas, it's used there a lot for modelling shit why I have no idea.

>> No.67552358

What you said is a load of gibberish, if you think that shit is intuitive its no wonder FP is garbage

>> No.67552367

Haskell is a really good language in general. The main downside is it won't perform like C or C++. I'm not surprised they use it for modelling, expressive type systems are good for that.

>> No.67552377

>People wondering where Haskell comes from it's industry, esp finance and oil and gas
those people aren't posting on /g/. The people posting on /g/ are posting anime pictures and don't know anything about programming even in their favourite language

>> No.67552387

CMU has a 5,000 applicant wait list, Penn State a 3000+ waitlist, ect ect https://www.forbes.com/sites/ryancraig/2018/05/03/the-real-cruelty-of-college-admissions/#77f874e25fe6


So does the rest of the top uni's in US. Tech schools are junk and always were a ripoff, they're being replaced by shit like Udacity/Coursera/Edx and stuff like Lambda School, which is where you learn for free then they take a percentage of your salary after.

>> No.67552413

It is not gibberish.

You as a human being are a machine that has functions based on senses. Every sense is a function with a very huge amount of sub routines. Every other organism in our world behaves the same. Our functions interact with the functions of something else, that's what people generally understand as concept of symbiosis. Action and reaction, cause and effect. It's fairly simple as a philosophical concept in sense of mathematics its a bit more difficult to explain and people tend to be reclusive when it comes to maths

>> No.67552426

At UC Berkeley, you can either start with SICP (racket) or composing programs (python and scheme). Then, for the second level course, you have the choice between c++, java, or haskell.

>> No.67552431

Brains are a gigantic mess of stateful neuron spaghetti code, not pure functional at all

>> No.67552436

BROKE: Functional Programming
WOKE: Profunctional Programming

>> No.67552445

I think you're underestimating the structural organization of the brain, and the logic that governs its state changes at any scale. Most brains are relatively low entropy.

>> No.67552456

The problem is all those functions are not in fact definable in that way. When a person is walking to a shop what is a function, is each step a function, or is each movement of the leg a function?

Objects are far more clearly identifiable as they have relatively permanent boundaries and potentials. Functions are too abstract and dividable. What we're talking about here in these paradigms is what the central pillars that define relations should be and its clear objects are the vastly suprerior anchor for all else to follow from

>> No.67552463

>I think you're underestimating the structural organization of the brain
I was making a joke about how functional programmers think state is bad (it isnt)

>> No.67552464

I've seen macro instantiated template classes.

I don't have source now but why would you want that?

>> No.67552465

Actually Alan Kay (other creator of Smalltalk) has very interesting posts around on so-called 'paradigms' where he shows how Java/Oracle got it completely wrong. The idea is having a massive distributed system, like say the size of a thousand computers, all passing messages, and the system's job is just to route these and respond by generating new abilities on the fly to react to said messages. You have independent algebraic data types to accept messages and perform crazy shit on them, the whole idea was a pretty good one but nobody has yet to properly implement it except Erlang possibly (and Smalltalk to a degree).

Functional programming is good for verified software, the less side effects the easier it is to verify something is correct. It's also good if you're an independent one man show trying to put together hobby software, you can't afford a testing team of a hundred pajeets so any help the compiler can give you is welcome.

>> No.67552467

What are states? Or let's first ask the question, what are functions?
According to oxford dictionary: "An activity that is natural to or the purpose of a person or thing." A state is an activity, it is something, therefor it is a function

>> No.67552477

>template classes
Class templates

>> No.67552489

Each step is a function, yes. You execute the function walking, which has subroutine, communication from brain to muscle in your legs, to do a step, based on a condition that terminates that function until another function is called in that program flow.

>> No.67552507

That description sounds pretty object oriented to me

>> No.67552515

state persists, functions dont

>> No.67552523

WTF are you even rambling on about? FP languages are the ones copying the shit OOP invented ages ago and calling it "new", calling it "dynamic" languages, and then going on to claiming OOP copying them! The only reason FP languages are marginally coming out of complete oblivion is because they started copying OOP in the hopes of returning to relevance. David West exposed you.

>> No.67552562

A function is an object. If it weren't it wouldn't be possible to describe it.
In principle they are related, though the actual implementation is different. You could also say that a object oriented language describe states and based on the states it describes flows, whereas functional languages do the opposite.

>> No.67552572

>the mentally ill actually believe this

>> No.67552576

What about functions that ensure persistent states?

>> No.67552663
File: 23 KB, 400x400, 8090995.jpg [View same] [iqdb] [saucenao] [google] [report]

>A function is an object. If it weren't it wouldn't be possible to describe it.

>> No.67552795
File: 2.54 MB, 390x373, 1535831501036.gif [View same] [iqdb] [saucenao] [google] [report]

>Lambda Calculus
>Invented in 1930s
>totally ripped off OOP!

>> No.67552898

The most complicated piece of template metaprogramming that I've used is this:
template <typename T, std::size_t...Is>
std::array<T, sizeof...(Is)> make_array(
const T& value,
return {{(static_cast<void>(Is), value)...}};

template <std::size_t N, typename T>
std::array<T, N> make_array(const T& value){
return make_array(value, std::make_index_sequence<N>());

It creates an array of N elements, each one initialized to value. This is
important since it works for types that are non default constructable.
I found it on stackoverflow, but I do understand how it works. I would not be
able to come up with something like that myself though, so I want to find a good
reference for templates.

>> No.67552907
File: 19 KB, 819x641, 1532594661099.jpg [View same] [iqdb] [saucenao] [google] [report]

>implying my goal is to describe 3dpd

>> No.67552910

Getting a segfault, maybe because I did not clean up some registers?
section .data
msg db "Hello, World!"
msglen equ $-msg

section .text
global _start

_start: mov rax, 4 ; sys_write
mov rdi, 1 ; stdout
mov rsi, msg ; message
mov rdx, msglen

mov rax, 1 ; sys_exit
mov rdi, 0

>> No.67552946

isn't there something about aligning the stack pointer before doing a call/syscall

>> No.67552980

Variadic templates are a giant pain in the ass that's the problem.
I'm not aware of any tutorial, I've just been fucking around to see what I can accomplish

>> No.67552981

Don't be to quick to shit on haskell.
The C++ templating system is just a shitty version of haskell with no type checking.
It's lazily invoked, data is all const, and the only way it can process information is via recursion. No type checking? Yes. No type checking. While C++ itself has types, the types themselves are mixed, twisted and manipulated typelessly. If you disagree with this, you probably don't know shit about C++ templates. Also, C++ templates are non-reentrant since instantiating a template that is partially constructed is undefined behavior but isn't caught by gcc or clang freak out differently when you do, instead of giving a real error.
Haskell just makes all that shit palatable enough to use. Haskell suffers from the same difficult to identify space leaks and having to express some ideas awkwardly because of the weird semantics.

>> No.67553039
File: 12 KB, 258x245, 354deaa3770912621bb816da070346ab.jpg [View same] [iqdb] [saucenao] [google] [report]

>this one rectumravaged functioNEET sperging out about muh eff pee in this thread

>> No.67553046

>who implanted the idea into your head?
mathematical literacy.

>> No.67553059
File: 928 KB, 200x200, 1512483138698.gif [View same] [iqdb] [saucenao] [google] [report]

every fucking thread, it's gold

>> No.67553090

>not a single functional programming language in the top 20 of language popularity index

b-but MUH mathematical modeling!! OOP is obsolete guise!!!

>> No.67553094

dumb frogposter

>> No.67553128

dumb frogposter

>> No.67553131

Am I doing it right?
(define (foldr f init l)
(if (null? l)
(car l)
(foldr f init (cdr l))

(define (map f . lists)
(define (all-null lists)
(foldr (lambda (x a) (and a (null? x))) #t lists))
(define (none-null lists)
(foldr (lambda (x a) (and a (not (null? x)))) #t lists))
(define (cars lists)
(foldr (lambda (x a) (cons (car x) a)) () lists))
(define (cdrs lists)
(foldr (lambda (x a) (cons (cdr x) a)) () lists))
((all-null lists) ())
((none-null lists)
(apply f (cars lists))
(apply map (cons f (cdrs lists)))))
(else (error "uneven list lengths"))))

>> No.67553144

oh shit my parens got fucked up for the first one

>> No.67553154

Got my call numbers wrong! Write is 1 (not 4) and exit is 60. Works as expected now.

>> No.67553196

Name 1(one) use case where you absolutely have to do this.

>> No.67553203

name 1(one) use case where you absolutely can't put all of your code in main()

>> No.67553204


>> No.67553205

>not using a curly braces language
{define {foldr f init l}
{if {null? l}
{car l}
{foldr f init {cdr l}}

{define {map f . lists}
{define {all-null lists}
{foldr {lambda {x a} {and a {null? x}}} #t lists}}
{define {none-null lists}
{foldr {lambda {x a} {and a {not {null? x}}}} #t lists}}
{define {cars lists}
{foldr {lambda {x a} {cons {car x} a}} {} lists}}
{define {cdrs lists}
{foldr {lambda {x a} {cons {cdr x} a}} {} lists}}
{{all-null lists} {}}
{{none-null lists}
{apply f {cars lists}}
{apply map {cons f {cdrs lists}}}}}
{else {error uneven list lengths}}}}

>> No.67553208


>> No.67553233

I just want to know if I did something monumentally stupid here, like a huge oversight that made this function too complicated

>> No.67553239

>trying to reason with people that don't even program

>> No.67553262

dumb frogposter

>> No.67553265

I've been programming for a while and know C to a decent level. The thing is I only know C.
I've been thinking about what would be a good next language that is useful, in demand, and teaches new concepts.
Anyone got any suggestions or tips?

>> No.67553269

I am working on a little project in Fortran. Currently I am using the following script for compiling and linking my project:
$ cat build.sh
f95 -g -o myprog constants.f95 data_types.f95 utils.f95 disp.f95 user_interface.f95 myprog.f95

How should I transform it to use make? Any tips how to move from shell script to make?

>> No.67553275

At what level of proficiency can you put C++ on your resume?

>> No.67553276

if you want to be boring but practical learn java
if you want to be intellectually stimulated learn scheme or haskell

>> No.67553282

only when you can understand >>67550948 >>67550954

>> No.67553289

when you have internalized RAII and you don't even flinch when seeing a variadic template

>> No.67553301

>second year
>entire class just for drawing fucking UMLs

You guys were right, college IS a fucking meme

>> No.67553311

Write your own OS
Then maybe you can apply to a junior position

>> No.67553312

I had the same experience. After the first year or so, it all goes downhill and has literally nothing to do with programming.

>> No.67553318

myprog: constants.f95 data_types.f95 utils.f95 disp.f95 user_interface.f95 myprog.f95
f95 -g -o [email protected] $^

>> No.67553336

I get it 95% or so but it still takes some time to parse in my head.

>> No.67553340

There are two college courses, almost the same name
One will teach you how to program that's commercially viable, the other is a liberal arts degree with computers

>> No.67553350

You could try OOP (C#, C++), webdev (literally anything + javascript), FP (haskell, ocaml, etc.), some esoteric meme language (nim, crystal), something just different (rust), a scripting language (perl, ruby, lua), parens (((lithp))), etc.
Just pick one at random, if you only know one language, you should learn something from anything.

>> No.67553361

when you have achieved the title of c++ grand master by implementing your own c++17 compiler.

>> No.67553380

defeat bjarne stroustrup in a duel

>> No.67553402

Proficiency in C++ means
> can you answer entry level questions about C++

>> No.67553449

>Its market share is growing
Can you measure the growth?
If you can't, then you're just assuming it is growing from an isolated event.
And if you can, then you'll realize it's negligible. Just because you went from absolute 0 to a positive epsilon in a few years doesn't mean you're suddenly relevant.
Stay frustrated.

>> No.67553493

I want the AGDG scum to leave.

>> No.67553633
File: 277 KB, 400x600, Screenshot_2018-09-09 Read manga Gokushufudou The Way of the House Husband Ch 007 - Read Online online in high quality.png [View same] [iqdb] [saucenao] [google] [report]

>a object oriented language describe states and based on the states it describes flows, whereas functional languages do the opposite

bruh you're confused at the fundamental level. objects have states and behaviors, states most simply being variables and behaviors most simply being functions.

functions are just behaviors mang

>> No.67553653
File: 314 KB, 1000x1271, 1518871238584.png [View same] [iqdb] [saucenao] [google] [report]

Why do people hate Java but love C# when they're highly identical?

>> No.67553656

objects are behaviors.

>> No.67553665

only Rajesh doesn't hate both
dumb frogposter

>> No.67553675

muh syntax sugar

>> No.67553742

>he hasn't written an emulator in 2018

>> No.67553744

i want to learn past the basics of programming and have no idea on where to start, are books just the best way to do it?

>> No.67553757

agreed about the type system, doesn't mean overall haskell is a good choice for well, most tasks

math is generally an inefficient way to interpret computer programs

>> No.67553760

Absolute C++

>> No.67553789

>are books just the best way to do it?

Yes. Pajeet academy and such shit are for idiots who can't read and take ten times longer to learn the same stuff

>> No.67553798

Think of a large scale, non-trivial project you give enough of a fuck about that you actually want to use the final product, breaking it down into smaller tasks you can easily accomplish or at least can google the solution to quickly.

>> No.67553828
File: 22 KB, 256x256, 4f116db990b82.png [View same] [iqdb] [saucenao] [google] [report]

>hasn't been updated in four years

>> No.67553835

What's the "proper" way of implementing classes if I just want to shove everything into a main.cpp file? Separate them or self-contain them?
class Number {
void assign(int, int);
void print();
int num, ber;
void Number::assign(int x, int y) {
// ...
void Number::print() {
// ...

// versus

class Number {
void assign(int x, int y) {
num = x; ber = y;
void print() {
std::cout << num << " " << ber << std::endl;
int num, ber;

>> No.67553855


the first is usually there if you're sharing around header files, you'd share the class definition, and implement the functions in a cpp file

>> No.67553866

there is a difference, when you do it the second way it is as though the functions have been defined with the inline specifier

probably better to do it the second way, it's just less boiler plate

>> No.67553942

what library would /dpg/ suggest for plotting graphs in 2d and 3d for c++?

>> No.67553954

Thanks desu

>> No.67554004

>slept well
>weightlifting off day
>no new anime

This week's project is an "Atom/RDF/RSS feed digest by mail" program.

>> No.67554007


ok thanks ill try to find some books and hope they arent shit then, if i succeed ill see you guys here in the future

>> No.67554065

I just looked up Smalltalk. It's just has bad as FP. I really hope we get some sort of next-gen C++. That would rip ass.

>> No.67554075


>> No.67554078

C++20 is coming along. Bit by bit, closer to proper generative C++.

>> No.67554101
File: 26 KB, 457x480, Z6cDxJE.jpg [View same] [iqdb] [saucenao] [google] [report]

why getting third party libraries to work on c++ with cmake is so hard

>> No.67554109

Because cmake is a pain in the ass in general.

>> No.67554112

Literally for people less evolved than me.

I mean something totally new that is like C++ but without all the legacy crap.

>> No.67554125

>I mean something totally new that is like C++ but without all the legacy crap.
Bjarne has made some good points about this. Unfortunately.

>> No.67554140

Make your own that transpiles predictably to C++.

>> No.67554163

>how little wear that book has
I hope you took that book out and read it after taking the pic at some point

>> No.67554213

Would smash both (if legal)

>> No.67554256


>> No.67554261

What kind of clown decided that you have to use templates recursively to have compile-time evaulated shit? Would be it really be so hard to allow compile-time for loops?

>> No.67554297

In what year are you living?

>> No.67554308

>Would be it really be so hard to allow compile-time for loops?
stop using shit langs.

>> No.67554335

Stop being bad

>> No.67554384

Anyone have that /g/ projects rolling list? I want to do something in Python but I don't have any good ideas.

>> No.67554405

Template metaprogramming was literally an accident.

Also C++ has compile time for loops it's called constexpr.

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


>> No.67554434
File: 327 KB, 1920x1080, 41440929_264607620829744_291938440461680640_n.png [View same] [iqdb] [saucenao] [google] [report]

because of how lately i am not able to implement simple library to create a simple program i want to kill myself.

>> No.67554451


Isn't automate the boring stuff in Python 2?

>> No.67554485

OOPsies are incapable of understanding FP correctly. All the empirical evidence points to it.

>> No.67554499



>> No.67554510

What's a good book for understanding Java?
Please don't ask my reasons for it

>> No.67554523

Effective Java
It's a great book even if you don't use Java

>> No.67554527

consider saving them this time

>> No.67554534

>legacy crap
Name one

>> No.67554546
File: 82 KB, 645x729, 1514694727315.png [View same] [iqdb] [saucenao] [google] [report]

Just bombed a 3/4 hour take home challenge for an internship and want to kill myself for not practicing more in my free time.

>> No.67554563

>3/4 hour take home challenge
What did they ask?

>> No.67554583

Objects don't have behavior, objects define behavior, that's a huge difference.

If you'd take Java as an example (the only language i actually wrote stuff in).
Object obj = new Object();

That's an empty construct, it can have anything or nothing it. The thing that defines it are the attributes, even if it's just getters and setters that load and call specific variables. The object itself doesn't do shit, for all you care you don't even need getters and setters and just set every variable public so it's callable from everywhere. You can still call obj.something and work with it but at that point the only thing that it does is with or without getters or setters is to store states of data that are load and callable. From a view point of existentialism you could say that every object has a base function that is to provide callable attributes, but that doesn't describe every functions main behavior and therefor, i would claim that you can't conclude that objects are functions

I could be very well wrong on this term, i never touched a functional programming language in my life.

>> No.67554608

w=q-w #w4 q9
q=q-w #q5
print(q,' ',w)

I would ever never come up with this if not one of /g/ memes posted today. Is this because I universally kept failing maths at school?

>> No.67554619
File: 10 KB, 480x360, hqdefault.jpg [View same] [iqdb] [saucenao] [google] [report]

How do you people make money?

>> No.67554623
File: 23 KB, 480x360, 40c2d61f7440a1dbb21d45f36571ceedf0899edf_00.jpg [View same] [iqdb] [saucenao] [google] [report]

>mfw GitHub pull request from user without Anime avatar

>> No.67554634

Good boy points

>> No.67554638

S.. sorry (>﹏<)

>> No.67554639
File: 71 KB, 1022x775, Capture2.png [View same] [iqdb] [saucenao] [google] [report]

Whats apparently wrong with my logic here? I'm trying to swap each pair of elements

>> No.67554640


>> No.67554647


>> No.67554648

>mfw github owned by microsoft

>> No.67554656
File: 11 KB, 501x504, happy merchant.gif [View same] [iqdb] [saucenao] [google] [report]


anyway the problem is that you're overwriting what's in testTemp[counter] on the first line of the loop so it's not what it used to be on the second time
copy it to a temporary String variable in the loop before overwriting it

>> No.67554665

math is why computation is a thing, you literal beotian.

>> No.67554667

Is there something I'm missing here?

>> No.67554669

Why are HKTs so contentious and controversial?

>> No.67554676

normies don't get them

>> No.67554680

so? you can describe the whole universe with math (if you believe in that), doesn't mean it's the most efficient way to do so in every case

>> No.67554689

for loop man, use for loops.
While you only use for conditions where you don't know the condition state that needs to be met. But you know how many times you want to iterate over that string, its. string.length

>> No.67554694

I have the following unexported functions:
isElement :: Cursor -> Text -> Bool
isElement n name = not . null $ n $| laxElement name

elementContent :: Cursor -> Text -> Maybe Text
elementContent n name = listToMaybe $ n $/ laxElement name &/ content

elementAttributeContent :: Cursor -> Text -> Text -> Maybe Text
elementAttributeContent n name attrName = listToMaybe $ n $/ laxElement name &.// laxAttribute attrName

Is it reasonable to abbreviate the function names like so:
isElem :: Cursor -> Text -> Bool
isElem n name = not . null $ n $| laxElement name

elemVal :: Cursor -> Text -> Maybe Text
elemVal n name = listToMaybe $ n $/ laxElement name &/ content

elemAttrVal :: Cursor -> Text -> Text -> Maybe Text
elemAttrVal n name attrName = listToMaybe $ n $/ laxElement name &.// laxAttribute attrName

>> No.67554705

>two tabs for each indentation level

>> No.67554711
File: 178 KB, 720x524, 1327120178653.jpg [View same] [iqdb] [saucenao] [google] [report]

If I have an SQL database that's small to medium sized, can I pull the whole thing into Ipython with pandas dataframes?

>> No.67554727

I had to write a simple program that takes a "clients" history of how much they used an application along with a limit for how often they can access it every 60 seconds. It also had to temporarily blacklist any clients that pinged the app too often. Then it returns the client name and how many times they accessed the app overall. I was given a method that takes an array of strings and a int which was the limit.

I basically sperged out and got confused by the instructions and barely got passed splitting the array of strings and messing with them. It also needed a O(n) or O(nlogn) complexity.

>> No.67554732

you can and should model efficient computation with math and logic

>> No.67554738

It simply swaps values of q and w, but I'm a such brainlet that I had to see it on /g/ to figure it out.

>> No.67554751

isElem I would say yes, it's pretty clear

but I wouldn't know what a content or attribute content is from reading the output type
Maybe Text? What's that, a specific name? an arbitrary text? a tag? something coming from a look up table?

It's just my approach but I would consider having a specific type for that stuff, so you could call them elemnVal :: Cursor -> Text -> Maybe Content or even Cursor -> Content -> Maybe Content

>> No.67554753

Haven't worked with either but why shouldn't you? If you have an odbc api you should be able to query stuff and build a controller that feeds this pandas thing or are you looking for an export import kinda thing?

>> No.67554798

But they're an obvious generalization of first order generics

>> No.67554799

oh ok

>> No.67554800
File: 1.75 MB, 400x222, toomuchinternet.gif [View same] [iqdb] [saucenao] [google] [report]

how would you describe the implementation or specification of a working universe with something else than mathematics? what kind of madness is this?

>> No.67554816

And yet they're still too complicated for brainlets.

>> No.67554828

12 year olds being philosophical

>> No.67554838


>> No.67554854

JavaScript rocks!

>> No.67554859

I can't think of an alternative. Most intuition is just poorly understood math.

>> No.67554871

To explain >>67554656 in another way, you've actually set testTemp to literally be testData. So, any change to testTemp also changes testData because they refer to the same thing.

What you probably want to do is:
* Set testTemp to be the same size as testData.
* Copy each element of testData into testTemp.
* Then do what you actually meant.

>> No.67554899

>I can't think of an alternative
imperative programming languages

>> No.67554900

They're utility functions for parsing XML. The functions find content in elements by the given name.
But I agree. I should alias name/content to make it more readable.

>> No.67554950

probably import export, as I don't think there's an ODBC api. I'm working with a database that was setup to work with proprietary applications designed for non-technical users to do data analysis. I don't have time to learn the trash UI's quirks, especially when I already have more powerful tools.

>> No.67554954
File: 24 KB, 300x471, 9780132158718-us-300.jpg [View same] [iqdb] [saucenao] [google] [report]

You can more effectively use imperative languages by modeling their semantics with logic, it's just that most logics are designed to be studied instead of used. Dijkstra developed a practical methodology with this calculational style, ie deriving imperative programs instead of ignoring the inherent math behind their constuction.

>> No.67554961

still mathematics (see turing paper)

>> No.67554977
File: 983 KB, 1920x1080, .jpg [View same] [iqdb] [saucenao] [google] [report]

andrei alexandrei called from 30 years in the past and wants chapter 1 of his book back

>> No.67554978

you don't ignore the math, they're just different ways of interpreting the same thing
some being more efficient for certain tasks than others

>> No.67555034

I can't imagine non-mathematical imperative programming being more efficient at anything except producing hard to fix errors.

>> No.67555037

>OOPsie desperately clinging to relevancy.

>> No.67555067

like I fucking said, it's not NON-mathematical, it's only a different system of interpretation

>> No.67555117

How is doing programming without math not non-mathematical? I don't understand what you're saying.

>> No.67555143
File: 31 KB, 638x540, 1459553551004.jpg [View same] [iqdb] [saucenao] [google] [report]

>she programs with mathematics
>she doesn't program with magic

>> No.67555167

many thanks

>> No.67555176

you mathfags lack any sense of pragmatism

for a majority of software released today speed is not the #1 priority, especially not at when it's at the cost of development momentum

>> No.67555226

you cant program without math, the math is there whether you like it or not, lambda calculus is just mathematical notation and imperative code isn't

>> No.67555228

Sorry for not wanting to churn out a mountain of bug-ridden slop. Although if you want to write code really fast, you should just use lisp.

>> No.67555297

I think I see what you're saying, I just don't see imperative programming as something simple enough to be understood "raw".

>> No.67555343

imperative and functional are both pretty fucking simple at their core despite attempts to make it confusing, imperative just wins out most of the time because it better models persistent systems and it's how computers actually work beneath the hood

>> No.67555389

>and it's how computers actually work beneath the hood
what is branch prediction

>> No.67555396
File: 1023 B, 122x38, 1k.png [View same] [iqdb] [saucenao] [google] [report]

*party horn*

>> No.67555404

Shipping is always more important than perfection, unreleased software is useless.

>> No.67555407

What text editor are you using?

>> No.67555411

pure functional programming opens up an entire class of optimizations that aren't possible in imperative spaghetti code though

>> No.67555428

Thanks for the perspective, it's food for thought. I'll have to consider how it models persistence, but I have to do other things now.

>> No.67555438

Mathematicians generally make horrible programmers. Computers are signal manipulators that are able to use that to do math. They're logic machines, and the computational approach to solving a problem may be inferior to other approaches. Even a simple optimization, like use of lookup tables and jump tables can make massive difference.

Look at code written casually by a mathematician, you're going to see divides, modulus ops, and everything else all over the place. The compiler might salvage some of that waste, but often times who chunks can be eliminated just by storing another variable and performing an addition and compare, rather than a modulus, check is zero, and and xor on itself to reset if true.

A compiler that uses AI to do what I just described would be useful.

>> No.67555454

'imperative' is a relative term here, I don't actually know the correct word to use for the style of programming where you follow a series of instructions to change locations in memory, it's definitely alot more imperative than functional code

>> No.67555467

this is a stupid post

>> No.67555478

Correct, and those optimizations are great where they're relevant, but in many practical cases, they aren't
Calling all imperative code 'spaghetti' is just disingenuous

>> No.67555510


>> No.67555519

scattered mutable state is disgusting, and so are (You)

>> No.67555535

computers are scattered mutable state
your compiled functional program is converted into scattered mutable state
throw your computer out the window right now and disinfect your desk before it gets on you

>> No.67555543

there's actually a way to orient your code so that state is largely controlled behind public and private interfaces allowing you to safely reason around the scattered mutable state that is your computers memory

>> No.67555561

Elaborate fully.

>> No.67555569

No, imperative is the correct term here. What I meant is that modern processors don't follow predefined steps. They get rearranged for efficiency. That's branch prediction.

>> No.67555580


>> No.67555589

>there are a ton of mathematicians who write inefficient code
the same goes for programmers
Who wrotes the most efficient code? Mathematicians and computer scientists who specialise in it and do the research

>> No.67555596

I see OOPsies, realizing they cannot win on the correctness front, are now arguing that correctness is unimportant.

>> No.67555608

Imperative means you're telling it exactly what to do
Branch prediction means you don't know exactly what it's doing because the CPU is optimizing shit under the hood, so no code you ever write will be 100% imperative, but normal procedural code is a hell of alot more imperative than functional code

>> No.67555624

And what, generate code by basically pretty printing it instead of manipulating syntax directly?

>> No.67555630

I think we both agree that the CPU is not strictly imperative, but it's certainly far from being declarative.

>> No.67555633

>she fell for the encapsulation meme
>she things her shitcode can be reasoned about without referential transparency

>> No.67555661

the CPU is not imperative or declarative, code is. Functional code is on the far end of declarative. Declarative code will never be as efficient as imperative code

>> No.67555666

>when you want to hang with the cool FP kids but really you're a Dunning-Krueger loser

>> No.67555669

another SQL question

if I have 6 columns, each of which can describe the item in a given row, that have a distinct list of tags but which can also be null. Is it fine to have 6 potential rows full of null values, or should i move each to its own table? I'm not sure which is more of a pain in the ass, querying 6 different tables or dealing with some nulls

>> No.67555688


>> No.67555695

In c#, what is the best way to hide and show forms when some selection is made?

For example when selecting the house option, options for houses appear like buttons and other stuff. but when selecting another thing like cars the options and button disappear and other type of components show.

>> No.67555726

Do other programming languages still lag behind Python in terms of convenience?
Like build in integer swaps ex: >>67554608, many functions on variables etc?

I used to program 10 years ago back in middle school and for majority of the things that python can do out-of-box, other languages like Delphi or c++ needed at least basic mathematics and several lines of code.

Has that improved in any way? Does anyone still code "like back then"?

>> No.67555739

Just put a container and change the usercontrol in the container.

>> No.67555756

>Does anyone still code "like back then"?
most people

>> No.67555767

Don't answer to obvious trolls.

>> No.67555769

What is databinding for?

>> No.67555807

How am I a troll? I'm just a boomer returning to my hobby after years.

I mean methods and ways. Can I just pull out my over decade old books and download Dev-C++ bloodshed, and I'll up to date with the current approaches to c++?

>> No.67555815

I'll agree. One requires both. However I think a decent programmer will generally write better code than a casual mathematician.

>> No.67555816

>hobby after years
So you didn't practice your hobby for years... Do you want me to believe you? I saw better trolls.

>> No.67557594

C++ had one very major standard (C++11) and two minor standards (14, 17) released. The best practices have changed significantly.

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