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



Thread archived.
You cannot reply anymore.



File: dedonocu&gritaria.png (181 KB, 512x512)
181 KB
181 KB PNG
What are you working on, /g/?

Previous thread: >>64283128
>>
C++ is good in the right hands
>>
>>64289685
Idris is a good language
>>
>>64289704

This, dependent types will revolutionize programming
>>
how does a site know something was posted "2 days ago" for example. At first i thought they just subtract the day integer from the date it was posted with the current day integer but that would fail when it changes months
>>
>>64289722
youre an idiot
>>
>>64289722

No one knows how it works. Programmers pass around the code without understanding it
>>
>>64289722
that's why everyone just stores the date in seconds since 1970 and subtracts when you want the delta between 2 times.
>>
>>64289722
Look up how a datetime library works.

And to just get the days past, you can subtract linux timestamp values and bin by 24 hour slots easily without having to do anything complicated or even using a library.
>>
>>64289722
(you)
>>
>>64289685
how do i get into a good incubator like in the hbo series silicon valley?
how much cash do i need to have saved up to survive SF inflated prices on everything?
>>
c++ is the greatest language of all time
>>
>>64289791
I don't like this meme very much
>>
>>64289685
>fixing microcontroller bugs
>find "PORTC &= 0<<3;"
>developer meant to clear only bit 4 of PORTC
kill me now, lads.
>>
>>64289703
What's a good book to learn modern C++? ie one based around templates and such, with exercises so not just another huge 1500 pages reference book
>>
>>64289829

Why learn C++? It's shit

http://harmful.cat-v.org/software/c++/
>>
>>64289829
nvm i just find out effective modern c++ is the recommended one to make the transition to modern practices

>>64289839
i respect your opinion and your willingness to help, but it reeks of 4chan contrarianism
>>
>>64289722

sugarjs.com/dates
>>
File: sql.png (26 KB, 899x418)
26 KB
26 KB PNG
Can't post this code, lol.

Gives me an error: "Your IP or IP range has been blocked from accessing 4chan."
>>
File: Tour-front-and-back.jpg (371 KB, 1153x704)
371 KB
371 KB JPG
why haven't you purchased this yet?
>>
>>64289722
we track dates as days, we're currently on day 737072 so integer addition works quite well with no risk of integer overflow
>>
Rate my code, /dpt/.

#include <stdint.h>
#include <stdlib.h>

/**
* @param n n
* @return d on success, -1 on failure
*/
int64_t f(uint8_t n)
{
if (n <= 1) return n;
/* if n is greater than 92, fail */
if (n > 92) return -1;
n -= 2;

uint64_t a = 1, b = 1, c = 0, d = 1, e = 1, f = 0;

while (n) {
uint64_t g, h;
if (n & 1) {
g = a * d + b * e;
h = b * d + c * e;
f = b * e + c * f;
d = g;
e = h;
}
g = a * b + b * c;
a = a * a + b * b;
c = b * b + c * c;
b = g;
n >>= 1;
}

/* return d */
return d;
}
>>
>>64289839
This page was created in 2006. Do you really expect it to reflect the last 11 years of C++ development?
>>
>>64289815
There are better ways to do this without explicit bit manipulation
>>
>>64289866
that's just hiro range banning IPs to get them to buy 4chan passes
>>
>>64289881

Yeah, it's worse now
>>
>>64289879
masterb8/10
>>
>>64289874
because you can download it for free
https://a.uguu.se/bsPS5bH7P60B_ATourofC%2B%2B%2CStroustrup.pdf
>>
>>64289890
I would never even consider C++ if not for C++11 and onward
>>
>>64289879
defec8/10
>>
>>64289885
But I can post just fine if I exclude the SQL snippet.
>>
Someone give me a good C programming talk.
>>
>>64289895
>>64289906
>62 seconds apart
it was still a bad joke the second time m8
>>
>>64289879

what does this/suppose to do?
>>
>>64289916
Nobody cares about C. There are many very good C++ talks that happen to be relevant to C.
>>
>>64289930
Calculates prime numbers.
>>
>>64289685
what are programs that a lot of people use that are a JAR file? ie.. javas use
>>
>>64289947
that's funny
because literally every cppcon talk ends up complaining about C for stealing away their use cases
>>
>>64289947
Fuck off Disney shill.
>>
File: wittgensteinpepe.jpg (78 KB, 600x600)
78 KB
78 KB JPG
Fuck guys, I just started learning Kotlin and it's a boss lang. I've never been this red pilled in my life.
>>
>>64289883
it seems like the other ways are compiler-dependent. so this type of instruction would be the most portable, yes?

if there is a better way, i'm all ears. someone always fucks this kind of thing up.
>>
>>64289979
t. not intelligent enough to use scala
>>
>>64288880
reddit.
post a short blurb about it in a relevant sub at the time when North America is waking up and you're guaranteed some attention. I expected a lot less, though.

>inb4 plebbit XD
XD
>>
>>64289979
>Kotlin
Java-EZ
>>
>>64289990
t. not relevant enough to use kotlin
>>
>>64289962
hell yeah dude kotlin is so BEAST. it makes me HYPE

>>64289961
literally never heard that in a cppcon talk
>>
>>64289879

le n00b here, what does the _t mean in the datatype?
>>
"C is close to hardware, it's basically assembly"
>stdint was standardized too late
>all common C libraries have to redeclare fixed width integer types because they aren't built into the language
???
>>
>>64289999
I don't know who you were trying to reply to, but I agree. Kotlin masterrace. Can't wait for the day of the rope for the Haskell brainlets.
>>
>>64290004
https://stackoverflow.com/questions/231760/what-does-a-type-followed-by-t-underscore-t-represent#231807
>>
>>64289999
fuck why did I waste my quad 9's on this
kotlin comment meant for >>64289979

>>64290011
it's funny how short-sighted k&r were in some ways. They had no idea what was coming.
>>
>>64289997
Kotlin will fail just like 90% of JVM languages. You don't win by trying to get people to leave Java. Most of them don't want to leave Java. You win by attracting the people who want to target the JVM but don't because there are no good languages for it. Scala is currently the least bad option.
>>
>>64290041
>90% of JVM languages
can you list all the past failed JVM langs?
>>
>>64290011
stdint is optional and you can't depend on having those fixed width types on all systems.

It would make less sense to me having the C programming language defining how many bits in a byte in the late 60s.
>>
>>64289984
I suppose they are compiler dependent, but I think most allow it. So I guess the best way is use a language designed for embedded systems, or give everyone a periodic refresher.
>>
>>64290055
I can't list all of them, but I can say that the only successful ones are Java and Scala. The failures include Groovy, Ceylon, Eta, JRuby, Jython, Frege, Clojure, and Fantom. So perhaps 80% would be more accurate.
>>
>>64289685
How easy is it to make a script that snaps up expired domains?
>>
>>64289703
C++ is literally bloatware
>>
>>64289722

In practice, that site is probably using momentjs https://momentjs.com
>>
>>64290101
How easy would it be for you not to be a waste of carbon?
>>
>>64290104
and if you don't mind just learn java ( and/or c#)

it's much simpler to learn and get work in
>>
>>64290076
>the best way is use a language designed for embedded systems
it seems like C and C++ are most common, outside of the arduino bullshit world. what language are you alluding to?
>>
>>64290056
I just think the general naming of "int, short, long" and having to type out "signed" and "unsigned" is based on the original syntax where you couldn't define vars midway thru a function. (i.e. only type them once).
Either way, it took far too long for them to decide on required sizes, and the end choices were too late. That's the real failure.

>>64290092
Groovy is #42 most used language, Clojure is #50. They're not failures at all.
>>
>>64290101
Are you the same person who posted in stupid questions thread?

