/dpt/ - Daily Programming Thread

Old thread: What are you working on, Sup Forums?

Other urls found in this thread:

trunews.com/article/id-2020-digital-identity-pushed-as-a-basic-human-right
youtu.be/-IckEWl8d-8
voodoo-slide.blogspot.com/2010/01/amplifying-c.html
en.wikipedia.org/wiki/Integer_overflow
twitter.com/AnonBabble

The next Facebook

>useless
>can verify the morality of arbitrary expressions

Making a 2d game in rust. What graphics lib should I use? I'd prefer to have a depth buffer btw.

...

I'm working on campus this summer, but I literally work from home and don't do anything but fap and play video games. What else can I do to make money in the meantime?

>smalltalk is used by nonces
explains OOP

Digital IDs trunews.com/article/id-2020-digital-identity-pushed-as-a-basic-human-right

Botnet

>nonces
it's 3am go to bed

C influenced languages get an automatic F in my book.

2 ams make a pm and there's 1 left over so that's 2pm 1pm for me and 1pm for you

>couldn't you just do "procedure"
Apparently, you can!

I am a bit confused though... I think I'm repeating a procedure 2^n times instead of n times

How do I fix this?
(define (compose f g)
(lambda (x) (f (g x))))
(define (inc x) (+ x 1))

(define (repeated procedure n)
(if (= n 1)
procedure
(repeated (compose procedure procedure) (- n 1)))) ;Need help on this line. Don't want to double every iteration, just apply the procedure once more

((repeated inc 2) 5)

Pic related is what I'm trying to solve

...

Forgot to add,
((repeated inc 2) 5)


evaluates to 7, as it should, but

((repeated inc 4) 5)

Evaluates to 13, meaning inc is repeated 8 times instead of 4

>G*U trash

char array[] = {0, 0, 01, 90}
//decimal value of 400


Have an array of hexadecimal values

How do I convert to decimal?

13 rupees have been deposited to your Micros**t account, pajeet.

>replying to shit bait
>doing the needful

>""accounts""

Who are you quoting, pajeet

I want to learn but I got kicked out of college because I snapped on my roommate who stole from and constantly tormented and threatened me.

Is learning WebDev necessary? I have no interest in it at all, JavaScript sounds like a nightmare, but I hear many say eventually a job will expect it if you. Is that true?

It's because you pass the composed function in
What you want to do, is compose the function with the recursive call, so

compose procedure (repeated procedure (- n 1))
not

repeated (compose procedure procedure) (- n 1)

when will D take off?

youtu.be/-IckEWl8d-8

D wont have a "year", it will just be a gradual thing.

kek

When it implements GC less stdlib

I'm overwhelmed
what's the most efficient way to learn a programming language?

cut one of your arms off and you'll achieve the same thing

