[ 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: 2.23 MB, 3840x2160, 1538945408235.jpg [View same] [iqdb] [saucenao] [google] [report]
68098389 No.68098389 [Reply] [Original] [archived.moe] [rbt]

What emulator software are you writing up /g/?

Previous >>68091443

>> No.68098398

Kpop fags get out, post anime girls

>> No.68098409

For me, it's the zig guy

>> No.68098410
File: 7 KB, 480x360, 1527831486059.jpg [View same] [iqdb] [saucenao] [google] [report]

Is there a sane, simple to use C++ socket library that also supports IPv6?

>> No.68098414


>> No.68098439

do you guys have some (possibly obvious) tips regarding performance that you can share?

>> No.68098455

Use multithreading whenever you can

>> No.68098465

don't use multithreading whenever you can

>> No.68098475
File: 15 KB, 300x300, sedgewick-robert-image.jpg [View same] [iqdb] [saucenao] [google] [report]

You should check out my book.

Multithreading is a bit of a meme. Dividing a problem into smaller pieces gives a large benefit, doing those smaller pieces parallel gives a relatively small one.

>> No.68098477

Work on abstract types whenever you can

In days of my youth working with Linq in C# I always used .ToList() or .ToArray() methods, which is stupid and impairs performance if you can work with IEnumerable

>> No.68098479

Don't optimise before you're certain your code works as it should, in all cases.

Also, run experiments on runtime multiple times. Begin with at least 10 times in a row. If you've got the time, do it 100 times or more.

>> No.68098482
File: 80 KB, 504x688, regexbenchmark.png [View same] [iqdb] [saucenao] [google] [report]

Don't fall for the Java/C# meme

>> No.68098483

>You should check out my book.
which one?

>> No.68098492

Wait what? Aren't you wasting your cpu cores for not using them?

>> No.68098497

what language for implementing high level logic fast would you recommend?

>> No.68098504

Are you wasting your muscles by not continually flexing and relaxing them?

>> No.68098505

Pick your favourite Lisp.

>> No.68098512

Any sort of number crunching that can be parallelized gets a massive performance boost (see: any parallel numerical analysis, e.g. CFD applications such as Ansys Fluent) up until inter-process communication and disk I/O throttle it. Many well parallelized programs scale linearly with the amount of FLOPS it has available into 1000s of cores.

>> No.68098518

what would the time complexity be of a loop where after each iteration the iterator increases by a factor of 1, 10, 100, etc?

>> No.68098528

but i don't like any

>> No.68098532

this is what retardation looks like

>> No.68098536

O(n), I think.

>> No.68098538

Pick your favourite functional language.

>> No.68098543

It's simply called "Algorithms" by me, Sedgewick and some other dude. It's available for free, and there's also a course website as well as a free course on coursera with video lectures.

Quick google gives this (lmao medium)

For sure, in some applications there are massive benefits to parallelism, but those are fewer and farther in between than I think people in general believe.

>> No.68098545

but the iterator isn't being increased by a constant

>> No.68098561


Every iteration it "skips" another part of the problem. Check out complexity analysis of binary search trees, it's the same thing. You get log2(N) performance since you always divide the problem in half each iteration.

>> No.68098572

thanks i actually just then thought it may be log_10(n) so i apprieciate the validation

>> No.68098586

np bro <3

>> No.68098607
File: 111 KB, 640x484, 1495649258667.jpg [View same] [iqdb] [saucenao] [google] [report]

IOstream(e.g Cin and Cout) can be faster than the standard scanf and printf if you disable io synchronization, but having that io synchronization is generally helpful and in all other cases scanf and printf will vastly outperform the IOstream.
It is therefore a good general idea to just use scanf and printf instead of Cin and Cout.

>> No.68098609

>run experiments on runtime multiple times. Begin with at least 10 times in a row

when benchmarking remember to call GC right before calling benchmarked method
if you're benchmarking two methods try chaning their order and see if results are consistent
when measuring time always make at least 100 iterations of each method

>> No.68098613

>sane socket library
Does not exist, whatever the language.

>> No.68098700


>> No.68098837

Should I even bother writing a CMakeList.txt for a project with 2 files?

>> No.68098845 [DELETED] 

So I'm still having problems with this piece of code:

I keep getting errors about how the argument of a a void function cannot convert a bool to bool[][20] even though I made clear everywhere the bool variable is an array.

Why is this happening?
both rows and columns are defined constants.
void Cell_Status(char cell[rows][column], bool cellState[rows][column]);
void check_state(bool cellState[rows][column]);

void Next_State(char cell[rows][column], bool cellState[rows][column]){

int x,y;

for(x = 1; x < rows; x++)
for(y = 1; y < column; y++ )
cell_status(cell[x][y], cellState[x][y]);

the problem is I'm passing arguments that should be arrays as single values.
So I tried what this anon told me >>68092686

The problem is that the check_status void needs an array to go through, what this function does is take one cell[x][y] and check the nearby cells like cell[x+1][y-1]

How should I fix this thing?

>> No.68098885
File: 136 KB, 311x360, Yuki-Using-Computer-GIF-yuki-nagato-38663943-311-360.gif [View same] [iqdb] [saucenao] [google] [report]

Today I did the Hackerrank problem Mini-Max Sum which asks you to find the maximum and minimum sums possible using 4 out of 5 input numbers.
Here is my code:
// Complete the miniMaxSum function below.
void miniMaxSum(int arr_count, int* arr) {
long int minsum, maxsum;
int min, max, sumnummin, sumnummax;
sumnummin = sumnummax = 0;
max = min = arr[0];
maxsum = minsum = 0;

//Go through input array to find max and min numbers
for(int i = 0; i < arr_count; i++){
//New max value
if(arr[i] > max){
max = arr[i];
//New min value
if(arr[i] < min){
min = arr[i];

//Go through array to find max and min totals
for(int i = 0; i < arr_count; i++){
//Add max number to maxsum
if(arr[i] == max & sumnummax!=4){
maxsum = maxsum + arr[i];
//Add min number to minsum
if(arr[i] == min & sumnummin!=4){
minsum = minsum + arr[i];
if(arr[i] != min & arr[i] != max){
maxsum = maxsum + arr[i];
minsum = minsum + arr[i];
printf("%ld %ld", minsum, maxsum);

>> No.68098908

yes, embrace object oriented programming asap.

>> No.68098919

nigga I've never used that shit for projects bigger than 5 C files

>> No.68098926

ignore this massive memer

>> No.68098995
File: 44 KB, 636x616, 1474325315193.jpg [View same] [iqdb] [saucenao] [google] [report]

Employed Haskell programmer reporting in

>> No.68099100

Newfag here
Best way to learn python for someone next to no experience in programming ? Reason for python is due to uni course

>> No.68099122


How about reporting out?

>> No.68099149


>> No.68099152

why is c so hard?

>> No.68099178

Help me understand circular references. This is invalid
// class A header
#include "B.h"
class A ...
B* b_ref;

// class B header
#include "A.h"
class B ...
A* a_ref

But this isn't.

// class A header
#include "B.h"
class A ...
B* b_ref;

// class B header
class B ...
class A* a_ref

// class B source
#include "A.h"

First, what's wrong with circular references? In many cases I know two classes to know about each other. And keeping a direct reference to the other (through weak pointers, not through raw pointers like I did in the example just for brevity) is very useful. Besides, if circular references are bad, why does the language give you a tool to include them through forward declarations?

>> No.68099179

it's not though, it's so simple

>> No.68099183

javalet here
How do I instantiate objects of different classes to an arraylist?
for instance, I have a super class called animals, with two subclasses: cats and dogs
I want to add 1 animal, 2 cats, and 2 dogs to my list.

>> No.68099198

Use base class pointers.

>> No.68099206

In 1st one, looks like both files will infinitely include the other file, which obviously wouldn't work

the 2nd one, B source includes A header, which in turn includes B header. There's no circular reference, no infinite inclusion of 2 files

>> No.68099218

Circular references are fine. They only cause issues with reference counting.

>> No.68099219

So the only problem is with headers including each other? Then forward declarations are fine to use like that? I've heard a few times that I should avoid forward declarations

>> No.68099232

>Then forward declarations are fine to use like that?
From your 2nd example, it looks like that. Expanded B.c would look like the following and contain forward declarations:
// class B source
class B ...
class A* a_ref

class A ...
B* b_ref;

>> No.68099246

I don't understand what your problem is
ArrayList<Animal> a = new ArrayList<Animal>();
a.add(new Animal());
a.add(new Dog());

>> No.68099255

Cool, that's a much saner approach than casting when I needed to access A from B

>> No.68099267

I just realized I sounded condescending, I was just trying to say that I wasn't sure if that snippet of code was what you were asking for

>> No.68099294

>Holds P1 stick
>Presses P2 buttons
What did she mean by this?

>> No.68099306

Only the cutest kpop idols are hardcore enough to control 2 players at once

>> No.68099337

she inputs cheat code.
I cant tell what game is on screen but Bubble Bubble for example does that.

>> No.68099346

So none of them?

>> No.68099348

Hello, programming help desk? I've started to misuse extension methods, please send help

>> No.68099428

Whatever you're doing you should probably consider hashsets

>> No.68099572
File: 369 KB, 1000x494, 1539753243576.png [View same] [iqdb] [saucenao] [google] [report]

JavaScript rocks!

>> No.68099606
File: 84 KB, 478x618, enemy of the state.png [View same] [iqdb] [saucenao] [google] [report]

Haskell will help you

>> No.68099623

Javascript paper! I win!

>> No.68099646
File: 48 KB, 979x505, shaders.png [View same] [iqdb] [saucenao] [google] [report]

I feel like I should've added some kind of timestamp to the printout

>> No.68099662

Is carrying a weight with one hand easier than with two?

>> No.68099672

Javascript scissors.. aw shit

>> No.68099821

That solution is pretty over-complicated.
void miniMaxSum(int array_size, int* array)
int min = INT_MAX;
int max = INT_MIN;
int sum = 0;
for (int i = 0; i < array_size; i++)
if (array[i] < min)
min = array[i];
if (array[i] > max)
max = array[i];
sum += array[i]

int minsum = sum - max;
int maxsum = sum - min;
print(whatever the fuck);

>> No.68100007
File: 6 KB, 488x43, Screenshot from 2018-10-17 15-33-18.png [View same] [iqdb] [saucenao] [google] [report]


>> No.68100127

Avoid floating point operations and use lookup tables wherever possible.

>> No.68100130

Isn't this whole problem based on sorting an array of numbers and then getting the n objects from each end of it and sum them?
def minimax(argarr, count):
finalarr = sorted(argarr)
print("Min is {:d}, Max is {:d}".format(sum(finalarr[:count]), sum(finalarr[count:])))

I assume the inputs are caught before sent to it, so count is strictly < argarr.len

>> No.68100180

Multithreaded code is much harder to get right and even then Amdahl's Law applies. A 3-legged race is a better metaphor.

>> No.68100191


>> No.68100194

Writing an OS is a good use of your time

>> No.68100216
File: 709 KB, 1000x1024, youshouldbeabletosolvethis.png [View same] [iqdb] [saucenao] [google] [report]

>calls it best post
>doesn't post anime girl
you had one job, anon

>> No.68100227
File: 50 KB, 400x400, 1526195828936.jpg [View same] [iqdb] [saucenao] [google] [report]

Quit your job
Make videogames

>> No.68100239
File: 36 KB, 550x550, todd.jpg [View same] [iqdb] [saucenao] [google] [report]

Why would you make video games when you could buy them

>> No.68100259

Most self-employed video game programmers fail.
Most employed video game programmers work horrible hours at mediocre pay.

>> No.68100290

ummm sweatie ever hear of a little game called, I don't know, maybe "Minecraft"? ;)

>> No.68100292

Locality is big given the way cache works. Compact homogeneous data structures will be much faster than indirect heterogeneous ones. This favors arrays over linked lists in defiance of big-O up to surprisingly high scale, this favors structs of arrays over arrays of structs, and this favors languages that give you control over layout and specifically over boxing/unboxing over more purist OO or FP languages where everything is boxed and every data structure is a rat's nest of pointers.

OTOH computers are fast now, so write that compiler in Haskell rather than C++ unless you really know you need sanic speed.

>> No.68100297


>> No.68100300

>he uses OOPs in 2018

>> No.68100313

you know what "most" mean, don't you?

>> No.68100346

eeeerm my dear ever heard of funny little guy called Jeff Bezos, also known as RICHEST FUCKING MAN ON PLANET? why don't you just make online bookstores?

>> No.68100347

>he uses a functional language in CURRENT YEAR

>> No.68100366

cave story, stardew valley, touhou, rim-world, ...
I could go on but if you're not good enough then you're not good enough ;)

>> No.68100383
File: 333 KB, 1106x962, anecdotal.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.68100393

Now compare it to buying lottery tickets.

>> No.68100403

you REALLY REALLY REALLY don't want to go there senpai

>> No.68100421


>> No.68100454

multi-paradigm languages rock. I want a tool, not a church.

>> No.68100481

Multi-paradigm code is a mess

>> No.68100485

>keeping a handful of spaghetti in with your tools
why tho

>> No.68100660

How would you request a random entry from an API call in python?

>> No.68100696


>> No.68100820

Why would you allow overriding registrations with SimpleInjector?

>> No.68100827

Lisps eternally btfo

>> No.68100852
File: 69 KB, 723x542, 2018-10-17-170709_723x542_scrot.png [View same] [iqdb] [saucenao] [google] [report]

Just some file uploading tool, to make things faster

>> No.68100865
File: 1018 KB, 477x185, common_lisp.gif [View same] [iqdb] [saucenao] [google] [report]


pic related

>> No.68101066

Needs help here, this is a small bit of my code covering a void function that is not woking, this is how I tested it.

It should display a + character, but nothing appears.

void check_cell(char cell, bool cell_status);

bool cell_status[rows][columns];
char cell[rows][columns];

int main()
cout<< "hi"<<endl;
cell_status[3][2] = false;
check_cell(cell[3][2], cell_status[3][2]);

cout << cell[3][2] << endl;


void check_cell(char cell, bool cell_status){

if (cell_status == true){
cell = '■';
if (cell_status == false){
cell = '+';


>> No.68101107

>get back to a project after 2 months
>not a singe comment throughout

>> No.68101115

Why did € turn into 竄 on different machine?

>> No.68101148

>if(d == True)
>if( ... )
>comparing booleans

>> No.68101149

cell and cell_status are not initialized
check_cell does its operations on arguments that are passed by copy
should either work on a reference/pointer or simply return the char you want to set

>> No.68101169

you're working with declared variables, not pointers, you're changing the content of the cell in check_cell, not the one in cell[3][2]
it should be something like void check_cell(char *cell, bool *cell_status){
*cell_status ? *cell = '■' : *cell = '+' }
or similar

>> No.68101225

what do you mean increases by a factor?

for(i = 0;i < n;i+= k) is theta(n)
for(i = 0;i < n; i += k*i) is theta(sqrt(n))
for(i = 0;i < n; i *= k) is theta(log(n))

>> No.68101253
File: 47 KB, 979x505, shaders2.png [View same] [iqdb] [saucenao] [google] [report]

It's still going

>> No.68101264

error: invalid conversion from ‘char’ to ‘char*’ [-fpermissive]

>> No.68101295

you're supposed to feed it as check_cell(&cell[3][2], &cell_status[3][2]);
that's terrible form however, you should rewrite it to give it access to the arrays via pointers AND the coordinates as just values.

>> No.68101298
File: 806 KB, 1001x823, 1498564882917.png [View same] [iqdb] [saucenao] [google] [report]

My current plan
>Finish CS degree
>Become backend web dev, the good stuff
>Make games in free time
>Quit job when game earns money

>> No.68101408

>that's terrible form however, you should rewrite it to give it access to the arrays via pointers AND the coordinates as just values.

I've been trying to find a way to do since yesterday, would you please show me how you would rewrite it?

>> No.68101417


>> No.68101450

it's their own fault they fail. luck is a concept made up by garbage developers so they have something to blame for their lack of success

>> No.68101539

C isn't really my language but
void check_cell(char *arrcell, bool *arrstatus, int row, int col){
*arrcell[row][col] = *arrstatus[row][col] ? '■' : '+';

>> No.68101604

also, of course you should try{}catch{} it for oob within the function, but I really don't know what the scope of this is so you're on your own on that one

>> No.68101749
File: 1.61 MB, 480x270, laughing.gif [View same] [iqdb] [saucenao] [google] [report]

>his debugging is print statements

>> No.68101752

>you should try{}catch{} it for oob within
not in C he shouldn't
what he could do is check that row < rows and col < columns

>> No.68101783

better for sure, I don't know how much of a problem is writing/reading oob of a pointed array because, again, C isn't a language I use on the daily, I guess catching exceptions is better than expecting shit not to go awry inbounds

>> No.68101825

>I don't know how much of a problem is writing/reading oob of a pointed array
it is a huge issue of course, you read/write random memory
but exceptions do not exist in C. nobody will complain if you're reading/writing the wrong address, things will simply break randomly

>> No.68101856

Utf-8 doesn't have this problem

>> No.68101875
File: 658 KB, 802x767, java.png [View same] [iqdb] [saucenao] [google] [report]

>> No.68101877

I'll do with it, thanks.

>> No.68101924


>> No.68101946

that bitch so uggo

>> No.68102000

daily reminder that Python is named after Monty Python, and like its namesake is vastly overrated among obnoxious, self-consciously "geeky", pseuds

>> No.68102018

>vastly overrated among obnoxious, self-consciously "geeky", pseuds

>> No.68102022

>youtube is still fucked up
the absolute state

>> No.68102025

3d > 2d

>> No.68102125

your fucking gook doesn't even know how to play in a arcade.

>> No.68102226

What’s the best language to focus on if I want to make as much money as possible and I don’t care about anything else?

>> No.68102278


>> No.68102282

Java + JS

>> No.68102332

It's been fine for me since this morning

>> No.68102405
File: 238 KB, 1280x1110, 1525129586276.jpg [View same] [iqdb] [saucenao] [google] [report]

I took a beginner python course to fill out my electives in Uni. It was the only one that didn't have the word gender in it. I have a midterm tomorrow and I don't know how to study. It's not something you can read up on, it seems you just need to do it. Does anyone have a suggestion? It's entirely super basic stuff like printing a square of of different sizes out of a letter, or manipulating images.

>> No.68102424

// _: linear (1)
// ?: affine (0...1)
// !: intuitionistic (0...n)

type Iterator(A) = !(A *) ();

func map[A, B](xs: Iterator(A), f: !(A -> B)) -> Iterator(B) {
for x in xs {
yield f(x);

func filter[?A](xs: Iterator(A), p: !(!A -> Bool)) -> Iterator(A) {
for x in xs {
if p(x) {
yield x;

>> No.68102525

what language is this

>> No.68102542

Didn't you have proc instead of func at one point?

>> No.68102550


>> No.68102559


Yeah, I'm not committed to one or the other.

>> No.68102580

>write LLVM tool, build using GCC 8.2 and run tests
>all works flawlessly
>try building and using with clang++-7.0.0
>link time error because no standard library symbols
>fix it
>segmentation fault when calling LLVM API functions
What the fuck? I thought Debian built their packages with clang on top of that so how could it fail MORE than with g++?

>> No.68102646
File: 1.04 MB, 2023x1350, Mining.jpg [View same] [iqdb] [saucenao] [google] [report]

Hey, that's not a bad name. The Mine language...
What kind of mine were you thinking of?

>> No.68102666

Chinks should be genocided for coming up with such an inefficient and trash writing system.

>> No.68102690
File: 96 KB, 750x750, 1512158239284.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.68102711

Hey /g/ I want to write bots for simple games like Tetris, Zuma etc.. what programming language or library is best for this? How would you do it?

>> No.68102726

How is iterator(A) any different from !A?

>> No.68102744

Fuck off and kill yourself. Your taste in programming languages is appalling.

Fuck off and kill yourself. Your taste in programming languages is appalling.

>> No.68102773

I like kpop but imo OPs shoould have something to do with programming

>> No.68102785

Yeah, like anime.

>> No.68102822

Is Haskell any good?

>> No.68102838

whats the best C++ redis lib?

>> No.68102839

>Is <not a zero overhead language> good?
No, of course not.

>> No.68102844

why is cabal/stack still such shit

>> No.68102850

If you go full Pascal with the formals and actuals and replace assignment with :=, this could be something I'd use or work on with you.

>> No.68102853

Why is your syntax heavily imperative when it's clear you want a more functional thing?
Just copy Idris
map : [A, B] -> (xs: Iterator(A), f: !(A -> B)) -> Iterator(B)
for x in xs
yield f(x);

>> No.68102873

also leaving out the semi-colons as they're not needed if you use indentation like a good language.

>> No.68102879

Because he wants a good language not a bad language.

>> No.68102880

It's fine. I prefer OCaml as a language, but Haskell has its things going for it. Overall if you're planning on using one, you can easily implement functionalities from the other your yourself.

>> No.68102888
File: 9 KB, 225x225, download (4).jpg [View same] [iqdb] [saucenao] [google] [report]

>significant whitespace

>> No.68102892

I'm fucking bored /dpt/
I need to do something functional to do

>> No.68102898


>> No.68102903

I don't know how anyone could possibly think this looks good.
Braces and semicolons should be mandatory for every programming language.

>> No.68102907

I can even encode exceptions.
// #: empty type
type Result(E, A) = ?(E * # ->) A;

The only way to produce a # for the continuation is to break out of the for loop that is acting like the exception handler (in general, the continuation is called with a value passed to "continue", as you might expect).

!A means "immutable A", which allows copying and dropping. !(A *) () means "a number of As followed by ()", which expands to "() or A * () or A * A * () or ...". There's a good reason to reuse the same symbol.

I am using := for assignment, yes.

There's more to functional programming than significant whitespace and currying.

>> No.68102918

Fuck off baby duck.
Python is not the only language that uses whitespace.
another little ducky.
i just meant the general syntax, your language reminds me of Rust which isn't a good thing.

>> No.68102946

semicolons are useless

>> No.68102964

nobody mentioned python though...?
significant whitespace is just objectively bad and end of "line" (allowing for multi-line statements, for readability more than length) demarcation is objectively good

>> No.68103001

Being a mathlet is so fucking tiresome I wanna kms.

>> No.68103005

btw i wrote a linear system f type-checker earlier today, was pretty interesting
i guess you could have a difference between !A and Enumerator<A> where !A is guaranteed to produce equivalent copies while Enum A could produce different values

>> No.68103019

whoops I mean Iterator not Enum

>> No.68103020

Say I want to experiment with neutral networks. Like get a feature vector out of some faces. How should I do it?
I don't have a GPU, or large hard drive space.
Can I just download https://github.com/seetaface/SeetaFaceEngine/tree/master/FaceIdentification, then paste the feature vectors into excel and do a linear regression?

>> No.68103022

>nobody mentioned python though...?
the only people who hate whitespace are either baby duck POO worshipers or people who just associate it with Python, or both.
>significant whitespace is just objectively bad
How is less characters type and on screen "objectively bad"?
How is not bike-shedding over



... {

objectively worse
Whitespace especially scales better with more layers. Whereas brackets only get worse.

>> No.68103034

How do I make it so I can read/write txtfiles from a jar? I looked around and most places said to put any non-read only resources outside the jar, but I don't want to have to use an absolute classpath, I just want to be able to have the file being written/read from to be in the same directory as the jar.
I think I need to use getresourceasstream but I dont really understand it

>> No.68103083

>actually defending significant whitespace
>in the current decade

>> No.68103091

Anime is just a medium, it's about the content. If there is some cute girl programming, why not.

>> No.68103092

>i guess you could have a difference between !A and Enumerator<A> where !A is guaranteed to produce equivalent copies while Enum A could produce different values
You're more or less correct, and Iterator is also lazy.

!A is the regular exponential modality in the symmetric monoidal category of values (from linear logic) and !(A *) is in the monoidal category of endofunctors (it makes free monads). (A *)* would be the proper notation but that's confusing.

>> No.68103101

>no arguments
>in the current nanosecond

>> No.68103109

I guess if we're really talking about proper notation than Iterator(A) should be (A ⊗)* I.

>> No.68103123

anyone with half a brain knows that using formatting features as syntactic features is retarded
stfu with your retard ass assumptions and your retard ass ideas

>> No.68103124

what would that be like with ν / the greatest fix point

>> No.68103127

newly installed debian(new to linux) and trying to learn rust but rustc, rustup, and cargo commands aleturnl rreturn command not found

:~$ rustup doc
bash: rustup: command not found

>> No.68103153

>still no argument

>> No.68103167

>terminally blind

>> No.68103172

you have to install them you absolute weapon.

>> No.68103191

It's actually the least fixpoint.
Iterator(A) = μX. I ⊕ A ⊗ X
Greatest fixpoints come from codata in my language.

>> No.68103192

tell me why it's retarded
Hard mode: Use actual objective arguments and not subjective preferences and bias

>> No.68103213

i would have thought an infinite stream would be codata?

>> No.68103232

newline is different between OSes
can't break a long line
your code will literally break if you forget a tab

>> No.68103257

Iterator(A) is finite. If you wanted an infinite stream, you'd do:
type Stream(A) = A * Stream(A);

>> No.68103258

:~$ curl https://sh.rustup.rs -sSf | sh
info: downloading installer

Welcome to Rust!

This will download and install the official compiler for the Rust programming
language, and its package manager, Cargo.

It will add the cargo, rustc, rustup and other commands to Cargo's bin
directory, located at:


This path will then be added to your PATH environment variable by modifying the
profile file located at:


You can uninstall at any time with rustup self uninstall and these changes will
be reverted.

Current installation options:

default host triple: x86_64-unknown-linux-gnu
default toolchain: stable
modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation

info: updating existing rustup installation

Rust is installed now. Great!

To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH
environment variable. Next time you log in this will be done automatically.

To configure your current shell run source $HOME/.cargo/env

after logging out and logging back in, still getting same error
if i need to mess with PATH, what would i need to do with it?

>> No.68103277

>newline is different between OSes
>what is encoding
>can't break a long line
>your code will literally break if you forget a tab
your code will literally break if you forget a semi-colon and a pair of brackets.

>> No.68103279

ah i see

>> No.68103290

add source ~/.cargo/env to your bashrc/zshrc

>> No.68103295

you’re trading a single extra character per line (that doesn’t require any thought btw) for the freedom to format your code in a way that makes it more readable. objectively fewer features just so you don’t have to type a single character

>> No.68103306

IRL performance > computability performance. Learn pomodoro and read more books fuckass.

>> No.68103321

>>newline is different between OSes
>>what is encoding
doesn't change the fact that the fucking characters are different
>your code will literally break if you forget a semi-colon and a pair of brackets.
>forgetting an invisible multiple-use character is the same as forgetting a single purpose visible character

>> No.68103340

if d
if f is not none and not d
if e and not encryption_lock
if g is not none
if b is not none
if f is not none

ftfy. also get rid of the parenthesis unless you specifically know that you need something evaluated in a certain order
Jesus. Why are you using python to just run shell commands. Write a bash script instead. sort out your life, kid

>> No.68103345

>freedom to format your code
Which causes bike-shedding which derails discussion which slows down language development. Which is why all languages nowadays have strict formatting guides or even auto-formatters. Gee, imagine if the language only had one way to do something so we didn't have to waste time and effort on meta-tools.

>> No.68103407

Why is opencv 200 megabytes? All I wanted to do was play around with neural networks, but it needs to install gtk and stuff. Why?

>> No.68103446

You're right, it's a lot easier to miss a semicolon than it is to miss a tab, I'll give you that.

>> No.68103481

Here are the only three ways to make things faster. Ready?
- do less
- do it less often
- do it faster
Biggest gains come from 1 and 2, but it’s too tempting to focus on three.

>> No.68103511

>get rid of the parenthesis unless you specifically know that you need something evaluated in a certain order
I hate this mentality
like braces being optional in C for single line if/etc
I add the braces anyhow, wow what a scrub right? I also avoid needless problems

>> No.68103519

How else will you look at the results of your experiments?

>> No.68103541

>me like typing more
>me need to see curvy lines all time
literally the mentality of a caveman/child.

>> No.68103571

I don't give a shit about your shitty api, I just wanna make a qt3.14!!

>> No.68103573

it's a bit more like "me like consistency leading to less cognitive overhead because I don't care for the (((convenience))) of minus two characters in a single specific use case"

>> No.68103607

>to less cognitive overhead
literally whitespace
You're lying to yourself if you think having to read brackets and semi-colons for scope is faster than whitespace.

>> No.68103615

>a single specific use case
which has a very non-zero likelihood of being altered out of that use case, and then breaking if you don't add the curlybois

I just fail to see the point in the slightest.The only thing I can think of is something to feel smug about, "heh, you DO realize you don't NEED braces on a one-liner, right...?"

>> No.68103629

brain-to-eye: Ok eye, look for something
brain-to-eye: Ok eye, look for correct whitespace

>> No.68103638

Alright lad, you completely threw yourself with that post.
I am done.

>> No.68103650

Well good, I'm glad that I won this discussion.

>> No.68103656

why not just make a decent language that's independent of whitespace and semicolons?

>> No.68103673

Do browsers disable JavaScript alerts by default? I'm trying to do some hello work homework but the alert never shows. I copied everything from the book so it must be right. It won't show in IE either. How can I test if my browser is blocking it?

>> No.68103682

it's one or the other, you choose your fate
there is no alternative

>> No.68103684 [DELETED] 
File: 9 KB, 914x26, Screenshot from 2018-10-17 20-56-08.png [View same] [iqdb] [saucenao] [google] [report]

uh, does anyone who uses emacs/spacemacs know what I did to not be able to open this file?

>> No.68103690

then you eventually have to settle on

>> No.68103691

Actually OCaml works with neither

>> No.68103695

>Do browsers disable JavaScript alerts by default
usually they don't
show your code

>> No.68103702


>> No.68103710

how else would you mark end of block or statement?

>> No.68103712

wew lad

>> No.68103716

you're literally just replacing semi-colons with end.
show me a language that doesn't depend on end then, if not for important whitespace or some kind of line delimiter.

>> No.68103725

ZeroMQ or nanomsg?

>> No.68103731

>you're literally just replacing semi-colons with end.
Thank you for your ignorant input. ML languages use let in

>> No.68103750

don't use statements

>> No.68103764

ocaml uses let end, whats the fucking difference between type ... ;

>> No.68103791

stfu and kill yourself you ignorant fuck.

>> No.68103814

yes ocaml has some implicit delimiters, but on the surface, it's no different than whitespace. But on the inside implicit delimiting creates more complexity.

>> No.68103816

For some reason the connection fails every time I try to use the code tags. The code is https://pastebin.com/x4QkMNSs

And then there's the script file called myscript.js, that only has the line:


>> No.68103822

Are oracle java certifications worth getting? If so how do they exactly work? Do I just go somewhere and do the test or is it online?

>> No.68103837

i've been trying to look this up since you said it but i'm having no luck. i've figured out that it's bashrc i'd be editing, but otherwise im not sure how to do what you said to do

>> No.68103857

><body onload()>
what is this?
I haven't done js in a very long time, but to me this doesn't mean anything
what you should do is add an event listener on the document load in your js code

>> No.68103865

.bashrc (the . is important) should be in your home folder
edit it and add
source ~/.cargo/env
at the end

>> No.68103888

>what is this?
I don't know. I guess it means to trigger something when the page is loaded.
>add an event listener on the document load in your js code
Sounds like magic. I dindu understand at all. Gomen.

>> No.68103892

What human language are you learning alongside a programming language?

I'm learning korean while writing a compiler in C

>> No.68103923

search for the keywords in google, you'll get thousands of tutorials
check w3schools

>> No.68103924

russian, so I can read kolmogorov and many others in their native text

>> No.68103927

i speak 3 languages and my fourth needs a bit of practice
i still can't talk to humans properly

>> No.68104022

I speak 3 languages, 2 as a native. I'd like to learn moons in a near (or not so far) future.

>> No.68104054

learn it now mah nigga

>> No.68104087

do programming socks also help here?

>> No.68104099

>tfw only know american and c

>> No.68104111

done, but the commands still give the same result.
:~$ rustup doc
bash: rustup: command not found
i'm not totally sure whats up

>> No.68104120

back to your cave cnile

>> No.68104122

learn scheme
it's beautiful

>> No.68104130

could it have to do with the fact that env only contains the text
export PATH="$HOME/.cargo/bin:$PATH"

>> No.68104144

>tfw want to get into american, but only know british english
learning a 2nd lang is hard

>> No.68104175

open a new terminal
or simply type bash in your current terminal

>> No.68104178

scheme exists by the way
it uses brackets

no white space and semicolons

>> No.68104199

oh great, i get to trade curlies and semi-colons for a jungle of ((((((((((((())))))))))))))))))))).

>> No.68104218

someone post the "what a lisp programmer sees" vs "what a low iq neanderthal sees"

>> No.68104219

Wasn't that the guy who theorized that the most efficient possible algorithm for integer multiplication was n^2? Then, as the story goes, one of his grad students heard this and immediately went and invented an O(n^~1.5) algorithm, i.e. Karatsuba multiplication.

>> No.68104257

protip: in american, scheme uses "parentheses", not brackets

>> No.68104260

im sorry if im a brainlet but now im getting
:~$ bash
bash: /home/asdf/.bashrc: line 1: syntax error near unexpected token `('
bash: /home/asdf/.bashrc: line 1: `# ~/.bashrc: executed by bash(1) for non-login shells.'

>> No.68104273

wait why is it reading comments?

>> No.68104280

i can multiply in O(1) using lambdas

>> No.68104286

what's your favorite algorithm, /dpt/?

For me, it's Hashlife.

>> No.68104296

fucking hell lad just install rust with apt and be done

>> No.68104301

I call it parentheses in england too cause of programming. Not sure what all the 'brackets' are actually called here normally

>> No.68104322

Anyone here use VSCode with Go?
Trying to set it up on a USB but even when I override the go.gopath and go.goroot default settings, it complains that it "cannot find "go" binary".

What's wrong here?

>> No.68104324

in regular human world
parentheses -> ()
brackets -> []
curly_brackets -> {}

>> No.68104348

yes, but how about the british world? from 'grade school', I remember () being called brackets

>> No.68104365

Is go in the $PATH?

>> No.68104367

But you don't even pay attention to the parentheses
Your editor pretty much handles them for you

>> No.68104369

I'm not british but maybe "square brackets"?

>> No.68104374

That's how I've heard them named. t. britbong.

>> No.68104385

rust package is prolly 2yo

why is there a ( in your bashrc?
post it

>> No.68104388

let me explain
three = lambda expression
two = lambda expression
multiply = take two lambda expressions and merge them in a new lambda expression

how is this not O(1)

>> No.68104413

I guess so, I do hear about square brackets

>> No.68104437

I don't think so. Go's installed on the USB so I don't think it has any $PATH setup on the OS itself.
Also it's Windows.

>> No.68104445

too long so heres a link https://file.io/1ZtDy8
it should be identical to the original except for the last line because i replaced it with the copy form skel before editing it
im pretty sure its giving a syntax error from the parentheses in the comments

>> No.68104456

Anyone here into OpenGL? I need some resources or guides with comprehensive brainlet-tier explanations of projection/model/view. Using glm...

>> No.68104473

Unfortunately they are mutually exclusive.

>> No.68104487

I might be wrong but I believe that is regular ol' trig. try to find a pdf of a highschool trig book or something

>> No.68104489

yeah but how many beta reductions would it take to observe/discriminate the result?

>> No.68104510


>> No.68104521

french english romaji

>> No.68104530

my bad it self deletes https://file.io/OJMMrK

>> No.68104537

sounds a bit difficult learning 3 langs at once

>> No.68104541

() brackets
[] boxes
{} squiggles

>> No.68104549

>he used gdb for the first time

>> No.68104554

How does free know the size of the memory block it needs to free?
Why can free stay in bounds and we as a programmer have to keep the allocated size somewhere around?
I don't fucking get it.

>> No.68104569


>> No.68104571

brit here, can confirm this

>> No.68104574

implementation defined

>> No.68104579

malloc and friends squirrel the size away somewhere inside/next to the allocation.

>> No.68104581

Your malloc implementation will store extra data in the chunk, usually just before the value it returns to the user.
Some malloc implementations will expose this information to you - glibc has the malloc_usable_size function, for example.

>> No.68104587

I've had the time to download it
I don't see what's wrong with it
you said you copied the file from skel, try creating a new .bashrc with only the line I told you

>> No.68104594

but I don't know of an implementation that does other than:

>> No.68104609
File: 380 KB, 1920x1080, od_wallpaper.jpg [View same] [iqdb] [saucenao] [google] [report]

>to observe
you mean count the evaluations and put that integer in a register and print it to your console

i don't know
let's say your discrimination is a comparison
you have a*b < c

if you have division implemented, it can take log(n)
you just divide both a*b by 2 and c by 2 (accounting for oddness by keeping the remainder i guess)
until one becomes 1
there's probably even faster ways, by using modular math or something

honestly i don't know the answer to your question and am just pulling shit from my ass hole

if anyone can explain in plain english why multiplication isn't O(1) in lambda calculus, i'd be happy to read that

>> No.68104616

well... I kinda understand what model/view does and how it works. but the main problem I have is projection. so I guess there is still a chance I can ascend. so please post anything if you have something...

>regular ol' trig
yeah, sounds reasonable. will try remembering/learning trig. anything else?

>> No.68104617

malloc actually allocates more memory than is necessary for the type and free uses those extra bits at the beginning to track how much memory has been allocated.

>> No.68104642


>> No.68104660

uh, if the size needs to be stored somewhere, why is making it available to the user a requirement of the standard
this is valuable information ffs, and as a result a programmer has to duplicate this information

>> No.68104661

What the fuck is wrong with C++?
error: cannot convert ‘std::__cxx11::basic_string<char>’ to ‘const char*’

Why? This should be very, very easy.

>> No.68104672

What I'm trying to say, obliquely, is that the obvious way to build multiplication on Church numerals ends up being a lazy representation: you have a "thunk" that represents the result of the multiplication. This is a Church numeral, e.g. 2 is represented as the combinator that applies a function twice to an input. But: to actually determine that the value is "2" (that's what I mean by discriminate), we'd have to invoke that function. In LC our notion of "computation step" is beta-reduction; that "number" is going to end-up beta reducing a number of times proportional to its value when we invoke it on whatever term we want to use as our "discriminator".

TLDR: everything looks O(1)-ish under lazy evaluation, until you actually have to evaluate.

>> No.68104682

>What the fuck is wrong with C++?
Someone decided to make an abortion out of C

>> No.68104684

sorry about no gf

>> No.68104692

std::strings are not null terminated

>> No.68104705

I always thought it was a bit of an oversight. You can get a slim advantage by using something like malloc_usable_free.
Of course if you really care you'll use your own allocator.

call the c_str member function

no idea why it doesn't have a char* conversion operator tho

>> No.68104729

they have to be since C+11, though; data() has to return the same pointer as c_str()

>> No.68104734

Bloody hell, I've used it for ten minutes and I hate it already.
It's pointing towards some arbitrary data, not a text string.

>> No.68104738

aah i see
on an unrelated note, how would memory management work
let's say there is a lambda language, all it has is functions, thunks lazily representing "objects"

and you are allowed to bind names to the thunks

let's say
(define my_object <some lambda expression>)

but later i do
(define my_object <some other lambda expression>)

i'd have to enter the real world and free the first defintion right

i mean surely all those functions are on the heap taking some space

>> No.68104748

:~$ bash
bash: source: command not found
this is following your suggestion

>> No.68104773

fucking lol

specifically theorem 1

or more generally http://www.cs.tau.ac.il/~nachumd/papers/TIH.pdf

>> No.68104774

>they have to be since C+11, though; data() has to return the same pointer as c_str()
are you sure?

>It's pointing towards some arbitrary data, not a text string.
std::string are expected to hold strings
imagine the shitstorm if this implicit cast operator were called anywhere a c string is expected

>> No.68104775


>> No.68104780

>no idea why it doesn't have a char* conversion operator tho
Stronger type checking. You need to make that explicit by calling c_str.

>> No.68104785

uh maybe I'm the brainlet.. I'm used to zsh which uses "." and "source" the same way
try replacing source by a dot

>> No.68104792

Why can't they just use char* like ordinary people?

>> No.68104796

So make the conversion operator explicit. This problem has been solved since C++11.

>> No.68104805

>are you sure?
sorry I'm an actual brainlet

not caring about memory management is nice

>> No.68104808

:~$ bash
bash: .: command not found
hahaha im sorry man this is frustrating

>> No.68104812

this is eval order dependent, and counting beta reductions isn't good enough as described in >>68104773


>> No.68104821

yeaaaah, that's hard to answer because it's kind of mixing levels. LC is an abstraction; we can implement it on a physical machine with memory and so on. When we do that, yes, we have to somehow handle allocation. LC evaluation tends to create a lot of one-off allocations too (think curried function application etc.), which is one of the reasons you don't see functional languages with no GC.

but the direct answer is that in a functional language, you'd really have more like (syntax is ML-ish, but doesn't really matter):

let my_object = ... in let my_object = ... in ...

in other words, you're not overwriting, you're rebinding a name in an inner scope.

remember, "let" in LC is just sugar:

let x = e = in t => (\x . t) e

sorry, I don't think that was very good answer, but it's a pretty open-ended question

>> No.68104847

try taping the command by hand in your terminal...

>> No.68104874

ok, yeah, brain fart on "proportional" and evaluation order is important

the take away is that reduction isn't free, that's the whole notion of computation in LC

>> No.68104881

youre my fucking savior thank you so much ahhahahhaa

>> No.68104894

oh shit but it isnt persistent

>> No.68104909

>sorry, I don't think that was very good answer
i would have preferred scheme syntax for this one
>let my_object = ... in let my_object = ... in ...
i don't quite get what the dots are doing and the "in" word

if i'm understanding you correctly, it's not feasible to not have to generate garbage if you are keeping track of scopes AND actual pointers in memory to functions
this theorem isn't in plain english and i'm not a pro

>> No.68104919

Brainlet tier question. I am learning about overflows. What number do you get after this operation in C. I would appreciate an explanation as well. Thanks in advance.
char c = 250;
c += 8;

>> No.68104928


>> No.68104940

Hey guys, I'm trying to read the instructions of my program in gdb, but it never enters the instructions of the library functions I use(strcpy), yet gdb can disassemble the function. What am I missing?

0x00005555555546b0 <+0>: push rbp
0x00005555555546b1 <+1>: mov rbp,rsp
0x00005555555546b4 <+4>: sub rsp,0x20
0x00005555555546b8 <+8>: lea rax,[rbp-0x20]
0x00005555555546bc <+12>: movabs rdx,0x65776f702d702d70
0x00005555555546c6 <+22>: mov QWORD PTR [rax],rdx
0x00005555555546c9 <+25>: mov DWORD PTR [rax+0x8],0xa212172
0x00005555555546d0 <+32>: mov BYTE PTR [rax+0xc],0x0
0x00005555555546d4 <+36>: lea rax,[rbp-0x20]
0x00005555555546d8 <+40>: mov rdi,rax
0x00005555555546db <+43>: mov eax,0x0
0x00005555555546e0 <+48>: call 0x555555554560 <[email protected]>
0x00005555555546e5 <+53>: mov eax,0x0
0x00005555555546ea <+58>: leave
0x00005555555546eb <+59>: ret

>> No.68104941

yeah, the point of putting it in your .bashrc is to make it persistent
.bashrc is sourced when launching a shell
if the command works (as it should) in interactive mode but not while being sourced it's above my expertise in bash, sorry

>> No.68104945

fuck IPLs and fuck FP, give me one (1) reason why I shouldn't write haskell like write my C
main = do p <- malloc
poke p (0x04030201 :: Int32)
peekArray size (castPtr p :: Ptr Int8) >>= print
free p

>> No.68104948

255 is your max number and when adding 8 to 250 you get 258. 258-255 = 3 so thats how many youd step over

>> No.68104957

Possibly undefined behaviour, depending on the signedness of plain char.
Do it with an unsigned type.

>> No.68104973

>i'm such a fucking mong i can only program one way

>> No.68104983

actually you would get 2, provided it's an unsigned char as >>68104957 pointed out

>> No.68104989

It's implementation defined. That means that the result may be different depending on what you what machine you run it on. In fact, if your char is actually signed, it may be undefined behavior - in which case your compiler may generate total nonsense code, because it assumed that an overflow will simply never occur.

In practice, however? You can expect the result to probably be 2.
250 + 8 = 258. But the range of a char is clipped to 0-255, and like a 24 hour clock once you hit 256 it immediately wraps around to 0 again. So 258 gets wrapped around to 2.

>> No.68105011

new thread naooooooo pls

>> No.68105014

I see, I thought numbers would "wrap around" only when the types would be defined as "unsigned". I thought we would get "negative numbers" as results when dealing with "signed types". Thanks a lot for the replies though. 2 seems to be the correct answer.

>> No.68105025

Say you have 4 bits. 0000

1111(15) is the maximum value they can hold.

The next value, 16, requires another bit 10000

If we assigned those 5 bits to our 4 bits of space, the result would be the smallest 4 bits 0000

250 as 8 bits is 11111010

258 requires 9 bits and looks like 100000010

If we assign those 9 bits to an 8 bit space, the biggest bit is lost and the result is 00000010 which equals 2

>> No.68105032

ok so I have a C program
and in my program i have some functions

but i know that some of those functions I'll use exactly once

is there a way i can "remove" those functions after i've used them the once, basically remove them so they don't take space in memory when the program is loaded

>> No.68105047

New thread:

>> No.68105048

>I must invent different ways of writing a program so I can feel special

>> No.68105053

write them inline

>> No.68105060

the dots just mean "any arbitrary bullshit here";

like, we're talking lambda calculus, right? there's no define. there's just lambdas.

we can define a syntactic sugar "let":

(let (x e) t)

but "under the hood" all we mean is ((lambda x t) e)

so the question doesn't really make sense in terms of "overwriting values", the example would really have been

(let (my-object e1) (let (my-object e2) t))

i.e. ((lambda my-object ((lambda my-object t) e2)) e1)

all the asymptotic-time and allocation questions come down to "how would you implement this on a real machine"?

>> No.68105068

No (excluding dynamic linking schenanigans) and it's not something you need to worry about.

If they're static functions, it's likely that the compiler will inline them for him.

>> No.68105114

Woah, thanks a lot for the in depth answer, anon. Definitely writing it down.

>> No.68105115

>this theorem isn't in plain english and i'm not a pro
"for a sane model of measuring performance in lambda calculus for 'call-by-value'-evaluation, turing machines can simulate LCs with running time f in O(f(n)^4) and LC can simulate turing machines with running time f in O(n).", i.e. LC isn't worse than TMs except for a constant difference and TMs are worse than LCs by at most a factor of f(n)^3 and some constant.

the second paper states more generally that for a sane definition (restriction?) of "model of computation" and sane model of measuring performance, you can pick your poison and either suffer a hit of a linear factor n in terms of time complexity or a hit of a linear factor n in terms of space complexity and simulate that model of computation with RAM, i.e. the RAM isn't worse than the model of computation except for a linear factor n.

>> No.68105225

main = do p <- mallocBytes size
fillBuffer p size
free p

How does this code make you feel?

>> No.68105227

strcpy may be inlined and if the passed string is a constant, the computation may be done in the static environment.

>> No.68106973

should collision code go in void update or not?

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