It's not "hard" but you pretty much can't get around auto-renew or a owner that renews it during their grace period.
>>
>>64290092
as consolation, groovy gets to live on in build tools
>>
Does anyone here regularly smoke weed when they program?
>>
>>64290159
Me. Doing it right now...
>>
dude, weed
>>
>>64290159
I know someone that prefers to program high because it's easier to focus
>>
>>64290159
No
>>
C is beast and you're all low test.

>Muh array bounds
>My garbage collection
>new

Laugh at these faggots. C is shit and still 20x better than everything else.
>>
>>64290159
I've tried it a few times, I just end up writing useless shit with "ideas" comments and I delete it all when I wake up the next morning.

Stimulants are the real programming drug.
>>
>>64290181
rust has a compile flag to enable bounds checking (and subsequent panics), but it's disabled when compiling for release. Best of both worlds, I wish C/C++ had this.
>>
where does scala typically find use?
>>
>>64290126
not memeing, Ada if you have the choice.
>>
>>64290193
>Best of both worlds
>not automatic static verification
>>
>>64290217
how do you prove that all accesses are within bounds in a program before running said program?

You don't. There is no generalized solution here.
>>
>>64290193
>I wish C/C++ had this.
There are compiler flags for this...
>>
>>64290243
Types and totality.
>>
>>64290186
And those comments are the dumbest shit ever, a lot of them don't make any sense and sometimes it's just a half-assed ASCII art diagram of some half-baked idea.

I don't smoke weed often but when I do I get bored of media and start programming and shit. Thank you git.
>>
>>
> C++

what the fuck do you have when you return a reference to dynamically allocated data inside a function?
>>
>>64290199
interesting - i'll look into it. thanks for the tip, bruv.
>>
>>64290265
which ones?

>>64290266
Your strong type system is nothing compared to THEORY OF COMPUTING that dictates anything can happen in a running program, and the only generalized way to know something about it that happens at runtime is to run the program.

>>64290284
C++ is just like english. You can put things together but don't expect them to make sense.
>>
File: 1515113268093.png (103 KB, 645x773)
103 KB
103 KB PNG
>Your strong type system is nothing compared to THEORY OF COMPUTING that dictates anything can happen in a running program, and the only generalized way to know something about it that happens at runtime is to run the program.
>>
>>64290309
https://www.lrde.epita.fr/~tiger/doc/bounds-checking.html

There's also tons of alternative that are more or less expansive.
>>
>>64290327

We don't want to write programs we can't reason about before runtime.
>>
>>64290341
What do you think type/termination checking does you fucking retard?
>>
You know how you can chain constructors in C# using " : this() "? Is there any way to do the same thing with overloaded methods without having to actually call the other method in the body?
>>
>>64290309
>Your strong type system is nothing compared to THEORY OF COMPUTING that dictates anything can happen in a running program, and the only generalized way to know something about it that happens at runtime is to run the program.
What the fuck am I reading.
>>
>>64290041
>Kotlin will fail
It's already taking over Android dev. Most projects are written in Kotlin now. Almost all the big libs are being ported over to Kotlin. It's happening bro.
>>
>>64290348

I have no idea how your comment relates to what I said so I'll just call you a faggot
>>
>>64290354
Probably because you're stupid.
>>
>>64290348
A cosmic ray could flip a bit in a computer running your program and alter its runtime behavior. Good luck proving anything about that at compile time.
>>
>>64290328
That's really nice, thank you anon. I googled the same thing but I didn't find that particular info.

>>64290327
>>64290351
holy shit, do you guys really think you can do generalized bounds checking at compile time? The only way to achieve that is via proof-driven programming, which is insanely hard and not adaptable.
>>
>>64290367
>via proof-driven programming, which is insanely hard and not adaptable.

It's only hard if you're a brainlet
>>
>>64290367
Ever heard of Curry-Howard? You're already writing proofs, anon.
>>
>>64290367
Go on then, show me fizzbuzz in ATS mr. smart guy.
>>
>>64290367
Not 100% generalized obviously (that would imply there is a solution to the halting problem) but general enough that you can write useful programs with little to no proof guidance beyond types.
>>
File: IMG_20180107_200349.jpg (119 KB, 800x788)
119 KB
119 KB JPG
>>64289979
Kotlin? You must have meant Kot Blin
>>
>>64290390
Only brainlets need Turing completeness for everything they write.
>>
>>64290384
meant for
>>64290379

>>64290390
Is there a [[fast]] lang that does this?
>>
>>64290407
Turing completeness is overrated now that we have corecursion, which readily lets you write programs that run indefinitely, constantly receiving new input and producing new output.

>>64290412
Not yet.
>>
>>64290457
Maybe a version of ATS with proper ergonomics would hit that target.

Though, I'd love a systems lisp or ML with a focus more on robust typing and proofs than rust.
>>
>>64289685
if yeu not C yeu do not no de wey
>>
File: 1513235430796.jpg (728 KB, 1994x3000)
728 KB
728 KB JPG
Are there any good ways to compress grids that are mainly empty?
Using a 2d array so looking up an index is O(1), but a ton of memory is wasted.
Are there any data structures that are quick lookup but more like a list in memory use?
>>
>>64290579
struct Point { int x, y };
map<Point, T>
>>
>>64290579
Sparse quadtree
>>
where do you learn data structures and algos knowledge from when you don't have time to read an entire book?
>>
>>64290871
Just make it up, write garbage bruteforce code and give it fancy names. Nobody will say anything because your complicated terminology will drive fear right into their soul.
>>
>>64290871
> don't have time to read an entire book?
You have the time, don't make excuses.
>>
>>64290871
Just use arrays for everything. Most other data structures are overkill 99% of the time.
>>
>>64290871
>when you don't have time to read an entire book?
You can get the important parts of data structures/algos in a 6-page pamphlet
>>
>>64290871
Read every second sentence. That'll take half the time.
>>
>>64290871
https://www.tutorialspoint.com/data_structures_algorithms/
>>
>>64290974
read pages 1, 2, 4, ... and then you can read the whole book in O(log(n))
>>
>>64291012
Would just reading the title be considered O(1)?
>>
>>64290579

create a hashtable key from the x and y offsets
>>
>>64291164
>wasting ton of memory with array
>use hashtable instead
Hashtables are terrible for memory usage.
>>
Why is Go so underrated?
Why do people still use Ruby?
>>
>>64291189
Non-startups still use Ruby?
>>
>>64290457

>Turing completeness is overrated now

wtf? did you mean the halting problem rather than turing completeness?

Anything that's not Turing complete is not a programming language you dumbass.
>>
>>64291189
>Why do people still use Ruby?
Is this really what Go is up against?

Also who the fuck still uses ruby?
>>
>>64291215
html5 is acceptable programming language.
>>
>>64291207
how many years are you allowed to be a startup?
>>
>>64291223
As long as you aren't making profit and still have money to lose.
>>
>>64291216
No the thoughts are kinda unrelated, the poor souls using ruby would probably be better served with python, I'm just wondering why Go is so underappreciated.
>>
#include <stdio.h>
#include <stdlib.h>

typedef unsigned long ulong;
typedef unsigned char uchar;

ulong nwide_get(uchar *data, size_t index, size_t step)
{
size_t off = index * step;
ulong ret = 0;
for (int i=0; i<step; ++i, ++off) {
if (1 & (data[off/8] >> (off % 8))) {
ret |= (1 << i);
}
}
return ret;
}

void nwide_set(uchar *data, ulong entry, size_t index, size_t step)
{
size_t off = index * step;
for (int i=0; i<step; ++i, ++off) {
uchar out_bit = 1 << (off % 8);
if (1 & (entry >> i)) {
data[off/8] |= out_bit;
} else {
data[off/8] &= ~out_bit;
}
}
}