(define (square x) (× x x)

so this first assigns square to x then redefines square to x * x? the first x sems redundant in that case

Dang, LISP programming really throws me on a loop.
Hopefully later chapters help me make less stupid mistakes

Thanks, though!

Your goal is to write "idiomatic" code.

If you know nothing, read beginner stuffs written by people close to the lang.

If you know things, focus on the language spec (if digestible) and quick code examples, plus trying it yourself, with a focus on correctness and using the best builtin features.

...

No. From what I can tell (as someone who doesn't know lisp) the head of the list becomes the thing that is defined, and the rest are parameters.
i.e.
(define (square) e)
square = e

(define (square x) e)
square(x) = e

(define (square x y) e)
square(x,y) = e

the second argument e is the body or the definition

you'll get it eventually

We are making a web browser!! !!!!!BIG ANNOUNCEMENT: We already have a html parser working!!!!!

Is Arizona good for programming jobs?

What did you hope to achieve by posting this bait again?

t. chrome shill

dude its simple just
main(c){c='0';while(c++

so i guess its sort of like function prototyping

mods doing their job? bravo for once

what do you mean? it's not so different from C style, except for the explicit "define"


main(argn, argv) {
do stuff
}


(define (main argc argv) (do stuff))

What's best for Intellisense-like on Linux? Should I just install VS Code? I got clang_complete working in vim and it's alright (I guess).

Why hasn't someone come up with a way to write C with s-expressions yet?

Lisp already exists

voodoo-slide.blogspot.com/2010/01/amplifying-c.html

VS Code is GOAT

spambot in phantomjs and node that'll loop thru a list of proxies to dodge bans and spam cheese pizza on a captchaless site

Why do you need intellisense? What language are you using?

C++, I mostly want it to autocomplete member functions and parameters. I got clang_complete to do it, it's pretty clunky.

Maybe I need to learn how to use "snippets". clang_complete likes to insert parameters as "snippets" which apparently means it looks like below. Is there some secret vim hotkey to replace \$`.*` or is that intended for regex/some "snippet" plugin?

SDL_LogMessage($`int category`, $`SDL_LogPriority priority`, $`const char *fmt, ...`)

He stole from you and you got kicked out?

That's amazing.
How does it feel to be a completely ineffective as a male?

delete this

#include
free (this);

Daily reminder that header files are a luxury, not a necessity.

forgot iostream

What's luxurious about them?

>header files are a luxury
kek 10/10

Anyone know where
withLock :: Lock s -> ST s a -> IO a

is defined?

What's Lock from?

but it's in C not C++

I don't know.

As a Cfag, if I were to learn one meme language, which should it be? Go, Rust, Haskell, or something else?

>tfw it took me forever to get this

int hex_array_to_dec(const unsigned char *buffer, int beg, int end) {
int sum = 0;
int x, y;
int count = ((end - beg) * 2) - 1;

for(x = beg; x < end; x++) {
int num = (int)buffer[x];
for(y = 0;y < 2;y++) {
if(num < 0x10 && y == 0) {
sum += num * (int)(pow(16, count - 1));
count -= 2;
break;
}
else {
sum += (num / 0x10) * (int)(pow(16, count));
num = num % 0x10;
count--;
}
}

}

return sum;
}

>its $CURR_YEAR and his language is still moduleless
pretty embarrasing

Haskell is THE meme language to learn, especially out of those 3 given your C background.
C + Haskell encompasses (and eclipses) both Go and Rust

lmao, you only need to include iostream if you use std::cout and other shit

I seriously hope you don't have that at the top of all your files.

Go for application development. Rust for if you were looking at C++. Haskell or an ML/lisp in general if you just want something new and interesting w/o having to think about memory, etc.

>modules
>I need a package manager for my package manager

You are not even making sense, Cnile

Aside from the Rust ownership system that is.

all that arent void functions

>IO

I've already looked there and I couldn't find it

FORTRAN
O
R
T
R
A
N

aren't we all

int hex2dec(char* buf, int len) {
int sum = 0;
for(int i=0; i

>meme

>can verify the morality of arbitrary expressions
Undecidable.

False

>meme
see

False

You guys are just reading the hex array and returning the sum as a decimal, right?

In C, when you exceed the size of a data type, what happens?

Example

char c = 1;

while (c > 0)
c *= 2;
c--;


Do you exit the while loop once you exceed the size of a char?

>In C
Stopped reading right there.

Computers generally just eat the bits that don't fit.
Some langs will catch the overflow, but C doesn't catch shit.

maybe this qualifies for this thread: I've got an idea for a website and I need to know how difficult it would be to incorporate. Maybe I can learn how to do it myself, maybe not.

The website has categories, each category has a few fields that people can fill out to submit an entry, and then later people can rate the entries. I'd probably need a way for people to create accounts, since people don't work for free and the prospect of internet points is appealing to people, which would entice them to make submissions.

How difficult would it be to make sure the site is secured, to structure the site and create the database of submissions, ensure that people don't do sql injections and hack my mom's dialysis machine, etc? Any advice on this would be greatly appreciated. What would I expect to pay if I were to hire someone to do this for me, if it would be too difficult or time consuming to learn the programming to do it myself?

>I've got an idea for a website
>maybe this qualifies for this thread
No. Use

wtf github desktop is more confusing than the bash version

alright, thanks for the point in the right direction

en.wikipedia.org/wiki/Integer_overflow

{00, 10, FF}

would be

0 * (16 ^ 5) + 0 * (16 ^ 4) + 1 * (16 ^ 3) + 0 * (16 ^ 2) + F * (16 ^ 1) + F * (16 ^ 0)

is codeacademy good?

>code
We don't discuss "code" here.

No. Go to your local code camp.

hurr durr how do I into hex literals

first try to use the documentation provided by the language authors

undefined behavior, but most compilers will overflow, i.e. SCHAR_MAX + 1 => SCHAR_MIN, in your case you will get to c = 64, then 64 * 2 = 128, which is 128, max value of a signed char in C is defined as 127, so it will overflow to -128, and exit the loop.

>first try to use the documentation provided by the language authors
And if there isn't any?

then what the fuck kinda language are you using

OK, interesting. Reason I asked was because one of the exercises asked me to compute the max value of a char. I didn't even know where to start and I came across that piece of code. I understand what it was trying to do but I didn't understand the mechanism of why it would exit the loop.

why is the word "code" an issue here?