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

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

/g/ - Technology

View post   

[ Toggle deleted replies ]
File: 338 KB, 1024x1024, objectification.jpg [View same] [iqdb] [saucenao] [google] [report]
64710009 No.64710009 [Reply] [Original] [archived.moe] [rbt]

What are you working on, /g/?

Previous thread: >>64703963

>> No.64710017

fags are gay

>> No.64710033

This thread is pathetic. It is not about programming. It's just a bunch of computers illiterates and freshmen memeing about whatever they just learned.

A quick search shows that most arguments used here are not original and have been copied from some trendy tech blog or other shit site.

The only real programming questions I have seen so far are from beginners(it's fine to be a beginner btw).

This entire site is shit and I don't know why anyone would regularly come here.

>> No.64710049

anyone who doesn't realize this is extra special

>> No.64710050

A set P contains a set Q if every element of Q is also an element of P.
Evidently, every element of P is also an element of P. Therefore P contains itself.

>> No.64710051

reply to this post or your mother will die

>> No.64710061

You fucking retard.

>> No.64710068

not sure which one he meant so ill reply to both

>> No.64710077


>> No.64710081

>The only real programming questions I have seen so far are from beginners
That's because the vast majority of the people who post on here have no clue how to answer anything beyond first year CS student tier questions.

>> No.64710088

I need help from any programmers.

My boss has a database in mysql, I think he wants to integrate it into either a website design (html) or app in c#... he also wants it to be designed so that the database functions better, such as if a product is being created from raw material based of our inventory list, that it deducts from this material listing. Would is be better for it to be written in the SQL based on the database, or could I do it with html or c# using the information from the database based of mysql?

Any ideas on where to start. I really need this, I'm feeling so lost and I'm a complete noob trying to get by.

>> No.64710092

Some mathematicians call it the axiom schema of comprehension, although others use that term for unrestricted comprehension, discussed below.

Because restricting comprehension solved Russell's paradox, several mathematicians including Zermelo, Fraenkel, and Gödel considered it the most important axiom of set theory.[1]


God I can't believe I'm wasting my time with this.

The axiom of comprehension you are talking about is not the same in ZFC.

>> No.64710097

>A quick search shows that most arguments used here are not original and have been copied from some trendy tech blog or other shit site.
welcome to /g/, enjoy your stay :^)

>> No.64710116

Use an ORM for C# that will generate all the SQL for you where necessary. Doing is SQL is always faster.

>> No.64710135

I know, I know. I haven't come here in months. I knew that doing it today was going to be a mistake.

>> No.64710136


>> No.64710145

Do you think mathematics and more specifically, set theory, has nothing to do with technology and programming? Are you special?

>> No.64710153

So sets are one-dimensional?
Also, I thought the term "subset" was used, in which case it makes sense that a set is a subset of itself.
What I thought was that the set was inside itself.

>> No.64710160

too much maths for the average dptard

>> No.64710165

Actually, since you have the exact points AB which form a line, it would probably be simpler to calculate the intersection points of each line to form a corner lel

You still have to do some of the other crap to make sure that it's actually a closed shape, and it's still not reasonable to do anything other than a convex hull
In this method you'd use Chan's Algorithm to get the convex hull for the set of corners.

>> No.64710207

kd-trees are a reasonable choice if you're worried about memory usage.I'd just keep it stupid for now and just use a grid with lists of units. If memory becomes a concern then you can switch over to kd-trees. For video games on modern systems ram is cheap but pointer dereferences are not so cheap.

>> No.64710210

Sets do not have shells. They are just collections of things. Yes, a set is always a subset of itself.

When you encounter this kind of problem, where there seems to lie a contradiction, it is always useful to carefully re-read the definitions of everything you are dealing with. You can of course use wikipedia for that but wolfram alpha and encyclopediaofmath.org are also very useful.

This kind of foundational mathematics, for set theory is the foundation on which all modern math rests, is very important for computer science. Some people erroneously mistake it for "basic" and think they don't need to study or are ashamed to do so. This is a grave mistake, what makes a good computer scientist is good grasp of the foundations of mathematics.

>> No.64710222

Yeah, it's two different meanings of "contains" (as a subset or as an element). Took you a while to notice it.

>> No.64710223

>So sets are one-dimensional?
I don't think dimensions can be applied to sets like that.

>> No.64710236

Oh, shit. You're serious? I thought you were fucking with him. I remove my endorsement. You are also a brainlet

>> No.64710248

>two different meanings of "contains" (as a subset or as an element). Took you a while to notice it.
don't blame him
mathheads are retarded like that when it comes to sane naming

>> No.64710260

>Took you a while to notice it.
+1 smugness
This is why you deserved to be bullied as a kid, nerd.
Didn't seem to work well enough, though.

>> No.64710261

To make it more clear:
P = {1, 2, 3, 4}
Q = {1, 2, 3}
Q is a subset of p, since every element of Q is also an element of P.

T = {1, 2, {1, 2, 3, 4}}
Q is NOT a subset of T. Not every element of Q is an element of T, even though P is a *element* of T.

>> No.64710270


>> No.64710274

It doesn't even matter, though. You're still fucking dumb if you think screeching "nuh uh! It doesn't make sense for a set to be an element of itself, because it's like, infinite, bro" is a mathematical proof of anything.

>> No.64710281

At least he didn't blindly accepted what he was being told.

>> No.64710283