>>64289611
>>64290767
Shorter and purer than the OOP cancer code presented (and reinvents more wheels but whatever)
>>
>>64291230
So Amazon is still a startup?
>>
>>64291247
If you're not making money you don't just get demoted back to a "startup". In the worst case you become a failed business, in this case I don't think that applies.
>>
File: py.png (24 KB, 800x800)
24 KB
24 KB PNG
>>64291236
>the poor souls using ruby would probably be better served with python
you have it the wrong way 'round friendo
>>
>>64291223
>>64291247
Startups will typically convert their code base in some way for better performance/efficiency as they lose startup status.
>>
File: 1511317634186.jpg (148 KB, 1080x1244)
148 KB
148 KB JPG
>>64290107
No it's not. kys
>>
>>64291215
And why is that?
>>
>>64291245
lol
>>
>>64291286
?
>>
>>64291245
>Having to constantly state step size
I see no problem with this
>>
>>64291386
Just typedef a struct holding the step and the data and change accordingly. Problem solved.
>>
>>64291386
hurr durr I need to instantiate an object just to call a function
>>
>>64289839
>>64289853
reminder that the creator of that site was a sad fuck who was just looking for something to insult before he offed himself
>>
at one job I had, everyone was a new hire inheriting an older codebase and we had to do a show of hands to determine which C++ features were understood by the dev team and blacklisted all the ones that had less than half the room raising their hands.
on the list of things not to commit to the master branch
>bitwise
>macros
>templates
>pointer indirection longer than 1 star
>function pointers
>most of the C++ keywords introduced after C++98
>anonymous structs
>"naked malloc calls"
>none of the mem* family functions
>ternary operators

they let me go after 2 weeks because I was writing pure C in a C++ project and using most of the features they explicitly banned and then going out of my way to hide the evidence with macros
>>
>>64291488
That's going a bit far but everyone who likes cat-v.org and suckless has a very high chance of being an irritating fuckwit who believe it makes them CS geniuses.
>>
>>64291510
>hey let me go after 2 weeks because I was writing pure C in a C++ project and using most of the features they explicitly banned and then going out of my way to hide the evidence with macros
well why would you do that
>>
>>64291510
What area was this codebase in?
>>
>>64291510
good lad
>>
>>64291488
well I mean, it's 2018. This page was made in 2006. No C++11, none of the really nice type/template features, compilers sucked, and computers were too slow to compile C++ at a reasonable pace. IDE's and static checking where barebones at best.
So yeah, C++ sucked to use back then, and it does kinda suck in the same ways now but it's wrong to use cat-v shit as a critique of modern C++.

>>64291510
You don't really need most of that, anyway. Though, it sounds like they should be writing Golang.
>>
RIP thread

it's not like anyone here even knows how to code anymore. It's kinda depressing.
>>
>>64292022
Sorry, I'm being productive!

Just finished a sizeable 600 line chunk of library code. On to the next thing.
>>
File: cat.webm (196 KB, 400x300)
196 KB
196 KB WEBM
>>64292022

It's Caturday, no one is in work mode
>>
Threadly reminder that type theory is a cult.
>>
I notice that in some library, lots of member function that return a void been replaced to
 class_name & class_name::method() { /* */ return *this;} 

so it's possible to link multiple method together such as:
Foo foo;
foo.method_a().method_b().method_c();

instead of
Foo foo;
foo.method_a();
foo.method_b();
foo.method_c();


Is there any overhead of doing that rather than using the standard void return???
>>
>>64292135
spamming this wont make you any less a brainlet.
>>
>>64291043
not if n is characters or words and the title could be the whole book
>>
File: 1503225428311.png (453 KB, 763x1065)
453 KB
453 KB PNG
>>64292208
>>
>>64292289
Yes it is
>>
>>64292203
an overhead of one reference
>>
>>64290327
>tfw borderline-retarded type-system shills have to false flag because they ran out of arguments
>>
>>64292135
stop doing programming please.
go do arts or something else, it's a better suited discipline for you
>>
>>64292492
>t. cult member
It's you "people" who need to change professions, because you're constantly precluding the field from becoming a legitimate engineering field with your dogmas.
>>
>>64292208
>>64292492
Notice how the type theorist becomes irrational and offensive when their esoteric beliefs are challenged. This is the hallmark of a cult.
>>
>>64292508
You're an obvious false-flagger. I like how you think of yourself and your friends as a "type theorists" for having read Type Systems for Dummies, though.
>>
>>64292504
>>64292508
if this a sample of software engineers of today no wonder the field becomes what it is
next thing this cattle will teach us to remove algebra cause its a cult too
>>
>>64292629
>next thing this cattle will teach us to remove algebra cause its a cult too
I'm not telling you to remove type theory, kid. I'm telling you to remove yourself due to your cult-like behavior. Come back when you understand the basics behind any form of engineering; most importantly, when you understand the concept of tradeoffs.
>>
>>64292203
Practically speaking - none, really. Calling conventions mean it just werks as it's supposed to.
https://godbolt.org/g/KWvwky
>>
What's the word/phrase used specifically to describe bad code that relies on "benign" error(s) made either elsewhere in itself or a dependent program to work? (fixing said error breaks functionality)
It's been on the tip of my tongue all night and it's driving me nuts.
>>
>>64292203
Actually a pretty good idea.
>>
>>64292721
It's called a hack, anon.
>>
>>64292721
I'm not sure that makes much sense.
If you have a piece of code that processes invalid inputs fine and valid inputs incorrectly that's just buggy.
So you have buggy code feeding other buggy code.
I don't know the word you're looking for though.
>>
>>64292758
It makes perfect sense. He's talking about a function or a program returning unexpected/unintended output for some edge case that nonetheless happens to be useful in some context.
>>
>>64292758
>>64292751

