[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 333
Thread images: 32

File: hidamari_dpt_waifu2x_traps.png (2MB, 1618x1308px) Image search: [Google]
hidamari_dpt_waifu2x_traps.png
2MB, 1618x1308px
Old thread: >>61193427

What are you working on, /g/?
>>
>>61200561
AVL-based memory allocator using only standard C
>>
File: i_have_autism.png (207KB, 403x433px) Image search: [Google]
i_have_autism.png
207KB, 403x433px
>>61200561
I'm going to try write an IRC bot in Ruby.
>>
>>61200561
Thanks for anime picture.
>>
>>61200493
so how the fuck do I pass a lmbda to the constructor?

auto foo = [](){//do stuff};

FooBar f* = new FooBar(foo);


and then in the class set the expression as a local variable(?) (function pointer?). how do I do that?
>>
>>61200645
It gets promoted to function pointer anyways but it's not worth the mess. Use std::function, it's what it was designed for.
>>
>>61200561
>What are you working on, /g/?
Have signed up on codewars.com, i am now ready to engage fights in the kumite. Anyone want to fight me? (beginners only)

>>61200561
Thank you for using an anime image.
>>
>>61200561
Printf debugging with no I/O.
>>
>>61200645

#include <iostream>
#include <functional>

class LambdaAcceptor
{
public:
LambdaAcceptor(std::function<void()> lambda):
lambda(lambda)
{ }
void invokeLambda()
{
lambda();
}
private:
std::function<void()> lambda;
};

int main(int argc, char **argv)
{
auto lambda = [](){ std::cout << "Hello from the lambda!"; };
LambdaAcceptor lambda_acceptor(lambda);
lambda_acceptor.invokeLambda();
}
>>
I'm fascinated by this code.
#include <iostream>

class HelloInterface
{
public:
virtual void sayHello() = 0;
};

int main(int argc, char **argv)
{
class : HelloInterface
{
public:
void sayHello() override
{
std::cout << "Hello from an anonymous class!";
}
} obj;
obj.sayHello();
}


Can I also heap-allocate this kind of anonymous class?
>>
>>61200734
>anonymous class
Doesn't mean what you think. It's clearly a named class, you just didn't bind the type to a symbol.
>>
>>61200755
>It's clearly a named class
What's its name?
>>
>>61200755
>t's clearly a named class
what's its name then?
>>
>>61200769
>>61200774
Whatever gets produced in the object code
>>
File: 1498972265739.png (2MB, 1920x1080px) Image search: [Google]
1498972265739.png
2MB, 1920x1080px
Is intellisense in vs 2017 completely broken for anyone else?
>>
>>61200783
That's for the compiler to worry about, that's not part of the code I wrote.
But regardless, it doesn't answer my question.
>>
>>61200719
nice thanks. that works.
>>
>>61200802
if you mean with broken "total heap of horseshit" then yes.
>>
>>61200802
Not for me, it's working fine.

What are you expecting to get with this question? You haven't specified anything.
>>
>>61200783
in the object code? what the fuck are you talking about? we, the programmers, are not reading the object code, we are reading the c++ code where that class has no name.
>>
>>61200676
How do I fight you anon? Do I write some obfuscated code and then win?
>>
>>61200830
It's slow as fuck. It stops working outright sometimes.
>>
>>61200852
Works On My Machineā„¢
>>
File: circuitgirls.jpg (2MB, 3840x2160px) Image search: [Google]
circuitgirls.jpg
2MB, 3840x2160px
>>61200851
I don't want to fight anymore but thank you anyway.
>>
>>61200881
cute
CUTE!
>>
>>61200881
>tfw when you will never solder circuits with cute tomboy girl
>>
>Can destructure tuples when using "let"
>Can't do it anywhere else
Holy shit how can Rust be so annoying.
>>
>>61201496
that's surprising because communist really excell in destroying
>>
>>61201525
Stop shitposting you faggot.
>>
File: 1474088525342.jpg (3MB, 3504x2336px) Image search: [Google]
1474088525342.jpg
3MB, 3504x2336px
just shaved off my literal neckbeard

i am a cs grad student, expert c programmer and haskell enthusiast

what happens to my programming ability now?
>>
>>61201581
Now shave the rest of your body and put on your programming socks
>>
>>61201747
t-that's kind of gay
>>
>>61201747

>shave the rest of your body

nu-male, pls go
>>
>>61201784
Hello, plebbit!
>>
>>61201784
>he doesn't know the meme
>>
>>61201784
there is literally nothing wrong with having a feminine penis and dressing like a qt schoolgirl
>>
 * The 2*sizeof(size_t) alignment here is borrowed from GNU libc, so it should
* be good most everywhere. It is more conservative than is needed on some
* 64-bit platforms, but ia64 does require a 16-byte alignment. The SIMD
* extensions for x86 and ppc32 would want a larger alignment than this, but
* we don't need to do better than malloc.

It's this kind of shit webdev mentality "we don't need to do better" why we can never have efficient software.
>>
File: 1496959338059.png (1MB, 1702x2471px) Image search: [Google]
1496959338059.png
1MB, 1702x2471px
>>61201747
>not maximizing your programming ability
Get a load of this faggot
>>
>>61202023
Meant for >>61201784
>>
>complete a simple java project for a client
>sudden urge to eat some curry
hmm
>>
>>61202105
k tard
>>
Garbage collection is a crutch for bad programmers.
>>
>>61200802
use ed
>>
>>61202191
programming languages are a crutch for bad programmers
>>
What happened to the torrent for programming books?
>>
>>61200774
Arya Stark.
>>
>>61202219
obsolete
>>
File: 1436246981213.jpg (149KB, 784x811px) Image search: [Google]
1436246981213.jpg
149KB, 784x811px
>Unity is bloat shit
>Godot gives me undefined behaviour that can't fix it
>Libgdx is java
>The other engines are even worse
Welp, time to kill myself and use SDL.
>>
>>61202191
Manual memory handling is not necessary for most programs.
>>
>>61202191
I bet you think manual transmissions are an acceptable safety risk and shouldn't be banned, too.
>>
>>61202315
What a surprise, it's the shart-in-marts dragging standards down.
>>
>>61202335
I'm German, idiot.
>>
>>61202295
jmonkey is java but kind of comfy.
You could go with Urho3D or Gameplay3D.
>>
>>61202295
ue4
>>
>>61202191
If you thinkg manual memory management proves your "smartness" then I feel so sad for you, brainlet
>>
>>61202345
>>61202346
>recomending fucking bloat and literal worse engines than unity
>>
>>61202248
She is like 9 you fucking pedo.
>>
>>61202257
NVM found my old magnet link. Unsurprising lack of R books, which I need because statistician.
>>
>>61202295
make your fucking own you lazy babby ass
>>
>>61202359
then write your own, you derp. you call everything bloat dont seem to have the first clue about anything.
>>
>>61202346
How can you suggest a non-free engine? Fuck off.
>>
>>61200561
Fun C++ fact. Passing a lambda to std::sort can give a 7x performance improvement in some cases over giving it a function pointer.

If you want fast C++ code, use lambdas and templates extensively. Don't write C with classes. Don't write Java without GC. Use the generic & functional zero cose abstractions that C++ offers.
>>
>>61202359
IOQUAKE3 YOU FOOL
>>
>>61202383
>you need UE4 and unity to make a mario clone
>"modern programers"
>>
>>61202348
Any retard can scope his variables, it's not even hard. That's why it's so sad.
>>
>>61202399
>I need an engine for a mario clone
indeed kek

>>61202384
I dont really care about stallman cucks like yourself
>>
>>61202390
Doesn't D have pretty strong template functionality? It's the only reason I can think to use it desu
>>
>>61202410
>stallman cucks like yourself
>he is the one who gets cucked by using non-free software
/g/ is not for you, fuck off back to be or something
>>
>>61202390
>>61202414
templates are shit
come at me
>>
>>61202414
>Arya Stark.
There is a book on D's templates. I think it's pretty cool
>>
>>61202430
>He lives in a world where he can't trust other people
Poor you.
>>
File: 1498108612020.webm (924KB, 600x336px) Image search: [Google]
1498108612020.webm
924KB, 600x336px
Your lack of python code does disturbs me
>>
>>61202430
you are the one who promotes that everyone can do whatever the fuck they want with your software. you are too weak to defend your property and let niggers fuck it in front of you. the pure essence of cucking
>>
>>61202453
wtf is govnocode
>>
>>61202467
Shitcode
>>
>>61202450
>he trusts people who refuse to show the code
lol

Also, foss is not only about showing code, there are many other freedoms as well.

>>61202460
Why are you still here?
>>
>>61202443
I don't fight retards.
>>
>>61200645
>so how the fuck do I pass a lmbda to the constructor?
class MyClass {
public:
template <class Lambda>
MyClass(Lambda l) {
// Implementation
}
};
...
MyClass my_instance([](){});
>>
>>61202476
but it's already python
>>
>>61202482
Go promote your communism somewhere else please.
>>
File: parametric.png (616KB, 680x954px) Image search: [Google]
parametric.png
616KB, 680x954px
>>61202488
>>
File: 1493022896377.jpg (49KB, 579x433px) Image search: [Google]
1493022896377.jpg
49KB, 579x433px
>>61202482
dont worry, I will be here forever. and so will you
>>
>>61202511
>>61202514
The fact that you do not belong here will never change.
>>
File: 1470354509492.jpg (34KB, 548x782px) Image search: [Google]
1470354509492.jpg
34KB, 548x782px
>>61202522
well that's too bad for you, isn't it
>>
>>61202495
Exactly
>>
>>61202489
>Not using single uppercase letters as type parameters
>>
>>61202563
>not using single lowercase letters as parameters

we haskell now
>>
>>61201970
what is this from
>>
>>61202295
https://love2d.org/
>>
>>61202563
But that would be less informative.
What happens if I say my template function accepts a T and someone tries to put something in there that could possibly be a T but they aren't sure because T isn't actually a type outside this context and then it turns out the thing they passed wasn't a T and there's nothing about the name T that should have told them it wouldn't be a T?
>>
File: 1497150233764.jpg (109KB, 588x647px) Image search: [Google]
1497150233764.jpg
109KB, 588x647px
>>61202450
Sure goyim, you trust us, right?
>>
>>61202576
wiresharks memory allocator.
>>
>>61202443
Templates are shit compared to what they could be, but they are significantly less shit than not having any equivalent functionality at all.
>>
>>61202608
I am a Jew and I look kind of like this except I don't look like I'm rubbing my hands together and scheming and my nose is big but not quite as big as the nose in that picture
Should I be offended?
>>
>>61202645
you cant trick us
>>
>>61202617
void* is about as type safe as templates pre-instantiation
>>
>>61202443
I believe your impression on template is inflenced by C++ templates. FYI, you should not set C++ as a standard since it's generally mediocre at what it does (or tries to achieve)
>>
>>61202645
>I am a *ew
>>>/o/ven
>>
>>61202655
Please explain
>>
>>61202673
That's very rude
>>
File: 1472573632756.gif (1021KB, 421x389px) Image search: [Google]
1472573632756.gif
1021KB, 421x389px
>>61202567
lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b
>>
>>61202664
no, all templates
including D
>>
>>61202722
>>61202664
>>
>>61202674
here a picture of you scheming our downfall
>>
>>61202694
I cannot actually read Haskell, but if I'm reading this right, lens is a function of an anonymous type that accepts a function that takes an instance of s and returns an instance of a, and a function that takes an instance of s and an instance of b and returns an instance of t, and returns an instance of the parametrization of Lens over types s, t, a, and b.
If I'm wrong, what does that actually say?
If I'm right, that's all well and good, but where do the instances of s and b originally come from?
Or are they not used in the implementation of Lens?
>>
>>61202736
name good templates
>>
>>61202753
The ones you implement
>>
>>61202746
Why would I do that though
Apart from the fact that people are shit and keep memeing jew memes at me like they are fuckin hot potatoes
>>
File: picture_1.png (482KB, 640x480px) Image search: [Google]
picture_1.png
482KB, 640x480px
writing an Expert System for EDA/circuit simulation in LISP
>>
>>61202749
Pretty good, but can you tell what any of these parametrized types are supposed to represent from that one letter?
>>
>>61202749
stab are all type parameters
e.g. template <typename s, typename t, typename a, typename b>
they're implicitly quantified (because they're free type variables)


lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b

lens takes a function (s to a) and a function ((s and b) to t) and gives back a (Lens s t a b)

type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t

A lens allows you to change an s into a t (within a functor, so it can be effectful e.g. a transformation that does IO) by changing an a into a b.
The main concept is that this is like a nested element, and lenses let you manipulate fields within types.

There's also a definition
type Lens' = Simple Lens

which expands to
type Lens' s a = Lens s s a a

This is for when the types are fixed.

An example is a pair (a, b)
Using a Lens (not a Simple Lens) you can actually change the second field (which is a b) to another type, e.g. c, and this will change the overall type to (a, c)
So this lens has the type

Lens (a, b) (a, c) b c

-- note that (a,b) is a single type, as is (a, c)

Going back to the lens function
lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b

We can see that (s -> a) gets the field, (s -> b -> t) sets the field (remember the types themselves change (a -> b), (s -> t)) and so we can build a Lens out of it.
Specialised to Simple Lens or Lens'

lens' :: (owner -> field) -> (owner -> field -> owner) -> Lens' owner field
>>
when a lambda in c++ can't access the members of the class in which it was defined it seems a stupid concept. java doesnt have such problems.
>>
>>61202963
That's what the capture list is for dummy.
>>
File: 12qwertghnjm.png (9KB, 681x311px) Image search: [Google]
12qwertghnjm.png
9KB, 681x311px
is Ā£35k - Ā£55k a good salary for someone in London as a developer?
>>
>>61203012
>going to london
enjoy your niggertown
>>
>>61203012
London isn't a very nice place to live
And even if it were, it is EXTREMELY expensive if you aren't a minority being subsidised by the government
>>
>>61203012
amazing picture
>>
>>61203027
>>61203028
yeah, basically all these recruiters from LinkedIn offered me a job in London (i'm from europe) and was just wondering
>>
>>61203063
if you dont mind living in bangalor downtown just go right ahead
>>
>>61203080
but the salaries in London are way higher than in my country.

though choice
>>
>>61203063
keep in mind that only a minority of people in london are white according to official figures from a few years ago (by now it's even worse, and the official figures aren't trustworthy)

it will only get worse, too
>>
>>61203108
just fucking nuke it, please.
>>
File: 1499059421063.jpg (38KB, 457x600px) Image search: [Google]
1499059421063.jpg
38KB, 457x600px
>>61200561
A website, and eventually an app.
I'm having to learn as I go, so it may take a while.
>>
>>61203100
london is one of the most expensive places. I bet you will be poorer than in your country.
>>
>>61203132
a lot of our good asians (i.e. asian asians and not fake bbc asians) are in london though
>>
>>61203100
You have to consider cost of living and quality of life in an area, and then extrapolate what salaries would be acceptable.

You can easily make $50-60k in San Francisco, hopefully more, but a one-bedroom shoebox costs $3,000/month.

Alternatively, you can make $50-60k in Houston, and a 3/4 bedroom house costs less than $1,500/month.
>>
how do you solve circular forward declaration problem in c++? can you split classes?
>>
>>61203144
what a shame
>>
Do you have to know much about economics to write a dumb trader that pops some profit?
>>
>>61203162
>circular forward declaration problem
which problem is that?
>>
>>61203170
just make one pseudo-random based and you're good to go
>>
>>61203133
It's good that you're learning, but be sure to head over to
>>>/g/wdg
for any webdev questions you might have.
>>
Meanwhile I am sitting here making $10k
I hope firstworlders wake up thanking god for their place of birth every single day
>>
>>61203208
I'll thank my ancestors instead. They built this for me, not you.
>>
>>61203216
>my ancestors
what if your ancestors were immigrants?
>>
>>61203229
in that case you have to go back
>>
>>61203241
you mean you?
>>
>>61203256
Im pure as it gets
>>
>>61203229
oh fuck off we're not sharing our first world with you
>>
>>61203277
You didn't build this though
>>
>>61203277
>>61203270
i live in Svalbard. though
>>
>>61203291
how many niggers?
>>
>>61203312
I've only seen one so far.

your mom's bull.
>>
>>61203288
i am a part of my ancestors and my descendants
>>
>>61200561
>/dpt/
>hardly any code in this thread
>>
>>61203344
No, you really aren't
>>
>>61203373
I don't need your nominalist bullshit thank you very much
>>
>>61203415
But it's true, it's bullshit for you to take any credit for something someone else did that you weren't involved in whatsoever, no matter how you're connected to them.
>>
>>61203361
>he thinks /dicks pussy tits/ general is for programming
get out ree
>>
>>61203441
>It's bullshit to let your mother feed you

This seems like an off question but have you ever played Dragon Age?
>>
>>61203541
No, I haven't
But yes, it's bullshit to let your mother feed you after somewhere around the age of 22
Same with your country / ancestors
It's not healthy either, your first world would have a much lower incidence of obesity, depression, and other stress related illnesses if at the age of adulthood it became socially acceptable and even expected for you to transcend both the protections and the limitations of your state and become a one-hundred-percent independent wildman with no need to rely on the grid
>>
File: dragon age black city.jpg (15KB, 400x179px) Image search: [Google]
dragon age black city.jpg
15KB, 400x179px
>>61203585
When you're 22 you ideally should be having your own children and feeding them.
The reason for obesity, depression, etc is because of liberalism and nominalism, the philosophy of choice.
>>
>>61203585
Obesity isn't a stress related illness, it's a gluttony related illness
>>
>>61203661
As someone who suffers from the opposite problem I wish I could agree but the evidence to the contrary is too compelling
Gluttony is not natural, it's a behavioral consequence of stress in a context where excess is available
Even if you're jealous of what someone has access to, you shouldn't judge them on how they behave when they're being crushed under the weight of deadlines, because in ideal circumstances, deadlines should not exist except insofar as dictated by physiological needs
>>
>>61203659
>When you're 22 you ideally should be having your own children and feeding them.
Agree.
>The reason for obesity, depression, etc is because of liberalism and nominalism, the philosophy of choice.
Disagree, liberalism and stress-related illnesses are both caused by the structure of your society.
Politics shouldn't even exist. In a perfect world, people are the sovereign rulers of themselves, and of no one else.
>>
File: 1497105980750.png (782KB, 1024x512px) Image search: [Google]
1497105980750.png
782KB, 1024x512px
>>61203659
is this now a bucko thread?
>>
>>61203885
>standoff degenerates into violence
They're missing two words here.
>standoff [PREPOSITION] degenerates [VERB] into violence
It's impossible to tell what they were trying to say.
>>
>>61203901
gib a ruh, gommie
>>
>>61203885
He's a faggot who'd never dare touch any real questions.
>>
>>61203962
like?
>>
>>61203975
how many licks does it take to get to the center of a tootsie pop
>>
>>61203999
exactly one (2)
>>
What the fuck are you guys shitposting for
>>
Hi /dpt/. I want a Mac of some description so that I can learn some iOS dev. I'm well able to develop on other platforms so I'm not a total noob, but I cannot distribute to iOS devices without a Mac. Don't want to go down the hackintosh route.

I've found a used 2014 Mac Mini, with 8GB Ram for ā‚¬450. Considering this new is ~ā‚¬850 this seems like a good deal, and is far cheaper than Macbooks etc. Before I pull the trigger - is there a better option that's more cost effective? Macbooks are upwards of ā‚¬1k which is just too much, and I'm wary of used ones. I know the 2012 Minis have upgradeable RAM, but I'm thinking the 8gb in this should do me fine when all it's used for is software development.
>>
>>61202567
>his language makes a distinction b/w upper and lower by default
>>
>>61204070
I haven't done iOS dev in a long time, but in case all you get is shit flinging I'll give my best answer. The iOS simulators have always been really performant compared to Android, so with 8GB of RAM (which should be plenty) as long as you're not doing game dev (and in some cases even if you are) a 2014 Mac Mini should be fine. At least, that's my estimation.
>>
>>61204151
yes, it does
>>
>>61204070
been there, my office bought us several used mac mini as well
don't think there is a better option
>>
>>61204196
>his language can't do this
(defun himegoto (A B c)
(+ a C b))
>>
>>61204151
>his language can't decide whether to make case distinctions on identifiers
>>
Ha, apparently ghc shrank in size from 1GB to 410MB.
>>
Is there any way to bypass Cross Origin blocks ?

Its a simple GET request but its getting denied.
>>
>>61204207
not if the readtable uses something else than covert to lowercase or uppercase. Dumb fag.
>>
>>61204177
>>61204199
Thanks a lot, both of you!!
>>
>>61204210
>having identifiers with the same sequence of letters but different cases
>having so many identifiers that this is a problem
>not having local identifiiers
>>
>>61202607
It will tell you what's wrong if you try to use it as a callable, and it isn't one.
>>
>>61204262
>using anything but the defaults
>>
Is the Haskell wikibook still a good resource? I want to try something else than Clojure.
>>
>>61204281
>not modifying the readtable
>thinking you are using lisp
You might as well use some blub language.
Dumb faggot.
>assuming the readtable stays unchanged
Naive retard who has never programmed anything in lisp.
>>
>>61204310
>using m-expressions
>>
>he doesn't call himself a C++ martial artist
>>
>>61203028
>London isn't a very nice place to live
Have you been there or do you think the entirety of one of the wealthiest and most important cities in the world is like the pictures of the council estates you see on /pol/?
>>
>>61204356
I was there and didnt see a single white person in days. felt very diverse
>>
>>61204366
>felt very diverse
Obviously not since it lacked white people
>>
>>61204366
My area is 100% white, stop hanging around in the shitholes
>>
Can someone explain to me why the other code worked when it was set to public and my code didn't?


https://cryptobin.co/f4m0q1q6

The code for decryption is DPT
>>
>>61204373
diversity is a measure for the lack of white people.
100% diverse -> 0% whites
>>
>>61204382
>Kensington is a shithole
>>
>>61204345
>he is not a martial artist while programming in c++
>he is not a blackbelt in taekwondo
>he is on this forum
>>
reminder that there's literally nothing wrong with pedophilia, it's doing sexual things with children that's the problem
>inb4 not programming related
c++ is faster than haskell
>>
>>61204435
>c++ is faster than haskell
shocking
>>
>>61204435
I would like to offer you a free helicopter ride
>>
>>61204291
Yes.
Install stack to install haskell.
>>
>>61204356
obviously it's zoned so that there are areas where the average black and the average pakistani can't buy houses
>>
>>61204391
if the methods aren't public, other classes can't call them
>>
>>61202664
retards itt
>>
I'm trying to make a playlist rebuilder.

I have a playlist with deprecated links but the files are still on the PC (windows). What's the best way to go about searching for the files locally? I don't know it's possible to communicate with the native file indexer...?
>>
>>61204472
using public ever is outing yourself as cuck
>>
>>61204481
always public, unless you care about invariants
>>
>>61204472
And.... you have to explicitely state them?
I mean, I understand... but...this made me soooo angry and I literally spend days watching the wall and then someone comes and says, lol. just make it public....
>>
>>61204497
yes, this should be one of the first things you learn about java
>>
>>61204476
(currently I can parse the playlist files just fine)

Dirty way of going about it would be to store everything in memory and search the entire computer for files by extension, comparing them with all the data stored in memory. Very tedious and really just poor design. I want to use the windows indexing service but not sure if it's possible or even doable (mingw))
>>
>>61204447
What does Stack offer over Cabal?
>>
File: 1469284712336.jpg (2MB, 2560x1920px) Image search: [Google]
1469284712336.jpg
2MB, 2560x1920px
>>61204492
>yes of course I let everyone enter my classes
>>
>>61204523
why do they eat that much
>>
>>61204549
poor metabolism
>>
>>61204549
heavy bones
>>
>>61200561
typedef object_internal(T: t@ype+, i: int) = [j: nat | i == j] @{ref=int j, data=T}
vtypedef object(l: addr, T: t@ype+, i: int) = (object_internal(T, i) @ l | ptr l)
vtypedef objopt(l: addr, T: t@ype+, i: int) = (option_v(object_internal(T, i) @ l, l > null) | ptr l)

extern fun{T: vt@ype} malloc(sizeof_t T): [l: addr] (option_v(T @ l, l > null) | ptr l) = "mac#malloc"

extern fun{T: t@ype} obj_init(): [l: addr] objopt(l, T, 1)

implement obj_init<int>() =
let
val+ (maybe | obj) = malloc<object_internal(int, 1)>(sizeof<object_internal(int, 1)>)
in
case+ maybe of
| Some_v(prf) => (!obj.ref := 1; (Some_v(prf) | obj))
| None_v() => (None_v() | obj)
end


Things that don't pass type erasure, apparently.
>>
>>61204558
>>61204567
no meme answers pls
why actually do they eat that much
are they like suicidal or
but no wait suicidal people don't eat
is this like the fucking new way to be suicidal
>>
>>61204570
>type erasure
if you ever hear that phrase you know you're in for some retarded bollocks
>>
>>61204570
is this sepples from the future
>>
>>61204549
You can't eat half a lasagna.
>>
>>61204579
sugar is addictive. once you fallen for sugary jew you have hell of a time to get of that ride
>>
>>61204588
>>61204582

ats-lang.sourceforge.net

The cross-compiler just doesn't want to believe that
Some_v(prf)
and
None_v()
are complete views. "partial proof pattern" my ass.
>>
>>61204579
>is this like the fucking new way to be suicidal
yes you nailed it getting fat is the new emo meme
>>
What templating engine should I use for C? GNU Autogen?
>>
>>61204675
g++
>>
>>61204522
First, you can install cabal with stack
Second, stack includes a unix subsystem
Third, stack can help with versioning
>>
>>61204693
refer yourself to this picture
>>61204523
>>
File: 1498396518124.png (25KB, 657x527px) Image search: [Google]
1498396518124.png
25KB, 657x527px
I didnt fail calculus 2 got a C!
yay me!
drinks are on me boys
>>
>>61204780
why only a c anon
>>
>>61204780
dumb frogposter
>>
>>61204780
Don't worry anon, there's always a shortage on web developers :^)
>>
>>61204570
What is this vomit
>>
>>61204788
cause u had a hard semester and didnt focus much on it
didnt study at all by myself just did my assignments and reviewd notes
it was harder than I thought and even had some calc 3 in it
hope i dont fail next one
it says probability and statistics with prerequisite calc 2
what could it be
>>
>>61204780
okay quick calculate the integral of x with respect to sin(x)!
>>
>>61204850
-cos(x)
>>
>>61204850
ok done
>>
>>61204853
That's a primitive of sin(x) with respect to x. The guy didn't give boundaries and thus it's not a proper integral.
>>
>>61204853
you forgot to add a constant of integration
f minus
>>
>>61204853
wrong try again!
(hint pay close attention to the order of the functions: x with respect to sin(x), not sin(x) with respect to x)
>>
>>61204876
wow ur an asshole
>>
>>61204850
the area of the tip of ur penis they cut when u were born dumb murican
>>
>>61204904
hue hue hue
>>61204905
HUE HUE
>>
There is no guarantee that any program that does any form of I/O will behave the same on different systems. I/O is a virulent cancer that must be contained or, preferably, destroyed entirely.
>>
>>61204509
nvm just dumped the entire file structure into a file and will read it with that.
>>
>>61204953
what would you suggest as an alternative
>>
>>61204780
kek. von neumann began study advanced calculus at 15 and already had written two major math papers at 19.
>>
>>61204989
well he wasnt diamond 1 in league of legends and 190 cm tall was he?
i am
>>
>>61204953
A program that does no form of I/O will do nothing useful on any system.
>>
>>61205005
>bragging about your score in a vidya that is literally called lol
>>
>>61204985
The programer writes code that does no I/O. The user loads the program into a REPL, where he interacts with the program directly. Any unclean I/O is contained into the REPL software, far away from the program itself.
>>
>>61205033
thank you usa
you are the legends
>>
>>61204876
int x d(sin(x)) = x sin(x) - int sin(x) dx = x sin(x) - cos(x) + C
>>
>>61204953
A program which receives no input and gives no output is as useful as your existence.
>>
How does it make you feel that a NodeJS developer can earn $120,000 p.a.?
>>
>>61205064
apathetic
>>
>>61205064
Confused
>>
>>61205064
They have to wade through piles of shit and unmantainable code so I guess they earn it.
>>
>>61205064
I make more much and I dont need to deal with memeJS so prety ok
>>
>>61205100
>more much

I doubt.
>>
>>61205111
when I write software the compiler catches my errors. memeJS developers dont have that luxury.
>>
File: 1416703125346.png (64KB, 244x235px) Image search: [Google]
1416703125346.png
64KB, 244x235px
>>61205100
>I make more much
>prety ok
>>
>>61205064
There should be a browser that's not actually for browsing the web, you just invoke it by itself or on a javascript file and it opens with a really generic valid html document and either it runs the javascript file in that document or if you invoked it by itself it just sits there and uses the terminal process as its console so you can repl with it
Except it wouldn't actually generate the document until the first reference to document is encountered so the extra window wouldn't open unless you need it
That would be a hell of a lot better an implementation of command-line javascript than nodeJS was
>>
>>61205124
>I make more much
> prety ok
>when I write software the compiler catches my errors.
I should fucking hope so.
>>
>>61205172
You could achieve something close to that with Selenium + Chromium or Firefox

The REPL could pass user I/O back and forth through Selenium. Windowsless operation is also possible with phantomjs (+ Selenium Ghostdriver)
>>
>>61205172
Shitty idea really.
>>
File: smug_ran6.jpg (114KB, 802x1240px) Image search: [Google]
smug_ran6.jpg
114KB, 802x1240px
>>61204780
Why did you post the same thing on /math/? Getting (You)s from brainlets here isn't enough?
>>
File: Danny_DeVito_by_Gage_Skidmore.jpg (15KB, 170x202px) Image search: [Google]
Danny_DeVito_by_Gage_Skidmore.jpg
15KB, 170x202px
The compiler catches my errors.
I move away from the mic to breathe in.
>>
How long does it take to get good at very low level reverse engineering and programming?

Like this guy working on getting Linux running on PS4
https://www.youtube.com/watch?v=-AoHGJ1g9aM
>>
>>61205409
Haskell rain...
>>
>>61205472
A long time. But if you love it it won't feel that long.
>>
>>61205472
To do that sort of thing, it'll take a while.
>>
File: Math.png (129KB, 651x481px) Image search: [Google]
Math.png
129KB, 651x481px
>>61204850
x d(sin(x))

>Substitute sin(x) with u.
x d(sin(x)) => arcsin(u) du

>After that, I have to look up what the integral of arcsin(u) is.
arcsin(u) du => u*arcsin(u) + (1 - u^2)^0.5 + C

>Substitute sin(x) back in.
=> sin(x)*arcsin(sin(x)) + (1 - sin^2(x))^0.5 + C

>arcsin(sin(x)) = x and (1 - sin^2(x))^0.5 = cos(x)
=> sin(x)*x + cos(x) + C

Hence, the integral of x with respect to sin(x) is:
x*sin(x) + cos(x) + C

Now, tell me exactly where I fucked up.
>>
>>61205472
It depends. If you already know low-level languages and concepts simple ISAs won't be too much of a problem; I don't know anything about the PS4 internals, but I'd wager they're too complicated to get a "feel" of how they work.
Start with simpler stuff like old console carts or 80's home PC ROMs, then gradually start with more complex architectures.
If you want to start with stuff from scratch (no documentation), good luck. You'll have to start reading datasheets and desoldering chips and shiet, and it's no easy task.

>>61205582
>not integrating by parts
>^0.5
>>
File: 515.gif (1001KB, 640x480px) Image search: [Google]
515.gif
1001KB, 640x480px
>>61204523
>they thicc
>>
>>61205064
NodeJS isn't that bad with TypeScript.
>>
>>61205680
>not integrating by parts
That would've been the sensible thing to do. I forgot it existed.
x*sin(x) = x d(sin(x)) + sin(x) dx
=> x d(sin(x)) = x*sin(x) - sin(x) dx
=x*sin(x) + cos(x) + C

>^0.5
I could have notated it as sqrt() but I prefer to notate square-root, cube-roots, etc as powers of decimals or fractions unless you can actually display a square-root sign (e.g: TeX's \sqrt()).
I know my preference is retarded but I've found some people who can't fathom that "^0.5", "^(1/2)" and a square-root sign all convey the same concept.
>>
File: 1496800623217.jpg (522KB, 2170x1070px) Image search: [Google]
1496800623217.jpg
522KB, 2170x1070px
How should I configure vim? I've used it for a while, but I haven't learned anything more than rudimentary stuff. How do I configure syntax highlighting for example? Is there some infographic or guide for which plugins are recommended, for example for autocompletion?
>>
what is this function foo going to return if it enters the else clause but doesn't
enter the a%c==0 block nor the c==a block?

#include <stdio.h>

int foo(int a)
{
int c;
if (a <= 3)
return 1;
else {
for (c = 2; c < a - 1; c++) {
if (a % c == 0) {
return 0;
}
}
if (c == a) {
return 1;
}
}
}

int main()
{
printf("%d\n", foo(7));
return 0;
}
>>
>>61205046
>The user loads the program into a REPL, where he interacts with the program directly. Any unclean I/O is contained into the REPL software, far away from the program itself.
On a modern OS no program does IO on its own, it's always just requests to a higher level runtime environment (i.e the OS/kernel)
>>
>>61204523
Damn look at those titties
>>
>>61206067
When you call the function, memory will be allocated for the return value.
When you execute a return statement, that memory will be overwritten.
If you don't execute a return statement, the memory won't be overwritten.
So the function will "return" whatever was in the memory allocated for the return value before that memory was allocated.
>>
>>61202295
Use libretro.
>>
>>61206109
my professor said it was zero
>>
>>61206096
Such requests should be disallowed or appropriately contained.
>>
>>61206104
Real talk I would fuck the guy on the right.
I mean with shirts like that they're obviously both faggots.
I don't even care that he's a man, has a beard, is disgusting, almost certainly smells awful, and would spend the morning after eating me out of house and home over the course of a single meal. I just need those boobies.
>>
Today I did it /g/!
I went out in public to the grocery store for the first time wearing a skirt and long socks, it was very exhilarating.
Didn't really notice any looks or got any comments though, so I guess it isn't that big of a deal after all.
>>
>>61206125
If he means it will probably be 0, he's right.
If he means it will always be 0, he's wrong.
C doesn't default-initialize allocated memory to 0 unless you tell it to.
>>
>>61206067
Why do you check for c == a when the condition of the loop is
c < a - 1
? This will never happen.
>>
>>61206148
Then your repl wont work either.
There has to be hooks somewhere to exchange data, otherwise your program is just an information black hole.
>>
>>61206174
>C doesn't default-initialize allocated memory to 0 unless you tell it to.
Or unless it feels like it because it's a static variable.
>>
>>61206067
This: >>61206185
If you're trying to check for fallthrough, you should be checking for c == a - 1
>>
Fact: Pascal is the greatest programming language ever invented.
>>
>>61206208
You don't even need to check, there's no break, only a return. That condition will always be true.
>>
>>61203661
Medicine is moving towards addiction-based models of obesity.
>>
>>61206227
Oh yeah huh
>>
>>61206067
I think the proper terminology is that the returned value is "undefined".
Basically, what'll be returned is whatever's in the allocated space of memory, and that can be anything.
>>
>>61206067
check for divisibility by 2 first, then start at 3 and increment with 2 each run
also refactor that, fucking hell mate
>>
Is this syntax the problem? It's tracing to this, "fails to determine size of arr_arr"

int* arr_arr[] = fibArrIter(n);


Coming from Python if that is relevant.
>>
>>61206257

I don't know what fibArrIter returns.

Also please don't put the star on the type specifier. Especially not if you're declaring an array of things.
>>
File: file.png (25KB, 859x932px) Image search: [Google]
file.png
25KB, 859x932px
witing Snake
>>
>>61206185
The repl is the I/O hook. I/O is allowed inside the repl software, but not inside the language itself. The repl runs the program, evaluates the result, then does I/O to display the result on the screen for the user.
>>
>>61206257
Fuck man, should be returning an array
int* fibArrIter(int n){
int arr[n] = {1, 1}; // Sets first two elements

for (int i = 0; i < n - 2; i++){
arr[i + 2] = arr[i + 1] + arr[i];
}

return arr;

}
>>
>>61206177
the check is outside of the loop
>>
>>61206257
Yup, that syntax is the problem.
In C, you usually have to specify the size of the array. You can leave it blank, as you do here, and that means to infer the size of the array from the definition body. But its ability to do this is limited to compile-time. If your function returns an int** or an int*[], and not an int*[4] for example, you won't be able to do what you're trying to do. You'll need dynamic allocation.
>>
>>61206391

The array goes out of scope as soon as you return. Declare it in the calling function and pass a pointer or use malloc/free.
>>
>>61206067
Negative numbers aren't prime. And the - 1 isn't needed.
bool isPrime(int number) {
int divisor;
if a < 0 { return FALSE; }
if a == 1 { return FALSE; }
while (true) {
if (number % divisor == 0) { return FALSE; }
if divisor == number { return TRUE; }
divisor++;
}
}
>>
>>61206402
The instruction pointer can only exit the loop when
c == a - 1
, so, at that point in the code, c != a always.
>>
>>61206125
undefined

https://stackoverflow.com/questions/10079089/implicit-int-return-value-of-c-function
>>
>>61206432
true
>>
>>61201581

As the beard is shaved, programming ability diminishes, but ability to attract women increases (or rather, they are less repulsed). Fortunately, beards grow back, should you need to regain your ability to write software.
>>
>>61206429
bool isPrime(int number) {
int divisor;
if a < 0 { return FALSE; }
if a == 1 | a == 2 { return TRUE; }
if a & 1 { return FALSE; }
divisor = 3;
while (true) {
if divisor => number { return TRUE; }
if (number % divisor == 0) { return FALSE; }
divisor += 2;
}
}
>>
>>61206384
So no different from the OS with very other current language then.
>>
>>61206067

Hope you're learning C11.

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

static bool isprime(unsigned n)
{
if (n < 2)
return false;
else {
/* divisibility by 2 */
if (!(n & 1))
return false;

/* divisibility by 3 + 2k, 0 < k < n - 1 */
for (unsigned d = 3; d < n - 1; d += 2)
if (n % d == 0)
return false;

return true;
}
}

int main()
{
print("%d\n", isprime(7));
return EXIT_SUCCESS;
}
>>
>>61206487
No. I/O is not allowed in the language whatsoever.
>>
>>61206491
Wait, shit. Fails for n = 2.
>>
>>61206491
What about that is C11?
>>
>>61206508
What's the difference between offloading it some other process and doing it like a sane person?
>>
>>61206508
There is no language with IO.
>>
>>61206516
Sorry, meant to say C99 (for stdbool.h and vars in a for loop)
>>
New thread: >>61206557
>>
New thread:
>>61206564
>>61206564
>>61206564
>>
>>61202607

Use F for function or C for callback, to differentiate it from the letter T.
>>
>>61206538
I think you are confused.

No I/O:
function foo(String a) { 
return "Hello," + a + "!";
}


I/O
function foo(String a) { \
print ("Hello," + a + "!");
}

The second is not allowed. The first will be called in the repl like foo("World"). The repl will evaluate the function and get a value back. The repl will print the result to the screen. No other forms of I/O are allowed.
>>
>>61206593
So how do you read files?
>>
>>61206607
You do not.
>>
>>61206593
That is just a syntactic difference.
>>
>>61206660

Not at all. One's a pure function that returns to the enclosing environment responsible for I/O, the other's achieves I/O through side effects.
>>
>>61206660
Also wrong. Consider:

function yell(String a) { 
return a + "!!!!";
}

yell(foo("World"));

The two foos will produce different results.
>>
>>61206691
The other is also a pure function, it's string -> void or possibly string -> int.
> the other's achieves I/O through side effects.
No, it's the OS which does the IO.
>>
>>61206705
>The two foos will produce different results.
Obviously, it's two different functions.
>>
>>61206731
Then you admit there is more than a syntactic difference.
>>
>>61206750
In terms of how IO is achieved, there's only syntactic difference.
If you want identical return values, make print return the printed string and change the second foo to return print()
>>
>>61206563
>>61206570
Too many breads.
>>
>>61206793
Wrong. Consider:
function isEven(x) { 
return x % 2 == 0;
}

function isEven'(x) {
ret = x % 2 == 0;
print (ret);
return ret;
}

function sayHello(x) {
if (x) {
return "";
} else {
return "Hello!";
}
}


sayHello(isEven(2)); and sayHello(isEven'(2)) will produce different effects when evaluated in the repl
>>
>>61206866
>sayHello(isEven(2)); and sayHello(isEven'(2)) will produce different effects when evaluated in the repl
Depends on the repl and what the effects are.
IO is inherently implementation defined and there's is no universal standard to measure or compare results, so talking about 'different effects' is a moot point - all effects can be different at any time due to physical interactions and constraints (imagine the power going out just after the first functions was executed in the repl for example).
>>
Does Scala support decorator functions?
It's the #1 feature that keeps me with Python.
>>
>>61206593
So no program can output indefinitely.
>>
>>61207038
unless the language is lazily evaluated
>>
I want to make a C++ library that is basically an implementation of a type that is a uint64_t with redefined arithmetic.

It needs to still work with addition and shit. I know this can be done because libs like GLM do it.

How do I go about doing this?
>>
>>61207785
You make your type a class and then implement special operator functions. Then, then you do a+b, it will know to call the operator function. This is called operator overloading. http://en.cppreference.com/w/cpp/language/operators

>>61206983
Looked it up, apparently not natively no
>>
>>61208199
>Looked it up, apparently not natively no
Thanks. Sad. Python's compact decorator notation is very useful.
Thread posts: 333
Thread images: 32


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.