If you look at his example:
>(1 2 3 (1 2 3 (1 2 3 (1 2 3 (1 2 3 (1 2 3 ...
Clearly he was talking about "contains" in the Russel's paradox sense, as in the set being an element of itself.

>> No.64710288

>You're still fucking dumb if you think [...]
Who said I did?
I'm just an unbiased bystander commenting on people falling into stereotypes.

>> No.64710300

so you get a 10000x10000 grid and your array alone will eat up a couple 100 megabytes?

>> No.64710305

>At least he didn't blindly accepted what he was being told.
It's actually much worse. Blindly trusting your math teacher is just naivete. Being unable to reason even when you try is plain stupidity.

>> No.64710310

Hey guys, can someone please help me figure out how to get a millisecond timestamp in go? I'm trying to use the binance API to get account details but I need to provide the current time in milliseconds.

>> No.64710311 [DELETED] 


>> No.64710313

RAM's cheap bruh
>inb4 use a hashmap, dumbass

>> No.64710314

I wasn't part of the discussion at the point when this example was used. And this is not the Russell's paradox

>> No.64710328

>I wasn't part of the discussion at the point
Fair enough.

>And this is not the Russell's paradox
I didn't say it was. I said it's the same sense of "contains".

>> No.64710330

using linked lists when using an implicit grid doesnt sound like blazing speed to me

>> No.64710336

I see. In this case we use the word "belongs".

>> No.64710342

first result, no?

>> No.64710350

How large are these fucking maps? If your map is 80,000 space marines wide and tall, you're basically building an open world map and you'd be using a couple hundred megs for the tile data alone.

>> No.64710355

then why do that?
>doesnt sound like blazing speed to me
oblig: profiling often reveals surprising results

>> No.64710362

Honestly I woulda used arrays but I bet linked lists are actually faster if you use a custom allocator.

But how did you get linked list when I later mention
>ram is cheap but pointer dereferences are not so cheap.

>> No.64710370
File: 3.44 MB, 1585x1574, Untitled.png [View same] [iqdb] [saucenao] [google] [report]

/diversity quota/

>> No.64710381

preferred the one with the bulge teebeeheich

>> No.64710383

this might belong in sqt

in python how do i make something execute in a script right before return or break or whatever

I have a while true statement, when I break the script with ctrl+c I need it to clean some shit up before it fully returns is there a way to do this?

>> No.64710389

doesnt even really need to be that big. the cells need to be at a size that the most common AABB cant overlap more than 4 for max remove/insert speed and that you dont get hogged down by clustering. so if you have decent map size and small units you can get that kind of size

every cell bucked can hold multiple actors/ units. you need to store them somehow so why not link them together?

>> No.64710391

google 'python finally'

>> No.64710400

>not sure which one he meant so ill reply to both

Don't forget you're here forever.

>> No.64710409

while True:

except KeyboardInterrupt: #you can use "Exception" to catch anything.
print("traps are not gay")


>> No.64710416

post dragon dildo

>> No.64710417

I know.

>> No.64710424

important to note:
- except is for handling the exception
- finally is for doing shit regardless of whether an exception happens or not

>> No.64710431

just can't help yourself, can you
you like that, huh
just admit it

>> No.64710440

Damn, girl(male), programming socks on your arms and legs. I bet you hacked the CIA at least twice.

>> No.64710449

Yes, yes.
If you want to clean things regardless of whether the user interrupted or the program crashed it would be better to use finally instead of exception.

>> No.64710461


>> No.64710462

It's my first time since October. I though I was recovering. This is hell.

>> No.64710468

>implying this gay programming socks shit is not a CIA psyop

>> No.64710479

don't feed the attention ho's
roasties get 'tits or gtfo'
traps, iunno, 'dildo up boipucci or gtfo'?

>> No.64710491

's like herpes, or sissy/BBC addiction
should be alright when taken care of, but will have outbreaks every once in a while

>> No.64710500
File: 28 KB, 742x320, .png [View same] [iqdb] [saucenao] [google] [report]

I setup a auto-recorder/scheduler thing with python that calls FFMPEG at a certain time.
Some shows are broadcast multiple times a day.
How would you prevent recording duplicates?
I mean, how would you. Not being lazy. I know how but I'm curious how anyone else would do it.

What I do right now is write to a text file and read it every time the program tries to record something.

>> No.64710511

>sissy/BBC addiction
I also relapsed on that today. And I'm not really into that, it's just the porn fucking my mind.

>> No.64710522

How is the schedule determined?

>> No.64710534

You're not going to create a 20,000 by 20,000 tile map. That's 400,000,000 tiles. If we say that a space marine is 1 tile, that's about the size of Kalimdor in vanilla wow. You won't approach anywhere near that size.

I still recommend the dumb solution before the smart one. Might not need to upgrade if you do.

>> No.64710586

will go with open hashed grid. that should do the trick

>> No.64710591


>> No.64710659

>if show['title'] in shows_to_get or show['title'] not in do_not_want:
Your whitelist is useless given this code, no?
Unless a show is in both the whitelist and the blacklist, but that's just sloppy.

>> No.64710685

It grabs the show I want, excludes shows I don't, grabs shows I don't know about.

>> No.64710697

Which simplifies to "grabs all shows except the ones in the blacklist", no?

>> No.64710739
File: 23 KB, 337x372, mfw.jpg [View same] [iqdb] [saucenao] [google] [report]


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

Employed Haskell programmer here :)

>> No.64710776


>> No.64710782

Burger flippung.

>> No.64710855
File: 11 KB, 630x95, yFrLmLP.png [View same] [iqdb] [saucenao] [google] [report]

i'm writing a scraper with python that needs to put a string into a search bar on a certain website and return the result. I've been using the request module previously but that has been mostly to just fetch html and search it, never actually use site functions like a search bar.

does anyone know what i should use for such a task?

>> No.64710875

anything that can chuck the appropriate post method at the server
e.g. shell + httpie

>> No.64710876

Do it in your browser and look at the network monitor. requests can POST
it depends on what you're doing, though
if you want to interact with a bunch of javascript you might need to use something like headless firefox

>> No.64710901


i checked under network and found it uses a simple /&search=""


>> No.64711018

I'm currently working on a redesign of my chatbot/assistant that I use for group messages in Signal and iMessage. It's currently written in python2 with MongoDB as a datastore.

I'm hoping to migrate it to Python3, with Cassandra as a datastore, and potentially have an internal web front-end that I can monitor logs/performance on, maybe even full-text search of conversations with elasticsearch at a later date.

I haven't ever done any async python though... Any recommendations for ways to do it? I was also considering doing the backend in Elixir, and spawning python workers to handle messages, but that might have to wait for v3, as I only know a little bit of Erlang.

I'm wanting this to be rock solid, as I plan on applying for an internship at Apple in the coming months (for summer 2019), and it's really the only project I have that is relevant to their ecosystem.

thanks in advance :)

>> No.64711094

c++ is the greatest language of all time

>> No.64711168

>this synthesizes correctly
if (in) begin
count = 0;
end else begin
count = 1;

>this doesn't
count = !in;


>> No.64711334

I'm trying to emulate a finite-state machine in C using function pointers.
Each pointer function holds take a struct as the argument.
My problem is that different states use different data from the struct and the struct is getting quite large already.
I want to split the struct up into separate structs, but with the nature of function pointers, I would have to include the unnecessary structs in the function's parameters.

Here's an example of what I'm talking about.
typedef void state_fn(struct a_data *, struct b_data *, struct c_data *);
state_fn a_fn, b_fn, c_fn;
/*skip a bit*/
fn_pt(struct a_data a, struct b_data b, struct c_data c);

where a_fn only uses a_data, b_fn only uses b_data, and so on.

It feels like I'm doing something wrong.
Should I worry about having to pass unused data even if it's by reference?

>> No.64711361

Technically impossible if you're not in a real-time operating system.

>> No.64711398

This begs the question of whether we can raise the bar somehow. Don't get me wrong, I like some aspects of the 4chan format but at the same time I know it rewards low effort posts and blatant shitposts. This is probably because everyone is anon and there is no way to put anyone in their place for making really retarded posts.

I think that if /DPT/ had only quality posters, the thread would crawl to a halt, and if thats the case then its probably better to browse a traditional programming forum.

>> No.64711427


>> No.64711433

Can you use unions? Also since when does a finite state machine have state outside of the machine state? The only mutable state of your program should be a single number or function pointer or something representing the state. Are you actually making a register machine emulator?

>> No.64711465

You aren't passing a large struct around, the struct's data is on the heap. Only the pointer is being put on the call stack, the cost of which does not scale with the size of the struct

>> No.64711468

You're assuming that people who make good posts don't also shitpost. I shitpost AND make good posts. Gotta keep it mixed up.

But in reality that anon is probably the fag who was upset that dpt doesn't know set axioms very well.

>> No.64711497
File: 39 KB, 541x498, yeah_sure.jpg [View same] [iqdb] [saucenao] [google] [report]

if(a & 0x20)
a -= 0x20

How can I do this with the teranary operator( ?: )?

>> No.64711508

a -= a & 0x20 ? 0x20 : 0;

that's not very attractive though, please don't do it

>> No.64711512

This seems like a strange way to do it. I'd just do
a = a & (~0x20);

>> No.64711519

I don't see the problem with it.
I don't see why anon would have a preference for the ternary operator here though.

>> No.64711525
File: 189 KB, 564x556, gif4.gif [View same] [iqdb] [saucenao] [google] [report]

hey crypto friend
I've added most of the manual trading features to my GDAX program
working on doing backtests for some trading strategies that it will use for automatic trading next

>> No.64711544

Duh! This just for my hobbist needs. Also, I shameless love obscurity. T. Hanks.

>> No.64711548

well, in the second case you're making it boolean i suppose, which is not what you do in the first snippet

>> No.64711586

i've defined it as a reg so i'd hope in either case it would only be assigned a value on edges. or maybe i'm misunderstanding you?

always block, part of debounce code in a cpld:
reg count;
always @ (posedge clk or posedge in) begin
if (in) begin
count = 0;
end else begin
count = 1;

>> No.64711596

>Muh nigga
This looks much better. Couldn't this be condensed to
a &= (~0x20)

I unironically find it aesthetically pleasing. The less redundancy, the better.

>> No.64711605

I'm still new to programming and haven't used unions yet. I think it might be just what I need.
As to the flaws in my example, they are just oversights. My actual code has a struct called state that I use as a argument that contains the function pointer being called.

Thank you for the insight.

>> No.64711622

could be relevant https://stackoverflow.com/questions/16424726/what-is-the-difference-between-verilog-and

>> No.64711642

You should also mention that the compiler do these calls well by itself. It tends to manage the pass by value situation better because it's simpler to have it add the complexity of memory loads and stores rather than having it take them away (prove no alias, show that you don't modify the struct, there's tons).
With C code especially you're not going to be giving the compiler a hard time so it can handle this well.
So it's an easy rule to follow to generally give you the best result. Of course this really only matters for larger functions or complex control flow.

>> No.64711697

So if I want Java, but better, what should I be trying out? Scala? Kotlin? Is there something better?

>> No.64711745
File: 92 KB, 640x640, 1515020094231.jpg [View same] [iqdb] [saucenao] [google] [report]

Is it possible read the output of command in C by using open? I don't mean reading from stdin. Can I use a fd to read the output of I call from within in C? I'm trying to create a daemon.

>> No.64711753


>> No.64711756

again, now in english

>> No.64711770


>> No.64711771

They say C#, Microsoft Java, is a better Java if it's worth your soul. But in all seriousness I'd discourage Scala.

t. one of the language authors abandoning ship https://www.youtube.com/watch?v=uiJycy6dFSQ

Probably pajeet tier but you could try piping it into a file and reading the file. system("foo > benis")

>> No.64711778
File: 440 KB, 959x441, dogegraph.png [View same] [iqdb] [saucenao] [google] [report]


Someone answer muh fuggin question. Doesn't matter if I'm trying to get into crypto or pets.com frontend developing right, I'm just looking for a sure solid path to gain proper experience so I can get employed. But blockchainshit appeals to me. Any suggestions on if I should just develop my personal projects or whut? I'd love to develop a UX but I have no idea how any of that works especially relating to my piddly python program.

>> No.64711780

What part didn't you understand?
>inb4 everything

>> No.64711791


>> No.64711793

I've done this before. However, I don't like this. I'm sure I can use a fd, and avoid writing a file to the system.

>> No.64711807

You want popen.

>> No.64711823

danke, anon.

>> No.64711833

>what should I do?
>I would like to do ux
Do UX.
You can't just keep doing things you know. You'll be getting nowhere.
Pick a UI library and work with it.

>> No.64711850

You want a fifo anon. Warning, you need to do fork your command.


>> No.64711864

Is Electron going to be the easiest bet for making a desktop program?

>> No.64711882

No, you want Qt.

>> No.64711890

winforms baby

>> No.64711918

Honestly I just want to fall less into the category of the fucking chad normie "INVEST IN <XYZ SHITCOIN> FOR MAD GAINZ BRO HAHA" meme category, put my money where my mouth is so to speak, and actually learn how to help develop in this space. That's the only way it ever gets off the ground anyway right? Rather than staying internet meme money that you have to be a total basement autist to even have the knowledge to get into playing around in crypto in the first place.

Ok cool thanks anon. What's the best place to start in that kind of thing? From what I hear UX design is a total bitch. I've experimented now with the Wxpython library to just make a simple babby's easy ready-out-of-the-box UI window but I'm guessing that's the most completely basic beginner shit-tier route to go.

>> No.64711932


>> No.64711956

I view UX as entirely separate from the libraries you use for getting input and drawing interface. I can't tell you what's best in python though. Sorry.
You can crawl around on the web and find more informed opinions.
Most are very appealed by popularity though. Look for the strength of their arguments and not how many people say something is great.
Or just pick the popular thing because this is just a toy anyway.

>> No.64711994

It doesn't really matter what route you take
as long as you're working on something new, you're learning
eventually you'll get to the point where you're proficient enough in your programming language of choice that you can implement whatever you want without having to spend much time looking around for things or asking questions

I realize that answer seems vague, so specifically I would say just pick whatever UI library looks good and go with that for now, then integrate it with some crypto exchanges API and you'll have a working program in your area of interest that you can show

>> No.64712008

By building a userscript, how can I retrieve a time value (hh:mm:ss) from a website and evaluate the time value to determine if it's great than 30 minutes?

>> No.64712034

This speaker (very senior developer at Google) at Cppcon just said that adding things to namespaces std is ok if you never upgrade.
While in fact it's undefined behavior.
When will people realize that this shit language is unacceptably hard?

>> No.64712052

A HEAD request should return the time in the request header.
HEAD / HTTP/1.1\r\n

>> No.64712073

he listed every caveat you need to avoid, but were you to avoid them all, you can add things to std

>> No.64712118

convert string to time. Javascript times need to have a date too.

(new Date (new Date().toDateString() + ' ' + '10:55'))

>> No.64712131
File: 171 KB, 800x600, software engineering.png [View same] [iqdb] [saucenao] [google] [report]

Coolio alright, thanks for the response.

Guess I'll just do some hardcore googling later. I keep thinking of all these ideas for a sweet program that does this or that, but I'm TOTALLY limited by the fact that I can't make it fucking useable. I'd love to learn how to just make even simple functions interactive, graphically, and then from there I can scale up functionality to whatever I can think of. Hopefully retaining responsiveness and all that. Again no idea what I'm talking about.

I was actually thinking of getting into Android development since I'm good with java already, but that's a whole separate beast that I'd have to learn from the ground up. I'm guessing the same principles of learning UI nitty-gritty apply there too, I'd still have to learn everything unless I just wanted to make stellar code in the background of a shitty playskool UI.

>> No.64712212

Except it's undefined behavior. So your compiler version is entirely in charge of what happens.
He can't know that the one compiler choice you made doesn't lead to undefined behavior when calling the code for instance. It may be malign for ages, then you make a slight change to the code and the compiler sees that it can do something completely different now because your program is undefined and the compiler sees some optimization it can do.
That's how UB works. It's not something you can 'step around' by not updating anything (ignoring your own source, hopefully your compiler is deterministic).

>> No.64712239

yes, most of what you learn about UI and UX apply cross platform. android has its own little quirks that you need to address, but every platform does.
Just focus on making something that works first and worry about all the details later

for example, my thing is just straight up winapi
looks like shit, but it works

>> No.64713375

Anyone got a pdf copy of "Learn Python 3 the Hard Way?"

Zed used to have the books available online for free but now he cuts it off after chapter 9.

>> No.64713390

>all throughout program
table_copy(t1, t2)

>t2 is not affected by the above call
>in two small functions I just recently wrote
table_copy(t1, t2)

>t2 is getting overwritten by t1, looking at the code for my table_copy function this should be impossible. this behavior only recently begun happening despite no changes to the function.
how do you even respond to this

>> No.64713415

t1 and t2 are references and refer to the same object.
Assuming your implementation of table_copy really is correct, this is the only way I can think of.

>> No.64713431
File: 12 KB, 182x268, 1513815326858.jpg [View same] [iqdb] [saucenao] [google] [report]

Why did they even bother including variable length arrays in the C spec if they're so goddamn buggy and useless?

>> No.64713479

Zed Shaw is a fucking hack, and his books are terrible.

>> No.64713480


>> No.64713489

They're not buggy or useless. You can avoid a bunch of useless allocations by using them properly.
You just have to be mindful of maximum lengths and untrusted input.

>> No.64713519

Please elaborate on what you mean by this.

>> No.64713538

I think I found the issue.
Still have to figure out how to fix it but you putting what the issue must be in words like that helped.

>> No.64713555
File: 152 KB, 559x556, fucking garbage.png [View same] [iqdb] [saucenao] [google] [report]

It's all the cons of static arrays with all the cons of dynamic arrays.
>not contiguously allocated, so they can't be memcp'ed or memset'ed
>can't use sizeof
>can't be initialized either
>still have to pass their size as an argument
There is literally no reason to use them. Either using static or dynamic arrays are superior for every use case.

>> No.64713581

>not contiguously allocated
But that ain't true.
>can't use sizeof
That ain't true either. It's resolved at runtime though.
>can't be initialized either
What would the syntax be for this?
>still have to pass their size as an argument
So no different to any other array in C.

>> No.64713601

>>not contiguously allocated, so they can't be memcp'ed or memset'ed
>>can't use sizeof
>>can't be initialized either
Makes sense, it would be an error to do that.

Using a static array is a fucking retarded waste of stack space if your upper bound is high but your common case is low. Just validate the size and fail gracefully before creating the VLA you dumb retard.
And using dynamic arrays is a fucking retarded waste of CPU cycles allocating and fragmenting heap memory.

>> No.64713614

fake news

>> No.64713618

>not contiguously allocated
Yes they are. They literally wouldn't be an array if they weren't.
>can't use sizeof
Yes you can.
>can't be initialized either
This is true, but from a language perspective, there is basically no sane way this could be done.
>still have to pass their size as an argument
So? That's literally how all arrays in C work.

I've written code with like 3 VLAs in use at the same time, all with no concrete upper limits, but where I trust that the limit is something reasonably sane (gotten from a library).
It's extremely efficient, and made memory management significantly easier.

You're also missing one of the non-obvious, but useful uses of VLAs: pointers to VLAs.

void fn(size_t w, size_t h, int (*arr)[w])
// arr is true 2D array

>> No.64713638

What the hell is actually the point of pointers to VLAs over just a normal pointer and size?

>> No.64713642

>>not contiguously allocated
>But that ain't true.
>>>not contiguously allocated, so they can't be memcp'ed or memset'ed
>>not contiguously allocated
>Yes they are. They literally wouldn't be an array if they weren't.
I'm talking about the multidimensional case when they aren't

>> No.64713647

2d arrays get natural syntax

>> No.64713654


>> No.64713655

It makes using multi-dimensional arrays much easier to use. It's just like doing it normally, instead of calculation offsets yourself.

>I'm talking about the multidimensional case when they aren't
No, they're still contiguously allocated in the multi-dimensional case.

>> No.64713660

>I'm talking about the multidimensional case when they aren't
Except they are.

>> No.64713670

>It makes using multi-dimensional arrays much easier to use. It's just like doing it normally, instead of calculation offsets yourself.
Let me retry that:
It makes using multi-dimensional arrays easier. It's just like doing it normally, instead of calculating offsets yourself.

>> No.64713693

You didn't really need to retry that

>> No.64713735




>> No.64713764
File: 63 KB, 788x810, 1432243170519.png [View same] [iqdb] [saucenao] [google] [report]

What's the point of Idris existing instead of just plain Haskell?

>> No.64713793

There is no point in Idris or Haskell or any other academic masturbatory FP memelang

>> No.64713811

I just want to write fewer bugs senpai

>> No.64713889
File: 22 KB, 641x678, plan9.png [View same] [iqdb] [saucenao] [google] [report]

The problem I have right is now is
>write a test to verify some output
>the two tests disagree
>write a third test decide between the two
>it also disagrees with the first two

>> No.64714130

Haskell doesn't have dependent types. Also, Haskell is lazy.

>> No.64714139

>What's the point of Idris existing
Containment languages for autists that are too autistic even for Haskell.

>> No.64714141

>writing tests
>not writing proofs
You're doing it wrong.

>> No.64714165

Original question: >>64701511

Responding to this: >>64707663

>You're chugging over a fucking gigabyte of data per second. That's well within an order of magnitude of the theoretical maximum.
Is it really? The specs of my GPU says that memory bandwidth is 25 GB/s.

>I think you should have each thread copy its own cut of memory. So thread 1 copy the first 1000 bytes, thread 2 the second 1000 and so on.
Actually, no. I tried this, but that causes massive cache misses and the bandwidth drops to below 110 MB/s if I do this.

>> No.64714361

This is probably the wrong place to ask, but anyway.
When you call fork(), the kernel clones the address space using copy-on-write pages.
i.e., when the 1 of multiple tasks write to a shared COW page, the one writing will create a private copy of the page for itself.
Now when task A forks to create task B, and task A exits, the kernel must somehow know not to free the physical pages that are currently shared with task B, or otherwise when task B triggers a COW, it'll try to copy a page that doesn't exist and also lose any writes that task A did.
Obviously the kernel must be doing some kind of reference counting on physical pages to deal with this.
Now what I want to know, is how the fuck does the kernel keep track of refcounts for physical pages without using a fuck ton of memory?
If I decide to make a 4gb mapping, the kernel will need to allocate at least 13mb of memory just to keep track of the physical pages, and that's the MINIMUM amount you would need on a 32bit architecture. The actual structure would probably be more like this:
struct Page {
usize vaddr; // Tag for lookup
usize paddr;
int refcount;
// Might also need:
// int flags;
// File *file;
} __attribute__((packed));

Which amounts to 20 to 32 mb for a 4gb mapping on x64. That is disgusting and horrible.
So, how does Linux do it?

>> No.64714419

Actually you most likely wouldn't need the vaddr, which takes off 4/8 mb, but that's still pretty bad.

>> No.64714440

Corporate internet banking.

>> No.64714552

Who said there needs to be one of those structs per page?

>> No.64714601

There has to be.
I'm not talking about VM areas, I'm talking about individual physical pages.
The kernel needs to keep refcounts of at least the physical pages involved in (file-backed and anonymous) mappings.

I did a bit of searching and it turns out they actually do: http://elixir.free-electrons.com/linux/v4.3/source/include/linux/mm_types.h#L34
It amazes me how Linux is not using a fuck ton of memory. What if I mmap a multi terabyte file on x64?
And they're not coalescing them either because
>Each physical page in the system has a struct page associated with
>Each physical page

>> No.64714615

Also, their struct page is actually quite big too, that must use a lot of memory when you've got millions of them.

>> No.64714954


this is what I get for trying /g/ out once in a while.

>> No.64714970

>A quick search shows that most arguments used here are not original and have been copied from some trendy tech blog or other shit site.
you could say the same about anything and anyone; one has to learn from somewhere/someone first.

>> No.64714972

>Now what I want to know, is how the fuck does the kernel keep track of refcounts for physical pages without using a fuck ton of memory?
So, how does Linux do it?

Look up struct vm_area. Also, it doesn't actually store vaddr and paddr in struct page. Only the refcount and some bits.

>> No.64715042

>Look up struct vm_area
I thought I made it clear enough that I wasn't talking about vm_area. Apparently not.
No, I'm not talking about vm_area, I already know how they work, and had little to do with my question.
vm_area describes variable-size areas in the virtual address space of tasks. I'm talking about keeping track of physical page refcounts so the kernel knows when and when not to free a physical page, because it could be in used by multiple different address spaces.
Now I already know how it does it, it keeps a list of struct page, but I'm concerned about it's memory use. There's a lot of physical pages in the system which are part of mappings, and the kernel would have to create a lot of these page structs, so these structs could create quite a lot of memory overhead for large anonymous/file-backed mappings where all the pages had been allocated.

Get what I'm talking about?

>> No.64715068

Signal x[n] is filtered by a filter with transfer function H(z) = 1-z^(-1). Determine if and how the maximum of its PSD will change.

>> No.64715076
File: 235 KB, 2000x1516, doubleDs.jpg [View same] [iqdb] [saucenao] [google] [report]

dlang is best lang

>> No.64715094

WHich one?

>> No.64715162

>proving him right by memeing about something you just learned

>> No.64715224

Go to sleep, Andrei, you're drunk again.

>> No.64715320

Out parameters are better than return values because out parameters cannot be ignored.

>> No.64715331

>giving a shit how people using your library use it

>> No.64715334

Making first contact with monad transformers. I have
stuff :: MaybeT (Reader Env) Value

I think I need:
foo :: MaybeT (ReaderT Env IO) Value

What do I do?

The types in question come from:
eval :: Expr -> MaybeT (Reader Env) Value
repl :: MaybeT (ReaderT Env IO) ()

I'm actually considering whether I shouldn't use State instead of Reader if I want to have repl.

>> No.64715335

void foo(int a, int b, int *out = nullptr);

What now faggot?

Also, discriminated union return is the best method.

>> No.64715360
File: 48 KB, 800x729, 1566147226.png [View same] [iqdb] [saucenao] [google] [report]

>Out parameters are better than return values because out parameters cannot be ignored.
What if I want to ignore your shitty return value?

>> No.64715363

absolutely gross

>> No.64715365

>implying people wouldn't just create throwaway variables they never look at

>> No.64715366

Miles better than NULL or 0, both aesthetically and semantically

>> No.64715373

but not, Nothing

>> No.64715374

Better than silently ignoring a return value.

>> No.64715389

>Better than silently ignoring a return value.
What's wrong with ignoring a return value? Are you doing something brain-dead like using return values to communicate errors?

>> No.64715395

Then you perish

>> No.64715397

What's the alternative?

>> No.64715398

Actually it's worse.
Because now, not only are you ignoring function results, but you are also shitting up your code with unused variables.

>> No.64715406

Not using a braindead language like C, perhaps?

>> No.64715426
File: 189 KB, 1366x768, shebang.png [View same] [iqdb] [saucenao] [google] [report]

I'm writing a bash script! Just figuring out how to write my help text and then I'll get into actually getting it to do something proper. (I'm using grep's help text as a guide)

Anyone have any tips on how to print out help text without calling echo a hundred times?

>> No.64715430

>What's the alternative?
Proper use of exceptions.

>> No.64715444

Using exceptions for all errors is not a proper use of exceptions.

>> No.64715462

Daily reminder the official /dpt/ error handling rating looks like
Monadic error handling (Haskell, Rust) >> Exceptions (Java, C++, Python) > Return error codes (C, Go)

>> No.64715471

errors as regular behavior > error handling

>> No.64715477


Exceptions are gay and slow

>> No.64715506

errno > *

>> No.64715524

global errno > thread-local errno > *

>> No.64715537

Okay, here is what I've done:
readerT :: Monad m => Reader a b -> ReaderT a m b
readerT = mapReaderT (return . runIdentity)

foo = mapMaybeT readerT stuff

I hope it's right.

>> No.64715571

>Exceptions are gay and slow
>proceeds to use setjmp

>> No.64715580
File: 31 KB, 638x479, QS_cda28e64ba554eed95333a3334960a07.jpg [View same] [iqdb] [saucenao] [google] [report]

Daily remainder

>> No.64715581

I just finished a coding project for a class.
However, while I was working on it I found an earlier version of the project on github. (That version didn't actually work, and didn't have a few requirements that ours did.)
I ended up using a few functions from that project in mine, and 1 or 2 of them I didn't really edit at all.

How likely is it that this would count as plagerism/copying? I didn't even think about it while working on the project because I was too concerned with getting it to work, but now I'm getting a bit paranoid.

>> No.64715588


>> No.64715591

You can use printf
printf "some\nmulti-lined\ntext\n"

>> No.64715643

>good code

>> No.64715649

>Using exceptions for all errors is not a proper use of exceptions.
Using exceptions for all errors is a perfect use of exceptions, and compilers should optimize the special case of exceptions being caught just one level down.

>> No.64715659

>Monadic error handling (Haskell, Rust)
Monadic error handling is a total meme, and Rust's attempt at it is fucking disgusting and barely qualifies.

>> No.64715668

just tell em exactly what you wrote here, idiot
- while working, found earlier version
- said version didn't work (more precisely: X, Y, Z) and didn't have the following req's (A. B. C)
- used functions W, X, Y, Z and nothing else (include links to src/dst of each copy-pasta)
-- note that Y, Z were unmodified, while I did modify W, X (due to [...])
- would this be an issue w.r.t. plagiarism / score deduction, and if so, would a clean-room-ish rewrite of the reused functionality help?

Non-dick professors will be non-dicks about it.

>> No.64715671

You can use "$#" to get the number of args passed down to to your script.

>> No.64715687

>official /dpt/ error handling rating looks like
>something that is not informed by the trade-offs of the particular scenario
dogmatics, in my dpt? Who would've thought!

>> No.64715691

>hurrrrr muh setjmp
Nobody even mentioned it... Boy, you sure sound pretty butthurt about setjmp. What's wrong, sweetheart? Did you lose some argument about it back in the day? In any case, it's ugly, but it's much faster than C++ exceptions, and still faster than manually propagating some error code down the call stack, so what were you trying to imply?

>> No.64715710

>There's a lot of physical pages in the system which are part of mappings, and the kernel would have to create a lot of these page structs, so these structs could create quite a lot of memory overhead for large anonymous/file-backed mappings where all the pages had been allocated.
You don't understand what struct page represents. struct page represents the physical pages, i.e. there is only one struct page per actual physical page.

struct vm_area is what defines mappings for tasks.

>> No.64715720

>but it's much faster than C++ exception
Citation needed.

>> No.64715738

What kind of trade-offs? Sure, exceptions have some, but Monadic error handling is basically zero-cost.

>> No.64715758

Babby's first Nim program:
It's a macro that lets you slap custom pragmas onto types and their fields, and it will trigger associated code generators, passing them a nice and tidy representation of the fields.
Foo = object {. printMe .}
a: int
b: float
c: string

Bar = object {. printMe .}
a: int
b: float
c {. ignoreMe .}: string

let bar = Bar(a: 1, b: 2.2, c: "ignored")
echo bar
let foo = Foo(a: 5, b: 6.6, c: "foo")
echo foo

printMe foo
printMe bar

>> No.64715768
File: 91 KB, 645x729, brainlet2.png [View same] [iqdb] [saucenao] [google] [report]

>conditionals are zero-cost if i call them "monadic"

>> No.64715781

>i don't have a brain so i need a citation
Try learning how exception handling in C++ and setjmp/longjump work under the hood.

>> No.64715783

Zero-cost doesn't mean NOPs, you can't have error handling without conditionals,

>> No.64715800

>zero-cost doesn't mean it has no cost
Alright. Steve. But can you please stop lumping Rust with Haskell? You are about 5 tiers below it.

>you can't have error handling without conditionals
You can have error handling without a conditional on every fucking level down the line.

>> No.64715801

In Rust it's just `#[derive(Debug)]`.

>> No.64715810

>in rust it's just hurrrrrrrrrrr
Try reading and actually understanding the post before you respond, Rustsperg.

>> No.64715816

Are you fucking retarded? How can you be this fucking bad at reading comprehension?
Where the fuck did you get that dumb idea from reading my post? I don't know where in any of my posts anyone could've possibly gotten the idea that I believed what you think I believed.

It seems everyone here is too retarded to be able to actually answer my question, or even understand English. Oh well.

>> No.64715820
File: 372 KB, 1920x1080, DeepinScreenshot_20180213145708.png [View same] [iqdb] [saucenao] [google] [report]

Nim's nice

>> No.64715824

This pic is what Dfag should have been spamming a few months ago

>> No.64715826
File: 13 KB, 260x194, c++.jpg [View same] [iqdb] [saucenao] [google] [report]

>It seems everyone here is too retarded to be able to actually answer my question, or even understand English.
You're not wrong.

>> No.64715839


>> No.64715844

>Nim's nice
I don't know, anon. All I can say so far is that it's cancer when it comes to metaprogramming, at least compared to CL and Scheme.

>> No.64715854

By the way, do you know if there's a standard library equivalent to this?
iterator subs[T](indexable: T, a: int, b: int): untyped =
let a = if a < 0: indexable.len + a else: a
let b = if b < 0: indexable.len - 1 + b else: b - 1
for i in a..b:
yield indexable[i]

I couldn't find one, but it really looks like something of the sort should be in there somewhere.

>> No.64715856

How? And are CL and Scheme good for anything else but metaprogramming?

>> No.64715861

>using sjlj for exceptions
Is this the 90s again?

>> No.64715867

RaIn DrOpS, dRoP tOpS

>> No.64715874

Too bad you have none of them

>> No.64715875

I did, it's a poor's man #[derive(Debug)].
You can do that even in stable Rust: https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md , both Serde and Diesel implement custom derives for their traits.

>> No.64715885


>> No.64715896

People come here for quick replies. This thread is used like a chatroom. Nothing intelligent can be found here, by design.

>> No.64715907

Inverted page table.

>> No.64715917

SJLJ comes with a cost for every SJ. In terms of emulating C++ exceptions, you'd be incurring a cost on entering every scope which contains any destructors.
SJLJ is just a middle ground between error codes and table-based stack unwinding in terms of the expected/unexpected path speed trade off.

>> No.64715930

Mapping from the code to the AST is not at all obvious, you have ~30 different kinds of nodes but it's not even type-safe, you can't use standard seq functions on the AST node types, many of the constructs can come in different variations instead of one canonical form, so you have to handle all the special cases, you can't splice an expression into a quote, you can't splice an array/list/sequence into a quote, this whole business with identifiers vs. symbols is annoying... it's just awful overall, and gets everything wrong. Hopefully the other aspects of the language are better.

>are CL and Scheme good for anything else but metaprogramming?

>> No.64715937


>> No.64715945

>I did, it's a poor's man #[derive(Debug)].
You're a fucking retard. Read the post again until you understand it.

>> No.64715957

>In terms of emulating C++ exceptions
Nobody wants to emulate C++ exceptions. SJLJ, in and of itself, is a lot faster than C++ exceptions. /dpt/ is really the only place where this fact is somehow up for debate.

>> No.64715998

Nope, SJLJ always slower than table-based unwinding on the happy path. It's a tradeoff. You need to go learn how SJLJ works.

>> No.64716000

>Mapping from the code to the AST is not at all obvious, you have ~30 different kinds of nodes but it's not even type-safe
Hmm, why is it not type safe?
>you can't use standard seq functions on the AST node types
That's hardly an issue.
>you can't splice an expression into a quote
You can though.
> you can't splice an array/list/sequence into a quote
You can make a macro for it afaik, but I haven't tried it myself.
>identifiers vs. symbols is annoying
Sounds like a non-issue

Sounds like mostly a baby duck syndrome to me, anon.

One of the many things I prioritize is performance. Are they good for making efficient programs? How does CL/Scheme fare in terms of performance?

>> No.64716057

>why is it not type safe?
Ask whoever came up with it. Almost everything is just a NimNode, so it will happily let you construct completely invalid trees.

>You can though
>You can make a macro for it
Oh, yeah? Show me.

>hurrrr all of these deficiencies aren't issues
Cool opinion, bruh.

>> No.64716093

>SJLJ always slower than table-based unwinding on the happy path
It's probably a hundred times faster on the sad path, and doesn't introduce significant overhead on the happy path, either. It also doesn't bloat your executable. You can call it a trade-off if you want. Maybe it's a sensible trade-off when you abuse exceptions the way C++ does.

>> No.64716106

how different is the C computer model and a modern computer? some people say they are quite different but i can't read assembly so I can't verify this

>> No.64716109

>so it will happily let you construct completely invalid trees.
Can you post an example?

>Oh, yeah? Show me.
Before that, I need to confirm what you mean by "splicing an expression into a quote". Do you mean generating a statement from an expression tree?

>> No.64716146
File: 28 KB, 740x489, 1514831527012.png [View same] [iqdb] [saucenao] [google] [report]


>> No.64716179

>Where the fuck did you get that dumb idea from reading my post?
You seem to think that a pointer to a struct page is taking a lot of memory, this isn't the case.

>It seems everyone here is too retarded to be able to actually answer my question, or even understand English. Oh well.
Because your question is fucking nonsensical and not to mention fucking stupid.

No, Linux doesn't waste a bunch of memory representing mappings. A single struct page instance is 4*2*16 bits = 16 bytes.

If you mapped your entire 32 GB address space, and assuming pages were 4KB for the entire range (protip: they aren't, the kernel also allocates large pages for this, especially IO stuff), representing this would consume 128 MB. Multiple tasks referencing the same pages only has a pointer to that page (8 bytes each).

I'm done dealing with your autistic screeching. You can look this shit up.

>> No.64716184

>Can you post an example?
>proc newProc(name = newEmptyNode(); params: openArray[NimNode] = [newEmptyNode()];
body: NimNode = newStmtList(); procType = nnkProcDef): NimNode
As you can see, nothing stops you from passing a node of the nnkIfExpr kind for a "parameter", or other completely ridiculous things. You gain nothing from this pseudo-typing except a tree structure that can't be manipulated conveniently.

>Before that, I need to confirm what you mean by "splicing an expression into a quote".
The same way you can splice in the contents of a variable, except with an expression rather than just a variable name.

>> No.64716225

>Foo is 100x slower on the sad path, barely faster on the happy path, therefore Foo is worse.
You're making the case for error codes, not SJLJ.

>> No.64716243

>nothing stops you from passing a node of the nnkIfExpr kind for a "parameter
But if fails to compile in such cases?

Also, splicing means joining, right? You can join expressions from both expression tree and quoted statements.

>> No.64716276

>You're making the case for error codes, not SJLJ.
I'm making the case for SJLJ over C++ exceptions when you actually need to jump multiple levels when an error happens, which may be often enough that the overhead of C++ on the sad path far outweighs the overhead of SJLJ on the happy path.

>> No.64716277

Any of these books worth getting digital copies of:


>> No.64716290
File: 34 KB, 600x600, 1518518780278.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.64716322

>buying .pdfs
you only buy books if you're getting a physical
but not really unless you want to learn the specific language, but they're all shit.

>> No.64716330

>But if fails to compile in such cases?
It fails to compile the generated tree, and you then have to figure out exactly what's wrong with it from syntax errors on code that you don't even see. If you're going to have dozens of specialized node kinds and prevent people from building and manipulating the tree like a standard data structure, at least give the nodes actual distinct types, so that passing an nnkIfExpr where an nnkIdent is needed would give you an error on the spot. The way it works in Nim, you just get the worst of both worlds: no flexibility and no useful type checking.

>Also, splicing means joining, right? You can join expressions from both expression tree and quoted statements.
Here's what I mean:
let x = generateSomeASTNode()
let y = generateASTNodeSeq()

quote do:
`x` # this is okay
`generateSomeASTNode()` # this isn't
?y? # there isn't even an operator for this
?y.map(f)? # this is completely out of the question

>> No.64716372

Don't believe me, see for yourself. Just compare the Linux and the Solaris code any day, kid.

>> No.64716384
File: 66 KB, 625x626, bait-0.png [View same] [iqdb] [saucenao] [google] [report]

>just compare [free as in freedom kernel] code with [partially closed source and proprietary kernel] code any day kid

>> No.64716412

Oracle hands access to the source code through the OTN, you rookie.

>> No.64716422
File: 18 KB, 600x600, bait-low-quality.jpg [View same] [iqdb] [saucenao] [google] [report]

>lol just license the code, what are you, a newfag?

>> No.64716457

>You seem to think that a pointer to a struct page is taking a lot of memory, this isn't the case.
Uhh no? what the fuck made you think that?
I'm talking about allocating millions of struct pages for all the physical pages your allocating for mappings.

>representing this would consume 128 MB
Exactly, that's what I'm saying you fucking idiot.
128mb of memory overhead just for all the fucking struct pages is a lot.

>16 bytes
Linux struct page is larger than that.
It looks to be larger than 64 bytes, which is more than 4x what you claimed, which means more than 4x the memory overhead, over half a fucking gigabyte of memory overhead just to store the struct pages.

>> No.64716468

Then we agree.

>> No.64716473

>over half a fucking gigabyte of memory overhead just to store the struct pages.
This is why I switched to Windows, and you should, too.

>> No.64716487

Anyone used AWS buckets to store their static files for a website? I've currently got the free version and it takes like 3 seconds to load an image from their server. Is this just because my account is free and it's being slowed down, or is this not the best way to serve static files?

>> No.64716497

> and you then have to figure out exactly what's wrong with it from syntax errors on code that you don't even see.
So there's a room for the compiler to print more friendly error messages. is that it? However I think specifying the nodeKind actually prevents silly mistakes.

>> No.64716509

You're a fucking idiot, kill yourself.

>> No.64716560

>128mb of memory overhead just for all the fucking struct pages is a lot.
That's for mapping the entire 32 GB address space AND under the assumption that huge pages aren't used, neither is a very realistic assumption.

>It looks to be larger than 64 bytes
It doesn't. It looks to be 4 * double words. A double word is 32 bit on x86.

>> No.64716596

>So there's a room for the compiler to print more friendly error messages.
Friendlier error messages don't solve the underlying problem, which is that you get neither useful type safety nor the advantage of being able to build and manipulate the AST like a standard data structure.

>is that it?
No. There's also the issue that there's no intuitive mapping from the code you see to an AST, and that the constructs don't translate into a single a canonical form, so you have to memorize multiple variations for dozens of different constructs. And there's also the issue that you can't splice expressions and sequences of nodes into the quote. We're running in circles here because there's no way for you to address the plethora of deficiencies in Nim metaprogramming.

>> No.64716602

>It looks to be larger than 64 bytes
That's because you are too dumb to know what a union is, mongo.

>> No.64716617

Ok but why do you call it not typesafe when it doesn't let you even compile invalid statement?

>> No.64716667

Doing exercism in elisp.
What other sites are like this ?

>> No.64716714

>why do you call it not typesafe when it doesn't let you even compile invalid statement?
Because that's irrelevant. The API for building the trees is effectively not type-safe because it just assumes that you will pass in the right kind of nodes, and if you don't, it just fails at what is essentially runtime for the compiler instead of failing while compiling your broken code generator (and before running it).

>> No.64716756

>it just fails at what is essentially runtime for the compiler instead
So, compile-time? Remember Nim is not an interpreted language.

>> No.64716807

>So, compile-time?
First your macros and compile-time functions are compiled (compile-time), then your macros and compile-time functions are executed and the results are compiled (run-time for the current stage, compile-time for the next stage), then the resulting code is executed (run time). Do you even understand how metaprogramming works...? Even if you don't, it's not so hard to understand that there's a runtime from the perspective of the compiler, and there's another runtime from the perspective of the program.

>> No.64716812

>but they're all shit.

About what I thought honestly.

>> No.64716828

Runtime for compiler is still compile time for the binary, is it not?

>> No.64716852

You are retarded.

>> No.64716916

>Runtime for compiler is still compile time for the binary, is it not?
Runtime for the the macro API is compile time for the binary. How is it difficult for you to grok?

>> No.64716924

>hurrrrrr u rong
/dpt/-tier argument right there.

>> No.64716945

Does anyone know a website to train algoritthm making in python ?

>> No.64716948

>Runtime for the the macro API is compile time for the binary.
That's what I've been trying to say, anon. Your concern of the lack of type safety would be valid if it would create a runtrime executable crash. Luckily Nim is a compiled language and checks these errors.

>> No.64716952

> C++

What is the simples way to direct parallel calculations to the GPU?

>> No.64716963


>> No.64717000

I found out why /dpt/ is shit.
4chan is the anti thesis of pretentiousness. This works well when we look at boards such as /lit/ and /mu/ since all other places are filled with pretentious discussion, but tech attracts Autists anyway. So this works against /g/ as all the good Autists are in places like stack overflow

>> No.64717012

Actually it's because you're here

>> No.64717029

Yup off to /lit/ and stack overflow I go.
Enjoy never progressing beyond fizz buzz.

>> No.64717052

I will thank you

>> No.64717055

How do I recover from failure (Nothing) in MaybeT monad stack? MaybeT is the outermost type in this case (if it matters). Control.Monad.Catch?

>> No.64717059

>Your concern of the lack of type safety would be valid if it would create a runtrime executable crash.
Every criticism you can make about PHP's shitty APIs applies directly to Nim's metaprogramming API. It's a garbage-in-garbage-out API. It doesn't warn you if you feed it garbage even when code that uses it executes, let alone beforehand. You only find out that your code generator is broken IF the code path that triggers it happens to be taken, and only when it's done constructing an invalid result, and this invalid result is fed to the compiler, which then bails out, nowhere near the site of the original error. This is classical PHP-tier lack of type safety, whether you want to call it that or not.

>> No.64717063

> How do I recover from failure
Get off 4chan.

>> No.64717068

Worst case you can runMaybeT it

>> No.64717071

Thank me.

>> No.64717072

#define MAX(a,b) (a>b?a:b)

void main(void)
int a = 3, b=4;

printf("%d %d %d\n",a,b,MAX(a++,b++));

Cniles will defend this

>> No.64717100

But anon! you seem to have forgotten about it again.
PHP, CL, Scheme ==> interprated
Nim ==> compiled ==> wrong types won't compile your project

>> No.64717104

Don't write retarded code like that.

>> No.64717124

I'll just try that. I feel very confused when I think what happens to the whole stack that also contains other effects (like passing around my environment) so I'll just check it.

>> No.64717144

A set P contains a set Q iff exists such set Q' that P contains Q' and for every x element of Q exists an element x' such that x' equals x and x' is an element of Q'

>> No.64717175

enjoy your freshman comp sci student circlejerk

>> No.64717177

Static typing could have prevented this.

>> No.64717184

But then wouldn't you need to show P contains Q' by showing that P contains Q'' and so on?

>> No.64717200

>completely failing to understand anything i said
I guess this is what happens when you're a dumb animal whose only experience with programming is C. Differentiating between the compile time of a program and the runtime of a metaprogram is just too much for your brainletism-stricken mind. In any case, the metaprogramming API for Nim is hugely deficient, no matter how much you screech that it doesn't affect the executable. Metaprogramming in Nim is still like programming in PHP, which you can't refute.

>> No.64717208

misquote. he worries a lot about the linux kernel code.

>git actually has a simple design, with stable and reasonably well-documented data structures. In fact, I'm a huge proponent of designing your code around the data, rather than the other way around, and I think it's one of the reasons git has been fairly successful […] I will, in fact, claim that the difference between a bad programmer and a good one is whether he considers his code or his data structures more important.

>> No.64717210

>Lying in an exception handler
Current state of /g/

>> No.64717259

You can

>> No.64717269

If you are not a contrarian, you would actually agree that your concern is only valid if Nim was interpreted, since it's not it does not have to check types because it'll not compile anyway. It's not runtime, it's compiletime.

>> No.64717309

Come back when you understand the difference between the compile time of a program and the runtime of a metaprogram. Your absolute idiocy is not an argument, and doesn't refute the fact that Nim's metaprogramming API is a PHP-style garbage-in-garbage-out hack.

>> No.64717316

Shut up

>> No.64717324

What is a "metaprogram"?

>> No.64717329

New thread:


>> No.64717383
File: 53 KB, 404x765, GoogleCallMe.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.64717386

>Using C macros
Here's your problem.

>> No.64717397

>What is a "metaprogram"?
A program that manipulates parts of another program as its data.

>> No.64717426

Sounds like a compiler to me

>> No.64717447

>using C
here's your problem

>> No.64717450
File: 7 KB, 225x225, f522fe9a454f0bb8d08bd917057265d5.jpg [View same] [iqdb] [saucenao] [google] [report]

>Sounds like a compiler to me
Yes, a compiler is a metaprogram. Now maybe you should sit down and maul over this observation.

>> No.64717475

What should you use for systems programming?

>> No.64717485

If compiler is a metaprogram is compiling metaprogramming?

>> No.64717487

or even (((rust))) if that's your thing

>> No.64717505
File: 137 KB, 340x340, 729.gif [View same] [iqdb] [saucenao] [google] [report]

>If compiler is a metaprogram is compiling metaprogramming?
If web browser is a program, is browsing 4chins programming? (I bet /dpt/ thinks it is.) Damn, man. I am having a real hard time not losing my patience with you.

>> No.64717508

The only parts of C++ that don't suck are the parts that derive from C.

Rust is trash, but the macros seem decent at least.

>> No.64717526

But anon, 4chan JS will do certain programming tasks on my browser!

>> No.64717562

>lisp fag BTFO

>> No.64717577

Are you stupid or something? You just got the relationship between "metaprogram" and "metaprogramming" wrong. If you don't understand why, read >>64717505 again.

>> No.64717589
File: 50 KB, 472x568, GoogleCallMe2.jpg [View same] [iqdb] [saucenao] [google] [report]


>Semi seriously:
What else would i need to do to make it good code?

>> No.64717606

Embodiment of retardation.

>> No.64717971

suck my dick

>> No.64718170

desu its easier to understand as it is

>> No.64718215

C is an old and simple language, but that's not a reason to be retarded.

>> No.64718315


>> No.64719185

>not this fag again

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