I might be going nuts; granted my memories of the last time this would-be term came up is years ago, but the concept came up in a discussion earlier regarding busted to shit business IT setups (DON'T FIX THIS OR EVERYTHING ELSE BREAKS solutions) and my brain is screaming at me that there's a name for this shit but I'm drawing blank.
>>
File: 298765438.jpg (43 KB, 612x653)
43 KB
43 KB JPG
>>64289685
>>
>>64292648
"knock knock" who is here?
oh look its the church of noscience engineering again.
sorry sir i dont want of your belief and your god is stupid. bye.
*slam door*
>>
>>64292808
>n-n-no u
Another solid counter-argument from the cult of typeletology.
>>
I'm trying to understand && aka rvalue reference aka universal reference.

What the fuck is going on here? I want my C++ 98 back.
>>
File: baba.jpg (2 KB, 70x70)
2 KB
2 KB JPG
>ArchLinux
>hacker
>vapenation
>gets followed by a bunch of orbiters

is this our /g/irl?
>>
How is passing pointers to a function more efficient than passing the a copy of the object?
You have to dereference the object, don't you?
>>
>>64292881
forgot link, got a little too excited xD

twitch 0xbaba
>>
>>64292844
why do the nosciences accuse the opponents of their own doings?
have we ever seen one formulating a valid argument to support their "claim"?
it's victory by vacuity. cant counter the argument which does not exist. nice victory for microbrains
>>
>>64292854
t. engineer
>>
>>64292854
It's not that bad.
>rvalue references.
An rvalue reference binds only to an rvalue. An rvalue is a temporary value, or a value that is interpreted as temporary using something like std::move.
void someFunction(Foo &&f);

Foo f;
someFunction(f); // Won't work
someFunction(std::move(f)); // ok
someFunction( Foo{} ); // ok


>>64292883
Dereferencing is usually much cheaper than calling a copy constructor.
>>
>>64292898
>he thinks type system evangelism is a "science"
>he thinks science deals with subjective value judgments
>he thinks his behavior is not, in and of itself, evidence for my observation about his cult-like nature
Religitards... when will they learn?
>>
>>64292905
What?
>>
>>64289685
Rewriting mplaylist in qml.
>>
>>64292913
you can doubt foundations as you want but theory are indeed science
also please make argument
>>
>>64292920
Do you get 60FPS window rendering with QML? I tried it not long ago and I was disappointed.
>>
>>64292938
I wouldn't know. This is my first semi-serious qml project. qml rendering afaik runs on a different thread from the rest of the program, so maybe? The qmlmpv example seems to handle it ok though.
>>
>>64292883
Usually people ask the other way around. The reason you'd find a reference more efficient than a copy is quite obvious. You don't have to copy the values into a new piece of memory with the reference.
A reference can be way slower because it complicates compiler optimizations, a lot. Ideally compilers would be perfect and you could pass any reference/pointer anywhere and be just fine. That's not reality though. It's a lot to get into.
https://youtu.be/UHv_Jog9Xuc
01:14:30
Its worth watching all of it as it gives you a good perspective even if you just watch these examples. There's people asking questions about this very thing too.
>>64292910
>dereferencing is usually much cheaper than calling a copy constructor
I just wanted to make it clear to anon that this doesn't conflict with what I say.
The solution (in sepples) is move semantics.
>>
>>64292922
Boy, you're just too dumb for basic reading comprehension, huh? Or maybe you're too dumb to tell apart different posters? In any case, your drivel doesn't relate to anything I posted in any way. I'm just reminding you that your type system evangelism has nothing to do with science, or even with type theory proper.
>>
>>64289685
Que porra é essa?
>>
>>64292910
Thanks.. It makes a lot of sense when you put it like that, but my head is exploding trying to read Effective Modern C++.

So say there's a classic C++98 code littered with const Foo& and shit like that. Where would one typically utilize rvalue references to speed it up?
>>
>>64292987
i do not evangelize about anything. listen i explain to you how can find some science
here for example https://scholar.google.com/
you find science documents and you can read it. type system documents. its not a difficult find
>>
>>64293059
Maybe you should finish highschool before you tell people vastly more educated than you what to read, kid. Protip: you won't find any "scientific" support for your type theory evangelism in type theory textbooks.
>>
>>64293009
I only use it for constructors and assignment operators. Just as you have a copy constructor and copy assignment operator, you have a move constructor and a move assignment operator which takes a && reference and invalidates the referent. std::string has a move constructor, for example.
void someFunction(std::string str);

std::string s = "Hello, World!";
someFunction(std::move(s));

The move constructor will be invoked. The move constructor will move the heap pointer that s is using to str, making s an empty string and avoiding making a new heap allocation and memcpying the contents of the heap buffer.
>>
>>64292971
>You don't have to copy the values into a new piece of memory with the reference
Instead the function dereferences the pointer into a temporary locally-allocated object. Now which is faster?
>>
File: types.png (171 KB, 955x788)
171 KB
171 KB PNG
>>64293073
you can lead the horse to water but you cannot force it to drink
>>
Is using dynamic in C# for multiple dispatch acceptable? It's a lot less code than doing a bunch of reflection, no clue if it's more performant or not since it might just be doing reflection under the hood, don't really care for my use case though...
>>
>>64293115
Using C# is not acceptable.
>>
>>64293115
its not very good. it has runtime resolution of overloading.
>>
>>64293124
Don't care, I'll program in COBOL as long as I get paid ;^)
>>
>>64293132
Runtime resolution is what I'm looking for, hence multiple dispatch
>>
D is doo-doo
>>
>>64293114
>more mindless type system evangelism
>still no argument
>>
>>64293155
do i try to make baseless statements to discredit valid scientific work? oh no actually i think its you
>>64293147
what you will do is terribly suboptimal. the question is how much performance sacrifice you want to make in exchange for design effort.
>>
>>64293088
Thanks. move constructor and operator made a lot of sense.

In your example, did you mean to write
 
void someFunction(std::string str);

or is it supposed to be
 
void someFunction(std::string&& str);

to take advantage of move constructor?

Also s is gonna be empty string after that code? Even if it started off as lvalue? What the fuck my mind is blown.
>>
>>64293112
I was kind of expecting you to watch that short example and understand the problem but I realize it relies quite heavily on things mentioned earlier.

The problem isn't where it stores the memory it's that it's stored. It's difficult to say meaningfull things about any program but most of the time you'll find that the compiler is better at avoiding copies (ignoring copy construction for simplicity, they can be arbitrarily crazy of course) than removing a reference.

Of course I doubt the example he showed first (in the video) would actually be a problem. It's more an example of the principle. The more complex the code gets the more difficult the problem becomes. The more likely the compiler is to not help you make your code fast in the case where you use the reference.

Now if you mean 'locally allocated' by using some construct of your own that does stack allocation that the compiler doesn't figure out (or worse, you do heap allocations and consider it 'local') you've basically engineered your code to have these issues.

Now to your actual question, sorry. I don't know if compilers manage you your case well. It's an unnecessary step because you've just done pass by value except you've given a reference at first to confuse it. I don't dare guess on the actual results but I think you see too how it's pointless.
Its certainly not better than just passing by value. But it may be better than references.
>>
>>64293176
>oh no actually i think its you
Quote it. What "valid scientific work" am I discrediting by discrediting you and your evangelism?
>>
>>64293196
Oh and I forgot to mention. I assume you actually mean that you create a local object/variable and copy the referenced values into the local object/variable.
>>
>>64293179
No, I meant to write that.
std::string a = "hello, world";
std::string b = a; // invokes copy constructor
std::string c = std::move(a); //invokes move constructor. a is now an empty string.

Just like with these variables one of the constructors must be called to initialize the parameter str, and it will be the move constructor.

Nobody cares if you invalidate a temporary object because you won't be referring to it elsewhere, so it's fine when a move constructor invalidates it. It would be a bad idea if a move constructor on a named object all the time, so only regular references bind to those. But std::move is like a license that allows you treat it as a temporary object.
>>
Beginner programmer here in Python working through the exercises in Think Python, I managed to create a dictionary with the number of occurring words. Now I was trying to use Counter to do the same, but by taking a list made from the already made dictionary.

However, it just gives me a Counter-dict with words all numbered as 1. What am I missing to count the number of existing words and creating a proper Counter or a list from the dictionary? (I hope this format works...)

[$code]
import string
from collections import Counter

book_file = 'don_quixote.txt' # taken from project gutenberg
with open(book_file, 'r', encoding='utf8') as f:
inputText = f.read()

translation = str.maketrans("", "", string.punctuation)
removePunc = inputText.translate(translation)
textSplit = removePunc.split()
word_list = {}

for item in textSplit:
count += 1
word = item.lower().strip(string.punctuation)
if word.isalpha():
word_list[word] = word_list.get(word, 0) + 1

word_keys = list(word_list.keys())
cnt = Counter()
for word in word_keys:
cnt[word] += 1
[$/code]
>>
>>64293283
>[$code]
lurk more
>>
>>64293277
Not him but in your example if b and c is uninitialized string, then what is the difference between:
std::string a = "Hello World!";
std::string b;
std::string c;
std::swap(a, b); //using std::swap(std::string &, std::string&) to swap empty string in b with a
c.swap(b); //using std::string::swap(std::string &) to swap empty string in c with b
a = std::move(c); //using std::move to move the string from c back to a
>>
>>64293318
>uninitialized string
There is no such things in sepples.
>>
>>64293318
RAII
It's a crutch.
>>
>>64293339
I don't know, how to refer a string that doesn't contain any specific value or content properly.
>>
>>64293358
>I don't know, how to refer a string that doesn't contain any specific value or content properly.
There is no such thing. It's sepples, not C.
>>
>>64293358
default initialized
>>
>>64293358
I'm not sure what the question you're asking is. std::swap requires that the type parameter is move assignable and move constructible because std::swap uses std::move itself.
>>
>>64293358
Well the closest you'll get is default construction.
You could be naughty and cast a piece of memory into a string. I think that's what you thought std::string a; was like.
>>
So do we all agree that 32 bytes (something like 8 bits pointer 8 bits capacity 8 bits length and 8 bits padding) strings are the best for SSO and cache efficiency?
>>
>>64293421
>8 bytes padding
for what purpose, it's already word aligned
>>
>>64293421
>bits
Meant bytes. Still not awake I see.
>>
>>64293399
>You could be naughty and cast a piece of memory into a string.

this would kill bjarne
>>
>>64293277
Thanks dude.
I haven't programmed in C++ in years, trying to cram C++11/14 before my interview next week, and I'm getting BTFO.

So in general, (outside of move constructor and move assignment operator,) the whole &&, move, and forward is something you should sparingly only on particularly heavy objects, right? Not something you spam whenever possible?
>>
>>64293433
Words are 2 bytes, maybe you meant 16 bytes aligned and it should indeed be with most compilers but then you don't have explicit access to the last 7 bytes for your "short" string.
>>
>>64293444
wait until you discover forwarding references
>>
>>64293226
i evangelize nothing. you assume things.
your tribe vaguely attacks modern type systems as impractical. there is nothing to extract of your discourse because no clear argument is ever made.
you only collect concepts you dislike in a bag you call type systems and you trash everything into the garbage can
>>
>>64293459
Yeah what the fuck is that shit?
As of now, I just understand it as the shit you use when you wanna relay the rvalue reference.

 
void anotherFunc(Foo&& foo);

void someFunc(Foo&& foo){
//random shit
anotherFunc(std::forward(foo));
}

someFunc(Foo());

foo is never copy constructed, but move constructed all the way down to anotherFunc this way. Did I get that right? Am I missing anything?
>>
>>64293444
You should use move semantics often, although the instances where you write && should be rare. Copy operations are wasteful if you know that you won't need to use the original, so in those cases it's preferable to do a move.
void fillVector(vector<HeavyObject> &vec, int whoCares);
void takesVector(vector<HeavyObject> vec);

void demo()
{
vector<HeavyObject> vec;
for (int i = 0; i < 10; ++i)
fillVector(vec, i);
// I know I don't need this vec for myself, so why copy all these heavy objects?
// Say that the vector can be moved instead.
takesVector(std::move(vec));
}

>>64293521

&& doesn't always mean an rvalue reference. If you use it in an instance where type inference is used (e.g. with template type parameters, or with auto) then it's a forwarding reference (also known as a universal reference).
This means that it will use context to figure out whether it's supposed to be an lvalue or rvalue reference. You'll only really need it for metaprogramming with templates.
Foo f;
auto &&f_ref = f; // deduces to Foo &f_ref = f;

std::forward preserves the variety of reference it is. Again, it's only needed for metaprogramming with templates.
>>
>>64293521
// Lvalue ref.
void foo (bar &);

// Rvalue ref.
void foo (bar &&);

// Forwarding ref. - either a lvalue or rvalue reference.
template <class T>
void foo (T &&);
>>
File: 1489461328707.png (740 KB, 1834x1200)
740 KB
740 KB PNG
https://www.youtube.com/watch?v=AKtHxKJRwp4
LMAO this guy's reaction at 6:58...
>>
What exactly is a hash function?
I think I have a rough idea of what it is, but i'm not sure I understand exactly what and what doesn't qualify as a hash function.
>>
>>64293489
>your tribe vaguely attacks modern type systems as impractical
Quote me, faggot. What's that? Are you failing again?

>no clear argument is ever made
The argument is simple: type system fanboys behave in a cult-like fashion. Cult-like behavior is irrational. Effective programming requires a rational approach. Therefore, type system fanboys are ineffective programmers.

>you only collect concepts you dislike in a bag you call type systems
I neither like nor dislike any concepts related to types. I don't have any strong emotions towards tools, unlike you. I just dislike it when cultists pollute my field with their dogma.
>>
>>64293621
independence
>>
>>64293621
https://stackoverflow.com/questions/3792037/just-how-many-printf-and-scanf-variants-are-there
But sure, overloading is bad.
>>
>>64293621
Literally how the fuck do Ctards even manage without namespacing/overloading/generics
JUST
>>
>>64293684
That's all useless bloat. void* and preprocessor macros are enough, kid.
>>
>>64293684
Just fine. How do you manage with your compile times?
>>
File: subtle.png (585 KB, 855x643)
585 KB
585 KB PNG
>>64293702
>macro templates
>>
>>64293570
I see.... So in your example, back in the old C++98 days, I probably would have done
void takesVector(vector<HeavyObject>& vec);
takesVector(vec)

which has possible reference dangling problems if code gets complicated, but you are telling me
void takesVector(vector<HeavyObject> vec);
takesVector(std::move(vec))

is more modern and safer way to pass around heavy objects, huh?
>>64293599
Fuck me. Alright. Thanks, dudes. I'm gonna read item 24/25 again.
>>
>>64293621
The guy with the eyepatch is a Microsoft guy.
I've watched many versions of this talk. It's filled with inconsistencies. He talks about 'not helping the compiler' but what he communicates is that you shouldn't fall into the pitfalls of C++ where his MSVC (presumably, because other compilers do fine) is unable to strip the abstractions. His example of the asymmetry between append with a C string as the first value and a std::string as the second (which doesn't work and is fixed by converting the first to a std::string except not because then you construct an object to just append it in the next step.... ) and the other way around where he implies that you're helping' the compiler because you've applied a general principle of wrapping C strings in std::string construction to have some form of consistency. Something which decent compilers handle just fine but his doesn't.

Not sure that's in this version of the talk. Anyway. I think you can see how nobody who knows C++ would actually gain from watching this.
>>64293684
You write code differently. I'd characterize C code as more sequentially readable. People tend to invent situations where they 'need' overloading or generics.
But I do use C++. Because I like these things too.
>>
>>64293713
>idiot implies the name for metaprogramming is templates
More news at 11.
>>
>>64293732
if takesVector needs to take ownership of that vector (e.g. if it's going to place that vector into its own persistent storage) then you should use pass by value. Then the caller can determine whether a move or a copy is appropriate.

If takesVector does not need to own the vector (just peeking, possibly mutating) then you can continue to use a reference.
>>
File: typelet-chart.png (13 KB, 578x438)
13 KB
13 KB PNG
Python/JS:
>type systems are just a social construct to constrain my creativity!
C++/C#/Java:
>type systems are about making sure i don't pass a string to a function expecting an int!
>int age = -1;
>my programs are "type-safe"!
Haskell:
>type systems are about making sure i don't pass a string to a function expecting an int, but with fewer type declarations and more parametric polymorphism!
>muh moan ads!
>proceeds to implement a "monad" that violates the monad laws
>my programs are "type-safe"!
Idris:
>programs are proofs!
>proceeds to implement formally verified tic-tac-toe in 2,000 LoC
>never gets anything useful done
>at least my programs are correct!
"Linear types will save systems programming":
>o-okay, Hasklel is useless, but we can at least leverage type theory to attain some memory safety
>continually posts pseudocode in a non-existent language
>never does any actual programming
>my programs could've been memory safe!
Lisp:
>doesn't pass strings to functions expecting ints
>has a theorem-proving organ called a "brain", employs an external proof assistant when necessary
>chooses a level of rigor appropriate for the task
>able to dissect the domain of a function for quick REPL verification
>doesn't have to worry about memory safety; has a GC
>memory-safe and mostly correct programs
You have 0.1 seconds to explain why you're still a type virgin and not a Lisp chad.
>>
>>64293737
I was very amused his reaction towards C, that's all.
>>
>>64293767
Yeah. Well it'd be funny to me if his talk wasn't just sepples-insanity laid bare.
>>
File: 1511427588899.png (155 KB, 665x1257)
155 KB
155 KB PNG
>>64293765
>You have 0.1 seconds to explain why you're still a type virgin and not a Lisp chad.
>>
>>64293668
i do not know what you individually have to say because you are one of a cult with many members. but i invite you to state your argument again, but thats if you even have one.
I for one act with reason but you accuse me of operating by emotion. nice inversion. actually i am on the side of science.
>>
>>64293747
You were specifically promoting preprocessor macros as an alternative to templates.
>>
>>64293779
>b-but lisp is faster than haskell!!
>>
File: 1515748727279.png (14 KB, 578x438)
14 KB
14 KB PNG
>>64293765
>>
>>64293780
>i do not know what you individually have to say
Well, then quit pretending that you do, so you won't have to backpedal so much when asked to provide quotes.

>i invite you to state your argument again
I just did. Do you want me to quote it for you? Here you go:
>type system fanboys behave in a cult-like fashion. Cult-like behavior is irrational. Effective programming requires a rational approach. Therefore, type system fanboys are ineffective programmers.

>you accuse me of operating by emotion. nice inversion. actually i am on the side of science.
That, in and of itself, is an emotional and irrational statement.
>>
>>64293759
That makes a lot of sense. Thanks, dude.
>>
>>64293797
Another solid argument from the type evangelists.
>>
>>64293782
Sorry I wasn't clear. I wasn't that person.
But no he wasn't he was promoting generics through traditional polymorphism and macros.
I don't even think you should write code that way.
>>
>>64293841
I've got no problem with that then.
>>
>>64293765
>You have 0.1 seconds to explain why you're still a type virgin and not a Lisp chad.
Racket is slow and requires a VM.
Common Lisp hello world program is 25M.
Chicken Scheme is a toy.
>>
File: type.png (21 KB, 681x533)
21 KB
21 KB PNG
>>64293834
>>
>>64293852
>conveniently avoids mentioning chez
>>
>>64293853
racket is a lisp and has one of the most advanced type systems, idiot.
>>
>>64293871
Great, another implementation of a dead language.
>>
>>64293852
>Racket is slow and requires a VM.
May or may not be a problem, depending on the use case.

>Common Lisp hello world program is 25M.
May or may not be a problem, depending on the use case.
>>
>>64293852
>i am confusing programming languages with their implementations
>>
>>64291321

Turing completeness is the ability to compute any computable functionality. In short, if a electronic device cannot execute a Turing complete language, it is not a computer (calculators for instance)

The halting problem is that it's not possible in general to tell by looking at a program's source code whether it will exit or continue to execute forever.

Given what the previous poster went on to say about programs accepting input and producing output forever in our current age of preemptive multitasking, I would say the halting problem does indeed not matter any more.
>>
you could judge the idea by its own virtues and not by a handful of persons which adhere to it.
>That, in and of itself, is an emotional and irrational statement.
this gets remarkable. we are at maximum inversion now
>>
>>64293888
JavaScript is a good language depending on the use case.
Stay mad Lisp shills. Lisp was born at the MIT and died there.
>>
>>64293895
>I would say the halting problem does indeed not matter any more
That's because you're too dumb to see beyond the original problem statement. There are many other problems that are undecidable because they're isomorphic to the halting problem.
>>
oops forgot to point this post >>64293901 at >>64293820
>>
>>64292971
>https://youtu.be/UHv_Jog9Xuc [Embed]
>01:14:30
https://youtu.be/UHv_Jog9Xuc?t=4479
ftfy
makes it more likely for the lads to click dat link and get learned
>>
>>64293907
>JavaScript is a good language depending on the use case.
JavaScript is, inherently, a shit language. What you were complaining about is overhead induced by implementations of a non-shit language, which may or may not matter. Do you have anything non-retarded to say?
>>
>>64291221

HTML5 is a markup language, not a programming language.

However, JavaScript despite it many faults, is a programming language.

Your confusion here probably comes from people lumping client side web technologies together under the umbrella term of HTML5.

If HTML on it own were Turing complete, its creators would likely have called it HTPL
>>
File: wojak-brainlet1.png (9 KB, 300x300)
9 KB
9 KB PNG
>>64293901
>you could judge the idea by its own virtues and not by a handful of persons which adhere to it.
Which idea was I judging, fucktardino? Provide quotes. So far I've been talking about type system evangelists polluting software engineering with their irrational dogma.

>my subjective likes/dislikes with regards to type systems are scientific
>science is about value judgments
>science is on MY side
>these are not irrational and emotional statements
>>
>>64293933
Your 'depending on the use case' argument is complete trash. So is every Lisp out there. The only purpose of Lisp was for mental masturbation (see RMS). Real men used Fortran and later C. If you want to give yourself the illusion that you're intellectually superior, use Haskell.
>>
>>64293976
>the basics of engineering are complete trash
Okay, kid.
>>
>>64294010
>the basics of type theory are complete trash
Ok, kid.
>>
>>64294015
Who are you quoting, fucktard?
>>
>>64294058
lispcuck BTFO yet again
every single thread you make an embarrassment of yourself and your meme cult
are you false-flagging?
why do you hate lisp so much that you're pretending to be a cliche smug lisp weenie
tsk tsk
>>
>>64293957
the idea is not going to go far if it is not communicated. as i am concerned it is not pullution nor dogma but an interesting contribution to computer science with display of potential.
computer engineering has obvious failings no one can desire improvement and sit forever in comfortable status quo
>>
>>64294058
>the basics of engineering are complete trash
I never said that, fucktard. Stop making shit up. Your language is dead and nobody misses it.
>>
>>64294085
>as i am concerned it is not pullution nor dogma but an interesting contribution to computer science
So when members of your cult insist that Haskell/Idris/Coq/meme-of-the-month occupies some universal optimum on the spectrum between full dynamic typing and full-blown theorem-proving autism, they are contributing to computer science? That's an interesting perspective.
>>
>>64294126
>I never said that, fucktard
Oh, really? Then what's this?
>Your 'depending on the use case' argument is complete trash
You're literally stating that weighing the pros/cons of various tools/technologies doesn't depend on the problem you're solving, thereby dismissing every engineering discipline and siding with the cargo cultists.
>>
I am looking into MERN stack and/or meteor/react dev. But I could do with an idea of something simple to make for myself from scratch to learn.

The tutorials I have done do not resonate with me all that well so I need to jump in and fuck around with it.

One thing that does annoy me with meteor is having to know 100 packages to install and those to uninstall to even get started.
>>
>>64294146
I'd rather side with the so called 'cargo cultists' and write solid applications than use deprecated tools/technologies.
>>
>>64289685
You guys should learn to love each other. But I know you will refuse, so I will contribute my hate and tell you all to fuck off.
>>
>>64294187
rude
>>
>>64294186
>declares the basic premise of all engineering to be trash
>"i never said that"
>quoted as basically saying that
>w-well okay, a-at least i don't use this thing that is so OLD! i-i mean it's the current year!
>>
>>64294204
Where does it say that Lisp is the basic premise of all engineering? It's just another language.
>>
>>64294187
post feet
>>
>>64294129
i am not a member of this which you call a cult.
i do not share the same study focus, and i originate from cultures of oop and lisp. academic groups have often more affinity for one school of doing things. it does not prevent me from looking outside of my box. appearently you however are not capable of it.
>>
>>64294214
>Your 'depending on the use case' argument is complete trash
You're literally stating that weighing the pros/cons of various tools/technologies doesn't depend on the problem you're solving, thereby dismissing every engineering discipline.
>>
>>64294129
> don't know haskell supports dynamic typing, as it is really a special case of static typing
>>
>>64294224
>it does not prevent me from looking outside of my box. appearently you however are not capable of it.
Are you accusing me of being incapable of sharing the delusion that Haskell/Idris/Coq/meme-of-the-month occupies some universal optimum on the spectrum between full dynamic typing and full-blown theorem-proving autism?
>>
>>64294229
>of various tools/technologies
Be more concrete.
>>
>>64294237
>don't know lisp supports static typing, as it is really a special case of metaprogramming
>>
>>64289685
Doing muh homework. I have to implement a functor that does domain composition for an abstract interpreter and I have no idea, not even the least bit of intuition about how I have to proceed.
I don't even know what a functor is or how to program in ocaml.
>>
>>64289685
I see what you did there...
>>
>>64294247
>Be more concrete.
There's nothing to be "concrete" about. It's what directly follows from your statement.
>>
>>64294273
What 'various tools/technologies' are still relevant and exclusive to Lisps?
>>
>>64294280
>desperate deflection ensues
Here's a quote from you:
>Your 'depending on the use case' argument is complete trash
You're literally stating that weighing the pros/cons of various tools/technologies doesn't depend on the problem you're solving, thereby dismissing every engineering discipline. What does your retarded statement dismissing engineering have to do with Lisp specifically?
>>
>>64294298
Either your brain has stopped functioning or I'm talking to a bot.
What makes Lisp still relevant?
>>
>>64294244
i do not agree to this either because many elements must enter consideration. i would never consider it like you say a universal optimum. to pretend it is hiding a part of the picture.
>>
File: fucktard.png (53 KB, 403x448)
53 KB
53 KB PNG
>>64294316
>you shouldn't use X because it has such and such overhead
This overhead may not matter, depending on the use case.
>your argument about use cases is trash! this one negative factor has am infinite weight!
This sort of reasoning dismisses every form of engineering.
>i never said that
Yes you did.
>lalalalalalala i can't hear you! p-p-prove that lisp is relevant
>>
>>64294316
>lisp
>relevant
hah
>>
File: 201708090252587.jpg (26 KB, 345x285)
26 KB
26 KB JPG
So I'm fucking with Json for the first time in C# .NET. Is LINQ to JSON using Json.NET a good way to go? Am I on the right track here?
>>
>>64294349
lispcuck continues to desperately move the goalposts
really doing a good job of scaring away any kids foolish enough to be interested in lisp, m8
>>
File: file.png (39 KB, 969x292)
39 KB
39 KB PNG
plz help me making my baby's first C# program
I'm trying to make and HslColor object but VS 2017 don't let me, pic related.
 Color avg = Average(TakeScreen());
HSLColor hsl;
hsl = hsl.FromRgbColor(avg);


doc: https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.modeling.diagrams.hslcolor.aspx?f=255&MSPPError=-2147217396

my usings:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.IO.Ports;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows;
using System.Windows.Forms;

(System.Object in the doc doesn't seems to exist)
>>
>>64294320
>i would never consider it like you say a universal optimum.
Then maybe you're not completely retarded. Too bad the same can't be said about typical Idris/Haskell shills ITT.
>>
>>64294259
> lisp
>>
>>64294382
you're really butthurt about Haskell aren't you
>>
>>64294349
Do you even use Lisp yourself? You sound like a fanboy without any knowledge on the subject.
>>
>>64294362
>move the goalposts
Here's what started this exchange:
>>64293852
>Racket is slow and requires a VM.
>Common Lisp hello world program is 25M.
>>64293888
>May or may not be a problem, depending on the use case.
What goalposts am I moving, you cretin?
>>
>>64294404
You've never given a reason why Lisp is still relevant.
>>
>>64294377
>HSLColor
look really closely at it
then look at your code
>>
>>64294389
>Do you even use Lisp yourself?
Yes. Now screech me some more about how 25MB of overhead rules out a technology regardless of the use case, and how pointing out that you should weigh the cons relative to the use case is a "trash argument".
>>
>>64294263
A (covariant) functor F : C -> D is a mapping between two categories (C, .) and (D, *) such that:
(i) for every X in Ob(C), F(X) is in Ob(D)
(ii) for every f : X -> Y in Hom(C), F(f) : F(X) -> F(Y) and the following must hold
(iii) for every X in Ob(C), F(id_X) = id_{F(X)}
(iv) for every f, g in Hom(C), F(f . g) = F(f) * F(g)

A contravariant functor is just a functor between C^{op} and D.
>>
>>64294427
it's the same for HslColor, look at the screenshot
>>
>>64294425
>accuses me of moving the goal post
>unable to explain how the goal post was moved
>proceeds to blatantly move the goal post
>>
>>64294263
http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html
>>
>>64294377
>Namespace: >Microsoft.VisualStudio.Modeling.Diagrams
use the namespace?
>>
> ignore forty years plus of research, says it's a cult
> can not monads, can not lift
>>
>>64294481
>mindless type system fanboys are "40 years of research"
>thinks the same functionality as monads can't be achieved without static typing
>>
>>64294443
>doc: https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.modeling.diagrams.hslcolor.aspx?f=255&MSPPError=-2147217396
>Namespace: Microsoft.VisualStudio.Modeling.Diagrams
>my usings: [missing Microsoft.VisualStudio.Modeling.Diagrams
]
either I am retarded, or you are
>>
>>64294500
>everything that can be achieved with static typing can be done with dynamic typing toooo
this is what lispcucks actually believe
>>
Next Thread: >>64294532
>>
>>64294531
Who are you quoting, fucktard? I said monad-like functionality doesn't require static typing.
>>
>>64294500
but the "functionality" of monads needs static typing (for disallowing operations you don't want)... or else we would just use ContT for everything. You are exposing your ignorance and embarassing yourself
>>
I used to be a competent full stack web dev with PHP, MariaDB, HTML, Vanilla JS and CSS.

After 2 years writing some shitty propriety language as a software Dev with only other exposures being bash and powershell...What should I do?

What language should I pick up and get a new career with because I really am not enjoying my job anymore, it was interesting at first, learning the language, finding issues and fixing the compiler (written in C) but I just do large projects in their own language and its fairly boring, I am underpaid and last year was not given any room for salary negotiation (Everyone just got the same standard pay raise of 1.2% (Inflation was 2.7%)).

Should I go back to webdev picking up some 'flavour of the month' JS frameworks or go for a software language like C# or Java as they are more common.
>>
>>64294554
>but the "functionality" of monads needs static typing
It doesn't.
>disallowing operations you don't want
Monads have nothing to do with "disallowing operations you don't want". They essentially let you redefine what binding and sequencing means in some context based on type. This can be done without static typing.
>>
>>64294586
All monads can be implemented on top of callbacks (continuations). But the "point" of them, in practice --- that is, the part you just can't grasp --- is to restrict your type to represent only the operations you want, for that you need static typing, or else you are just using callbacks and can't guarantee shit, eg: the inline array update problem, etc.
>>
File: file.png (50 KB, 1377x238)
50 KB
50 KB PNG
>>64294516
>either I am retarded, or you are
I probably am, it's my first time using a non-web language.
Where do I find that reference? I can't find it.
Did they remove it in VS 2017? (the doc is for VS 2015).

Googleing "HslColor VisualStudio 2017" didnt help. I found this https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.imaging.hslcolor?view=visualstudiosdk-2017 , but same problem, I can't find Microsoft.VisualStudio.Imaging
>>
>>64294684
>the "point" of them is to restrict your type to represent only the operations you want
False. The point of them is to redefine what binding and sequencing means in some context based on type. Your opinions on this matter are irrelevant.
>>
>>64294717
http://www.cs.bham.ac.uk/~udr/papers/imperative-functional.pdf

You are not wrong in your last statement, but neither do I, just read section 6.3.
>>
>>64291043
O(1) is e.g. reading the last letter and then the letter number 1000 mod (book length).
>>
>>64294896
You literally just sent a random paper. There is no section 6.3 there. Nice try to gain credibility, though. Provide actual sourced quotes next time.
>>
>>64294943

LOL, I'm so tired. I declare you a winner, anon. And I even concede Lisps are not too shabby.

But the /correct/ link is: https://www.cse.iitk.ac.in/users/karkare/courses/2010/cs653/Papers/imperative.pdf

Section 6.3. But who cares?
>>
>>64294567
I don't think you well get an answer here, most people are skiddies who don't know how to code.

Just do what you want.
>>
>>64294985
Not the anon you're arguing with, but why does anyone have to win? Why can't you faggots just get along?
>>
>>64294985
>Section 6.3. But who cares?
Section 6.3 shows that proper monads can't be implemented using continuations. It says nothing about "the point" of monads being what you claim it is, and I never said proper monads can be implemented using continuations. Nice try again.
>>
>>64295041
> Section 6.3 shows that proper monads can't be implemented using continuations.
Yes, because you need types for that. But you said you can implement them in any dynamic language, right?

">thinks the same functionality as monads can't be achieved without static typing"

> It says nothing about "the point" of monads being what you claim it is

I kinda take that back because it's confusing to explain it for outsiders. Sorry.

> and I never said proper monads can be implemented using continuations

No you didn't. But you implied it here:

"False. The point of them is to redefine what binding and sequencing means in some context based on type. Your opinions on this matter are irrelevant."

Or else how would you do that? You can implement binding and sequencing overloading in any language (using cont's).

But the science text -- and anyone can experiment with this stuff, its really basic -- says they are not the same. *Because the types*.

*Because the types*.
>>
>>64295206
>But you said you can implement them in any dynamic language, right?
I said the functionality of monads doesn't require static typing. I never said anything about implementing monads, or it being possible in "any" dynamically typed language. I don't consider type-correctness to be a functionality of monads. What makes this whole discussion even funnier is that Haskellers can happily implement "monads" that don't follow the monad laws and the type system won't catch it.

>But you implied it here:
No, I didn't "imply" anything. I stated that the practical use case for monads is to redefine what binding and sequencing means, and that static typing is not necessary for this. You seem to have really poor reading comprehension.
>>
>>64295265
> I don't consider type-correctness to be a functionality of monads.

You have a misconception The case is not the type-correctness, the type system is needed to "model" the monadic effect in a precise way (read the entire section 6).

> I stated that the practical use case for monads is to redefine what binding and sequencing means, and that static typing is not necessary for this.

You don't seem to have a good comprehension of what binding and sequencing overloading entails. You need callbacks.

> What makes this whole discussion even funnier is that Haskellers can happily implement "monads" that don't follow the monad laws and the type system won't catch it.

You are right. But it's not funny nor a tragedy. It's practical to be lawless sometimes.

Learn haskell please.
>>
>>64295460
>the type system is needed to "model" the monadic effect in a precise way
Prove it.

> (read the entire section 6).
Not an argument.

>You don't seem to have a good comprehension of what binding and sequencing overloading entails
Prove it.

>Learn haskell please.
I already did, and it's a cute toy. Doesn't change the fact that you're wrong.
>>
>>64289685
Why would I want to use monads in Haskell, when I can have monads in Lisp?
https://common-lisp.net/project/cl-monad-macros/monad-macros.htm
>>
>>64295537
Why would you want to use monads in Lisp at all is beyond me. There are usually nicer ways to do whatever it is you're trying to use monads for.
>>
>>64295548
Indeed, metaprogramming is far superior.
>>
>>64295572
metaprogramming is normally a crutch for poor programming languages
>>
>>64295607
On the contrary, sufficiently powerful metaprogramming allows you to adapt the present programming language into a DSL appropriate for most any use case.
>>
>>64295607
>metaprogramming is normally a crutch for poor programming languages
That's the perspective of low-IQ Haskellers who can only understand metaprogramming where its function overlaps with FP abstractions.
>>
>>64295491
> Prove it.
I don't want or particularly need to.

> I already did, and it's a cute toy.
:<|>
>>
>>64295629
so does a good programming language, and the better it is the less you need to adapt
>>
>>64295644
No matter how "good" it is, you will need to adapt.
>>
syntactic abstraction is a code smell
>>
>>64295639
>I don't want or particularly need to.
Then you basically concede to spewing rubbish that you can't back up with any solid reasoning. Show me a monad with functionality that can't be recreated without static typing.
>>
>>64295644
>so does a good programming language, and the better it is the less you need to adapt
I guess "good programming languages" don't exist, then, because Haskell/Idris/whatever you're shilling for certainly isn't good for all purposes, if any.
>>
>>64295652
>syntactic abstraction is a code smell
Making statements like yours is a cognitive ability smell. ;^)
>>
>>64289685
metaobjects > kinds
>>
>>64295656
> Show me a monad with functionality that can't be recreated without static typing.
Why would you recreate monads in impure dynamic languages?
It's funny how you don't know what you are talking about and keep asking for things that doesn't make any sense.

Just learn haskell please. Maybe you are not too old yet.
>>
>>64295766
This already exists: see https://common-lisp.net/project/cl-monad-macros/monad-macros.htm
>>
>>64295766
>can't provide an example of a monad with functionality that can't be replicated without static typing
>desperate deflection ensues
Alright, everything is clear. Shoo, animal.
>>
>>64295827
> failing to understand the concept of turing completeness

Again, the paper. Section 6.3. You can't make the same thing without the types. This fucking library is not the *same thing*, it's an useless emulation.
>>
>>64295885
Haskell is the C++ of pure FP.
>>
>>64295885
>You can't make the same thing without the types
Basic reading comprehension is too difficult for you, huh? Did I say anything about making "the same thing", you retarded animal? I said the same functionality can be replicated. I don't believe you're that stupid. Your deflection basically amounts to a concession, and I'm glad you're finally starting to see the root of your error.
>>
>>64295945
Yep, you want to "replicate" the "same practical use case". But this makes absolute no sense outside of pure fp, you should know that. You are not worthy of my time.
>>
>>64295971
Pure FP will never experience widespread success outside of academia.
>>
>>64296006
I agree, is too hard for webdevs. Maybe that's good?
>>
>>64295971
>durrr your language doesn't even support monads!
Okay, but I could do pretty much the same thing without monads if I wanted to.
>hurrr no you can't because muh not real monads
But I'm not saying it would be exactly the same abstraction as a Haskell monad, just that you could use it the same way.
>hurrr no you can't because muh not real monads
Okay, then give me an example of a monad for which my statement is false.
>heeerrrrdurr you are asking for something that makes no sense
Why?
>durr because why would you want to accomplish the same thing monads are used for outside of pure FP?
>hurrr your language doesn't even support monads though lol monadlet
Simply subhuman. ;^)
>>
>>64296081
There is no "practical use case" you can do in x that you can't do in y programming language. But this doesn't lead anywhere. You are missing, by a mile. Stop searching for excuses, learn haskell.
>>
>>64296285
Au contraire, learn Lisp.
>>
>>64296308
learn them both, ffs
>>
>>64296335
No.
>>
>>64296285
>There is no "practical use case" you can do in x that you can't do in y programming language
>You are missing, by a mile.
You are. I'm not only saying it can done, but that it can be done in completely analogous way as far as code structure and outcome is concerned. So what exactly do your monads add to the table from a practical standpoint, you autist?




Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.