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

/dpt/ - Daily Programming Thread

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

Thread replies: 331
Thread images: 40

File: dpt_flat.png (102KB, 1000x1071px) Image search: [Google]
dpt_flat.png
102KB, 1000x1071px
Old thread: >>61012570

What are you working on, /g/?
>>
>>61018062
The next Facebook
>>
File: relativists btfo.png (5KB, 470x102px) Image search: [Google]
relativists btfo.png
5KB, 470x102px
>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.
>>
File: beard-programmers-final-two.png (113KB, 660x330px) Image search: [Google]
beard-programmers-final-two.png
113KB, 660x330px
>>
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?
>>
>>61018108
>smalltalk is used by nonces
explains OOP
>>
File: 1468537042276.png (215KB, 8042x1265px) Image search: [Google]
1468537042276.png
215KB, 8042x1265px
>>61018062
Digital IDs http://www.trunews.com/article/id-2020-digital-identity-pushed-as-a-basic-human-right
>>
>>61018126
Botnet
>>
>>61018123
>nonces
it's 3am go to bed
>>
File: 1496430859959.jpg (428KB, 1447x1222px) Image search: [Google]
1496430859959.jpg
428KB, 1447x1222px
>>61018062
C influenced languages get an automatic F in my book.
>>
>>61018150
2 ams make a pm and there's 1 left over so that's 2pm 1pm for me and 1pm for you
>>
>>61018072
>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
>>
File: 1456931603051.jpg (186KB, 690x460px) Image search: [Google]
1456931603051.jpg
186KB, 690x460px
>>61018126
>>
>>61018183
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
>>
>>61018198
>G*U trash
>>>/b/
>>
char array[] = {0, 0, 01, 90}
//decimal value of 400


Have an array of hexadecimal values

How do I convert to decimal?
>>
>>61018220
13 rupees have been deposited to your Micros**t account, pajeet.
>>
>>61018235
>replying to shit bait
>doing the needful
>>
>>61018235
>""accounts""
>>>/b/
>>
>>61018251
Who are you quoting, pajeet
>>
>>61018183
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?
>>
https://youtu.be/-IckEWl8d-8
>>
>>61018325
D wont have a "year", it will just be a gradual thing.
>>
>>61018325
kek
>>
>>61018325
When it implements GC less stdlib
>>
I'm overwhelmed
what's the most efficient way to learn a programming language?
>>
>>61018394
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
>>
File: Liskaface.png (138KB, 398x340px) Image search: [Google]
Liskaface.png
138KB, 398x340px
>>61018285
Dang, LISP programming really throws me on a loop.
Hopefully later chapters help me make less stupid mistakes

Thanks, though!
>>
>>61018394
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.
>>
File: Cprogram.png (107KB, 792x1023px) Image search: [Google]
Cprogram.png
107KB, 792x1023px
>>61018394
>>
>>61018420
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

>>61018426
you'll get it eventually
>>
File: netrunner s.png (91KB, 1356x300px) Image search: [Google]
netrunner s.png
91KB, 1356x300px
>>61018062
We are making a web browser!! >>61018259

!!!!!BIG ANNOUNCEMENT: We already have a html parser working!!!!!
>>
Is Arizona good for programming jobs?
>>
>>61018531
What did you hope to achieve by posting this bait again?
>>
>>61018543

t. chrome shill
>>
>>61018531
dude its simple just
main(c){c='0';while(c++<'9')puts(&c);}
>>
>>61018473
so i guess its sort of like function prototyping
>>
>>61018531
>>61018543
mods doing their job? bravo for once
>>
>>61018643
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).
>>
>>61018658
Why hasn't someone come up with a way to write C with s-expressions yet?
>>
>>61018689
Lisp already exists
>>
>>61018689
http://voodoo-slide.blogspot.com/2010/01/amplifying-c.html
>>
>>61018675
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
>>
>>61018675
Why do you need intellisense? What language are you using?
>>
>>61018743
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, ...`)
>>
delete this
>>
#include <stdlib.h>

free (this);
>>
Daily reminder that header files are a luxury, not a necessity.
>>
>>61018858
forgot iostream
>>
>>61018901
What's luxurious about them?
>>
>>61018901
>header files are a luxury
kek 10/10
>>
Anyone know where
withLock :: Lock s -> ST s a -> IO a

is defined?
>>
>>61018950
What's Lock from?
>>
>>61018909
but it's in C not C++
>>
>>61018989
I don't know.
>>
File: 1496583899103.png (4MB, 1920x1080px) Image search: [Google]
1496583899103.png
4MB, 1920x1080px
As a Cfag, if I were to learn one meme language, which should it be? Go, Rust, Haskell, or something else?
>>
>>61018229
>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
>>
>>61019025
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
>>
>>61018909
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.

>>61019025
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.
>>
>>61019039
>modules
>I need a package manager for my package manager
>>
>>61019060
You are not even making sense, Cnile
>>
>>61019025
>>61019051
Aside from the Rust ownership system that is.
>>
>>61019053
all that arent void functions
>>
File: 1496799486536.jpg (71KB, 1024x1024px) Image search: [Google]
1496799486536.jpg
71KB, 1024x1024px
>>61018950
>IO
>>
>>61019243
I've already looked there and I couldn't find it
>>
File: old_hag_langs.png (173KB, 600x355px) Image search: [Google]
old_hag_langs.png
173KB, 600x355px
>>61019025
FORTRAN
O
R
T
R
A
N
>>
>>61018081
aren't we all
>>
>>61018229
>>61019035
int hex2dec(char* buf, int len) {
int sum = 0;
for(int i=0; i<len; ++i) {
sum += buf[i]%10 << (len-i-1)*8;
sum += buf[i]/10 << ((len-i-1)*8+4);
}
return sum;
}
>>
>>61019025
>meme
>>>/v/
>>
>>61018096
>can verify the morality of arbitrary expressions
Undecidable.
>>
>>61019329
False
>>
>>61019053
>meme
see >>61019319
>>
>>61019332
False
>>
>>61019304
>>61019035
>>61018229
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?
>>
>>61019386
>In C
Stopped reading right there.
>>
>>61019386
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?
>>
>>61019417
>I've got an idea for a website
>maybe this qualifies for this thread
No. Use >>>/g/wdg/
>>
wtf github desktop is more confusing than the bash version
>>
>>61019431
alright, thanks for the point in the right direction
>>
>>61019386
https://en.wikipedia.org/wiki/Integer_overflow
>>
>>61019376
 {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?
>>
>>61019486
>code
We don't discuss "code" here.
>>
>>61019486
No. Go to your local code camp.
>>
>>61019479
hurr durr how do I into hex literals

>>61019486
first try to use the documentation provided by the language authors
>>
>>61019386
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.
>>
>>61019502
>first try to use the documentation provided by the language authors
And if there isn't any?
>>
>>61019519
then what the fuck kinda language are you using
>>
>>61019503
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.
>>
>>61019494
>>61019496
why is the word "code" an issue here?
>>
>>61019562
We simply don't use "codes" here.
>>
>>61019562
He's shitposting
>>
>>61018782
>Is there some secret vim hotkey to replace \$`.*` or is that intended for regex/some "snippet" plugin?
I figured this out by reading the fucking manual. They call it a "jumplist".
>>
>>61018102
>>61018110
>game
Please use >>>/v/
>>
>>61019559
Generally speaking a char is an 8 bit value,
so it can hold a maximum of 2^8 values,
so for unsigned char this would be 0 - 255, or (2^8) - 1,
for signed max value is 256/2 - 1, or (2^(8-1)) - 1, and min value is -(256/2), or -(2^(8-1))
of course this assumes two's compliment, which isn't guaranteed by the C standard,
but as far as I know, all relevant compilers use it today.
https://en.wikipedia.org/wiki/Two%27s_complement
>>
how do i make a variable with the value of 10?
>>
>>61019681
I have no desire to make video games at all.
I want to program, preferably in C.
>>
>>61019773
http://codeshare.io/4chan
>>
so what are you up to tonight, lads?
>>
>>61019967
it's 5am
>>
>>61018062
Why the fuck is java so hideous?

"Afterwards, implement the method public List<Box> packThings(List<Thing> things), which packs things into boxes."
>>
File: 1493094989389.png (1MB, 875x1080px) Image search: [Google]
1493094989389.png
1MB, 875x1080px
>>61019967
Creating an anime-complete programming language.
>>
>>61020022
Care to share samples if youre actually lang-dev'ing?
>>
>>61020028
It has basically nothing yet. I just added tuples and ifs.
>>
>>61020047
what kind of language is it gonna be?
Just a C flavor?
>>
>>61020022
What constitutes anime-completeness exactly?
>>
>>61020074
>what kind of language is it gonna be?
It's going to be an anime-approved and anime-complete theorem prover.
>>
>>61020126
That hasn't been defined yet, but people are working on it.
>>
File: 1392814424582.jpg (129KB, 500x500px) Image search: [Google]
1392814424582.jpg
129KB, 500x500px
レドピル me on Intel vs AT&T syntax
>>
>>61020211
>Intel
Acceptable.
>AT&T
Complete garbage which shouldn't really be used.
>>
File: yukari_spurdo.png (796KB, 637x900px) Image search: [Google]
yukari_spurdo.png
796KB, 637x900px
>>61020140
I await your results.
>>
File: 2017-06-22-004359_594x49_scrot.png (9KB, 594x49px) Image search: [Google]
2017-06-22-004359_594x49_scrot.png
9KB, 594x49px
>>61020226
I agree in general, but one nice thing about at&t syntax is that it has very descriptive op mnemonics for the kind of memory operation, like movb movw movl movq.
Of course, intel syntax provides the same info, but this is the only think that at&t does better imo.

>at&t offset syntax
I don't understand WHY this was even a serious design consideration. pic related.
>>
I'm looking to secure user passwords in a database, and looking online I'm told to salt + hash the passwords. following:
https://crackstation.net/hashing-security.htm
for the reasoning and
https://stackoverflow.com/questions/4181198/how-to-hash-a-password
using the second answer for the procedure (i've no background in security) I've come up with my stored password.
However, I feel like the salted + hashed password is intended to be encrypted further with something like RSA or SHA512 or something. Am I correct in this, or is the salt+hash enough?
>>
>>61020424
>not rolling your own crypto
>>
So I'm super new to software dev and shit; I want to make a simple app that lets me increment a number from my phone, or from my desktop, and it's consistent between them. My question is: does that strictly require an external database of some kind, or is there another way to do it?
>>
>>61020486
>rolling your own anything
this is the noob way to go
let's face it, by this point every conceivable use case is so saturated with high quality existing software that a "programmer" is really just someone who can't cope with change
the industry doesn't need "programmers" anymore, it needs "power users" who can actually put what's already out there to full use
>>
>>61020521
>dont reinvent the wheel to learn and possibly improve existing solutions,
>just blindly use this and be quiet
>>
>>61020532
there's nothing wrong with using cryptography and security practices that are vetted by the community though.
>>
>>61020542
Its just too many people here assume this is an enterprise thread and were all on important company time. Instead of just mostly neets and hobbyists.

Crypto is pretty fun to get into as well.
>>
>>61020561
Well, truth be told I'm doing the crypto for work but I'm quite interested in it so I'm researching on my own. We're a small team so i wouldn't consider it enterprise either, I can count the number of actual developers for this project on 3 fingers. I'm just hoping someone more familiar with security can clear things up for me.
>>
>>61018170
F*?
>>
What's a good website or book about different ways to program every day programming issues in a language agnostic way?

For example, building a login system, creating a CRUD database system, etc etc.

More around the theory about these scenarios and less about writing the code for you.
>>
>>61019304
Wrong output
hex2dec("FFFFFFFFFFF1FFFFFFFFFFFFF2FFFFFF", 32);
>>
File: 1475862617727.png (467KB, 1000x1000px) Image search: [Google]
1475862617727.png
467KB, 1000x1000px
how2theorem-provers?
>>
>be from india
>work on legitimate program
>if you tink i am lying please consider that i am anonymous and do not even tell you what the program is called and so there is no reason for you to think that i would be lying to you
>westerner assume it is malware because i am from india and cannot the english goodly
>westerner call me "pajeet"
>i train all my life to program
>yes it is for money to feed family but also i love programming really
>this man laugh at me and my program because i am from india
>he do not even try program
>i am cry
>look out over ocean
>easy to drown
>long and hard life
>very tired
>i am wonder if lord vishnu want me to die now
>>
File: smug_ran9.jpg (781KB, 1040x1452px) Image search: [Google]
smug_ran9.jpg
781KB, 1040x1452px
>>61020704
I did NOT give you permission to save pictures of my wife!
>>
>>61020630

The ongoing issue is that people have a well established track record of implementing fucked up crypto. Look at the discussion here:

https://news.ycombinator.com/item?id=14585958

Someone went about advertising their "password manager" and, in a product you'd expect to be all about good crypto, there multiple noob level fuckups.

To answer everything from
>>61020424

Anything that teaches you to "salt and hash" is going to send you straight to noob crypto hell. There's a good guide here:

https://paragonie.com/blog/2016/02/how-safely-store-password-in-2016

But the modern tl;dr is: use Argon2, or bcrypt. Your programming language almost certainly has libraries ready to go.
>>
File: 1492454965999.jpg (134KB, 800x800px) Image search: [Google]
1492454965999.jpg
134KB, 800x800px
>>61020704
What do you mean, anon?
>>
>>61020716
>>i am wonder if lord vishnu want me to die now
Do it.
Please. Sir.
Do the needful.
>>
>>61020728
Thanks for the links. i definitely don't want to just slap a salt+hash on a password and call it good security.
>>
File: 1479483844926.jpg (243KB, 1200x1720px) Image search: [Google]
1479483844926.jpg
243KB, 1200x1720px
>>61020726
Netorare

>>61020735
How to get into things like agda and coq.
>>
61020758
always google long posts before responding.
its pasta
>>
fucking nano making me press ctrl+o and rapidly return in every other program when I want to save
>>
>>61018108
> prologue
>>
>>61020784
>"always google long posts before responding"
>he did not follow his own advice
>>
>>61020728
>use Argon2
"No"
https://github.com/P-H-C/phc-winner-argon2/issues/182
>>
>>61020424
>passwords
Please don't use passwords, use public key authentication instead. Also consider using client-side tls certs for login.
>>
can your language do this?

(defun shuffle (list)
(sort list #'>
:key (lambda (x) (declare (ignore x)) (random 1.0))))

(defmacro execute-randomly (&body body)
`(progn ,@(shuffle body)))
>>
>>61020828

Well yes, there's an attack that theoretically makes it not much stronger than bcrypt.

Fuck me, it's completely broken.
>>
>>61020860

This is a common meme which is impractical in the real world. No actual business customer anywhere is going to accept a website from a development team that requires an average end user to setup public keys.
>>
>>61019025
Definitely Rust.
>>
>>61020870
what does that even do?
>>
>>61020716
I don't know if you can even read this in whatever shitty fellow-Pajeet-made translator software you're using, but it's a huge overreaction to kill yourself just because someone made fun of you. So maybe it hurts a little more because it was about your race, and because you're poor and hungry and he wasn't. So what. Get over it. Don't even joke about that shit, you said yourself that you still have a family to take care of, you selfish prick. Shake it off and keep doing what you love. I can't guarantee you'll be appreciated one day, but you have to keep up hope. That's what your fake Pajeet-god would want, I'm sure.
>>
>>61020887
CL-USER> (execute-randomly
(print 1)
(print 2)
(print 3)
(print 4)
(print 5))

5
3
4
2
1
>>
>>61020897
reverses an array of a random range?
okay.
>>
>>61020860
Normally I'd be more inclined to be fine with switching, but this project is already multiple years in the making. Also, >>61020881
most of our users refuse to even change their password from the standard we give them.
>>
>>61020897
Is every permutation just as likely as every other permutation?
>>
File: 1395453107597.png (263KB, 500x369px) Image search: [Google]
1395453107597.png
263KB, 500x369px
>>61020894
>>
>>61019025
Haskell and Scheme.
>>
>>61020903
it's not reversed, just a bad shuffle algorithm, but that's immaterial

>>61020909
nah it's probably technically poor usage of the random function, imagine i was using a proper shuffle algorithm rather than being lazy

CL-USER> (execute-randomly
(print 1)
(print 2)
(print 3)
(print 4)
(print 5))

2
1
4
3
5
>>
>>61018102
piston solves all your needs
>>
File: 1497198054036.jpg (55KB, 736x552px) Image search: [Google]
1497198054036.jpg
55KB, 736x552px
Reminder than memcpy() is the best function ever.
>>
File: 1497592786380.png (118KB, 404x404px) Image search: [Google]
1497592786380.png
118KB, 404x404px
>>61020777
Do you want to learn the theory behind them or do you just want to program with them? You could pick up Agda pretty easily if you know Haskell, there's a lot of tutorials for it.
>>
quick question for /dpt/

im like 3 or 4 courses into CS - done with data structures, some algorithims, a standalone C++ class - i have a decent grasp on almost all of the basic concepts of C++.

my question is, where do i go from here? im still overwhelmed looking at open source projects, but i dont know what textbook or whatever to follow to get to that level?
>>
>>61020923
Is this an impressive thing in Lisp?
auto arr = [1,2,3,4,5];
auto arrSH = arr[0..$];
writeln(arr);
randomShuffle(arrSH);
writeln(arrSH);


[1, 2, 3, 4, 5]
[3, 1, 4, 5, 2]
>>
File: histogram-support.png (114KB, 1396x554px) Image search: [Google]
histogram-support.png
114KB, 1396x554px
work.. work..
>>
Looking for a suggestion of a new language to learn.
>>
File: 1483019770009.png (569KB, 1000x1000px) Image search: [Google]
1483019770009.png
569KB, 1000x1000px
>>61020968
Both actually, I am just overwhelmed with the amount of information concerning this topic.
>>
It isn't printing a shuffled array or list, it's executing a sequence of arbitrary statements in a random order.

for example, it's undecidable before compiling how many jumps this function will take to complete execution, or if it will finish at all.

(defun how-many-jumps-will-this-take ()
(let ((num-jumps 0))
(macrolet ((jump (target)
`(progn (incf num-jumps)
(go ,target))))
(tagbody
a
(print "A")
(execute-randomly
(jump a)
(jump b)
(jump c))
b
(print "b")
(execute-randomly
(jump a)
(jump b)
(jump exit))
c
(print "c")
(execute-randomly
(jump a)
(jump b)
(jump c))
exit))
(format t "Executed ~a jumps.~%" num-jumps)))
>>
>>61021043
but why
>>
>>61021055
it's just an example. another example could be a macro that does a cps transform so you can create your own first-class control structures, or something that compiles an entirely different language into lisp code at compile-time.
>>
>>61021079
>or something that compiles an entirely different language into lisp code at compile-time.
again, but why?
>>
>>61021079
I have Let Over Lambda but I never really understood the point of all the macros. I can do this kind of stuff more clearly using Java, C++, or hell, even C.

The older I get the more appreciation I have for the simplicity of C. (C macros are a spawn from hell though)
>>
>>61021079
>or something that compiles an entirely different language into lisp code at compile-time
Entirely different to what degree?
>>
>>61018170
anime posters get an automatic 'retarded' in my book
>>
>>61021098
abstraction

you wouldn't use machine code to write a web server (probably), so equivalently, a lisp programmer might try to think of a better language for a given task

for example, you could write a pattern matching macro that compiles to efficient code, and lets you write obvious pattern matching code (ala haskell/ML), rather than manually inspecting each element in a list.


>>61021102
you can add new language structures to C?


>>61021111
lisp is turing complete, so theoretically anything, i've seen things like python or c being translated in macros. it's more often used for domain specific languages or syntactical extensions though.
>>
>>61020981
>auto arrSH = arr[0..$];
arr.dup
>>
>>61021136
Lisp just has no practical use desu.
In all my years of /g/ I still think its purely for just code wank.

Why add a layer of abstraction when i can just do it in X language instead.

Seems like Lisp really is just a proxy language for people who, again, just want to wank to terse code.
>>61021145
i re-wrote it because i knew somenoe would scream UFCS.
void main()
{
import std.random : randomShuffle;
import std.stdio : writeln;

auto arr = [1,2,3,4,5];
auto arrSH = arr;
arr.writeln;
arrSH.randomShuffle;
arrSH.writeln;
}
>>
>>61021136
>you can add new language structures to C?

Turns out my need for that is mostly obviated when I already have loops and structs. C++ / Java classes and templates / generics also close that gap even more.

Almost always when I find myself wanting to do something too complex, the language pushes back. And helpfully so! I don't have the time and energy to explain what a monad transformer is to my coworkers and interns.

Simple and mediocre is actually okay in my book; and super productive!
>>
>>61021169
> Why add a layer of abstraction when i can just do it in X language instead.


If you really thought this you would use machine code for everything, or perhaps C because it's portable.
>>
>>61021169
>Lisp
>terse code
Are you by any chance retarded?
>>
>>61021188
high-level is probably the better phrase.
>>
>>61021199
>""high-level"" buzzword
Are you by any chance retarded?
>>
>>61021175
No, because machine code is time-consuming. And adding a layer of abstraction is also unnecessary.
I dont know though, maybe i need to give lisp another try.
>>
>>61021215
Using C is adding an unnecessary layer of abstraction on top of machine code.
>>
>>61021203
How is Lisp not a high-level language?
>>
File: not wanking.png (425KB, 1354x1692px) Image search: [Google]
not wanking.png
425KB, 1354x1692px
See, I used to focus on languages too and felt superior when using the latest functional programming paradigms.

But in reality that was just intellectual wankery. I've been programming Java for "big data" for the past years and I'm engaged in way more difficult work than a fucking Y-Combinator

F(Y(F)) = Y(F)... wow so mind blowing ....

Instead look at how fancy Java's ConcurrentHashMap is. Or the HyperLogLog cardinality estimation stuff.
>>
>>61021169
>auto arr = [1,2,3,4,5];
> auto arrSH = arr;
That doesn't do a deep copy

In rust, arr.writeln would not compile
>>
>>61021229
""high-level"" is not well-defined. It doesn't make sense to ask if a language is ""high-level".
>>
>>61021232
Well good thing im not using Rust then.
>>
I want to create some programs that have standard gui and drawing as well. What (c++) library should I use?
>>
File: test yourself.png (172KB, 1536x864px) Image search: [Google]
test yourself.png
172KB, 1536x864px
>>61021249
Your programming style is bad and you are yet to learn a lot of things.

Go ahead, challenge yourself
>>
>>61021231
y combinator in a language that isn't normal order is a lot more interesting to think about

every couple years i remember about it and i realize i've forgotten how it works and have to work through it
>>
>>61021268
Why would i transition to a vastly inferior language?
And i just needed a range, wasnt doing anything important.
>>
>>61020971
anything ?
>>
>>61021043
You could do that in Haskell just by shuffling a list of m () and then executing them all with sequence.
>>
File: 1445968800147.png (405KB, 767x578px) Image search: [Google]
1445968800147.png
405KB, 767x578px
>>61021036
>Both actually
See http://www.cs.cmu.edu/~rwh/courses/hott/
More than half of it is directly related to the theories behind them and it's pretty self-contained.
>I am just overwhelmed with the amount of information concerning this topic
Just start with something. I recommend Agda first, I've noticed that with Coq you can prove something without really understanding it a lot more often.
>>
>>61021136
>it's more often used for domain specific languages or syntactical extensions though
Can you show me some examples?
>>
File: 1474002932700.png (185KB, 680x641px) Image search: [Google]
1474002932700.png
185KB, 680x641px
>>61021315
Thanks anon :3
>>
>>61019559
Prelude> import Foreign.C
Prelude Foreign.C> maxBound :: CChar
127
Prelude Foreign.C> maxBound :: CUChar
255
>>
>>61019559
>>
>>61021504
why do you keep deleting your post?
>>
File: char.png (4KB, 371x71px) Image search: [Google]
char.png
4KB, 371x71px
>>61019559
>>
>>61021355
>>61021443
>>61021504
What the fuck are you doing anon?

>>61019559
CHAR_MAX from <limits.h>
Or ((unsigned char)-1) (for unsigned char)
>>
>c unironically requires a header just for type property constants
>>
>>61019720
>Generally speaking a char is an 8 bit value,
Make sure to read CHAR_BITS instead of assuming 8 bit values.

>>61021612
This is wrong, you make many assumptions.
>>
>>61021619
That's not true. You can always define the constants yourself.
>>
>>61021619
Nothing wrong with that.
>>
>>61021602
Because I am dumb and the code will not work (little mistake)
>>61021614
Anon said he need to calculate the max value
>>61021626
>many assumptions
>>
>C++ getting BTFO in the other thread
>>
>>61021636
>>61021643
meanwhile
writeln(byte.min," ",byte.max," | ", ubyte.min, " ", ubyte.max);


-128 127 | 0 255
>>
>>61021645
>Anon said he need to calculate the max value
Yes, and this is what I did.

>>many assumptions
Yes.
>>
>>61021645
sizeof(char) is always 1. Why do you even bother writing it.
>>
>>61021657
>writeln
>byte
>ubyte
>magic conversion from int to a string
cancer/10
>>
>>61021668
>>magic conversion from int to a string
?
>>
>>61021659
So you can change it with int/float and it will always work
>>
>>61021668
There is no magic conversion.
And byte/ubyte are explicitly for C.
>>
>>61021681
>it will always work
It will not due to the assumptions that you make
>>
>>61021693
>And byte/ubyte are explicitly for C.
??
>>
>>61021696
>assumptions
>One byte is always 8 bits
>The maximum value of unsigned is always (two to the power of bits) minus one
>The maximum value of signed is always (two to the power of bits minus one) minus one
>>
>>61021711
Assume the shit out of me, daddy
>>
>>61021711
>>assumptions
Yes, everything you listed is a lame assumption. Probably except the second one.
>>
>>61021711
and that the result wont overflow
>>
C++ is so bad that makes Java look good. I don’t like Java. I think it’s too verbose and lacks several features I expect from a high level language, most of its advanced techniques (design patterns, reflection, xml frameworks) being just patches for those absences. But all in all, Java is a language that makes sense. C++ is not.

It’s backwards compatible with C. Seriously Stroustrup? What on earth were you thinking?
>>
>>61021705
D's interface to C
https://dlang.org/spec/interfaceToC.html
>>
>>61021732
you can always change the type of maxUnsigned and maxSigned :^)
>>
>>61021735
Backwards compatibility didnt """"""""""""""kill"""""""""""""""""" c++.
The iso's refusal to break any code was, and really an iso in the first place.
Once a language gets enough big business behind it, its doomed to get fucked.
>>
>>61021756
But you cannot change the type of pow.
>>
>>61020498

Don't store the total number on each device, store how many times it has been pressed on that device and all the others. When you want to figure out the total add em together and then query the others for any updates.
>>
>>61021735
>C++ is so bad that makes Java look good
No, it does not.
C++ is extremely bad, but it does not even compare to Java.
>>
Are there any good programming streams? If so what do you recommend?
>>
>>61021735
>>
>>61021810
>But you cannot change the type of pow.
the duck are you smoking nigga
pow can return values as high as
1.18973e+4932
(on 64 bit machine)
>>
61022073
dumb phoneposter
>>
File: Capture.png (66KB, 1405x875px) Image search: [Google]
Capture.png
66KB, 1405x875px
>>61022089
KYS
>>
Why haven't the world switched over to 64bit epochtime for time keeping? It's just so much better.
>>
>>61022100
>not (you)
proof or phoneposting
>>
>>61022105
Everyone has.
>>
>>61022173
I dont even think vanilla chan has (You)s
>>
File: Capture.png (41KB, 670x635px) Image search: [Google]
Capture.png
41KB, 670x635px
>>61022173
>>
>>61022192
61022073 does not have a (you) still, this is a proof that you posted that from your phone while you posted >>61022100 from your pc.
>>
61022207
(You)
>>
File: Capture.png (7KB, 914x90px) Image search: [Google]
Capture.png
7KB, 914x90px
>>61022207
confused_cia_nigger.png
>>
>>61022073
>>
>>61022230
Lmao, still no (you) for 61022073. BTFO
>>
>>61021169
>Lisp just has no practical use desu.
As a general purpose language, say I want to manipulate data structures, it sucks.
But it shines as a macro language for code generation and turning parts of your program into declarative code rather than imperative.
Too bad, the syntax of definitions (whether they be macros, functions or variables) in Lisp dialects still feels too other-worldly compared with the rest of the language, and this seems clunky to me.

Anyway, one famous practical use of Lisp: http://all-things-andy-gavin.com/2011/03/12/making-crash-bandicoot-gool-part-9
>>
>>61021329
i honestly havent done a lot of lisp stuff lately but here's one off the top of my head
https://github.com/m2ym/optima

>>61021301
a list of functions basically?
technically that's not exactly the same but yeah
there's stuff you can do with macros that obviously cant be done in straight haskell, but there's template haskell which i haven't really looked into
>>
>>61022289
ITS ALWAYS FUCKING NAUGHTY DOG
>>
Does anyone have a programming challenge list thing floating around?
>>
>>61022403
Fuck off
>>
Is C++ made for substandard programmers?
>>
>>61022585
no but it's made for dishonest programmers
>>61022403
what level of challenge are you looking for anon, i'll come up with one
>>
>>61022585
Considering it's harder to master than braindead stuff like C or Go, no.
>>
>>61022403
0-1: Solve P vs NP
2-3: Strong AI
4-5: Machine translator with 99.999% accuracy
6-7: GNU Hurd
8-9: Unbreakable cryptosystem other than OTP

Dubs: You cannot use a computer or any electronic device to complete this task
Trips: You cannot look to or use any prior research (everything must be original work)
Quads: You must complete the entirety of the task blindfolded
Quints: If you require a program to solve your task, you must write it in Malbolge
>>
>>61022585
C++ is for Java pajeets that think they are too smart for Java
>>
>>61022632
> GNU Hurd
That's unsolvable tho.
>>
Do you think anyone ever read Bjarne's book from front to back?
>>
>>61022632
Dubs and quits contradict m8
>>
>>61022623
>doesn't know c
how do I count to 10 in html?
>>
>>61022702
I did, there's nothing special about his books, they're a good introduction to C++, that's all.
>>
>>61022632
>Solve P vs NP
Already done.
>>
>>61022719
<div>
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
<p>6</p>
<p>7</p>
<p>8</p>
<p>9</p>
<p>10</p>
</div>
>>
>>61022738
Not that they are hard, but 1300 pages is a bit long desu
>>
>>61022768
Only if you're a millennial with no attention span.
>>
>>61022702
No, I'm not a video gamer and I don't use windows.
>>
Monad transformers are bothersome to use and you need them for any remotely useful program.
>>
>>61023215
What is an ``useful program"?
>>
>>61023358
Something as simple as shuffling an array in O(n).
>>
>>61023405
Is that the only ``useful program"?
>>
>>61023448
it's the only useful program he can develop, and that's what matters.
>>
>>61023358
>>61023448
Go fuck yourself, Socrates.
>>
>>61023215
>Functional programming is bothersome to use and you need them for any remotely useful program.
Much broader, and much truer
>>
>>61023550
>Functional programming
What is an ``Functional programming"?
>remotely useful program
What is an ``remotely useful program"?
>>
>>61023550
>you need them for any remotely useful program
What did he mean by this?
>>
>Rust is unemployable
Checkmate, haters: https://rustjobs.rs/
>>
>>61023638
Too bad this doesn't somehow make the language less shit.
>>
>>61023586
>an before f and r
I am to unable to write propper english
>>
>>61023674
It doesn't make sense anyway.
>an hour
>a unit
>>
>>61023674
Yes? What's wrong?
>>
>>61020981
This is just atoms, you can't do actions lmao.
>>
>>61023695
>It doesn't make sense
It does. Try actually listening to the words. There's an pattern there.
>>
>>61023695
>Thinking it has to do with letters
>Not sounds
>>
>>61021169
>can shuffle atoms
>but can't shuffle actions because his language requires them to be evaluated first
lmao
>>
>>61023713
>>61023719
>orthography doesn't reflect phonology anymore
>still base written grammar on phonology and not orthography
English is the COBOL of natural languages.
>>
>>61023750
>his language requires them to be evaluated first
Any non-retarded one does.
>>
>>61023767
So every language is retarded?
>>
>>61022741
Did you manage to fly out of the bottle?
>>
>>61023767
lmao his language can't shuffle actions
case in point, your language can't do shit
>>
>>61023751
Go home, gook.
>>
>>61023638
Rust is too much boilerplate. I'll wait for a Rust derivative that cleans up the syntax
>>
>>61023785
That's not known as of right now.
>>61023787
>lmao his language can't shuffle actions
It can though. Any non-retarded language will let you explicitly request lazy evaluation.
>>
>>61023215
>you need them for any remotely useful program
False
>>
>>61019025
Is it weird that this turns me on?
>>
>>61023801
Go ahead and do that in your lang though.
You can only shuffle atoms.
>>
>>61023817
What is an ``useful program"?
>>
>>61023837
>You can only shuffle atoms.
How can you possibly claim this without knowing "my lang"? Does Shitkell cause severe brain damage?
>>
>>61023852
I don't use h****ell.
Lmao though, pls shuffle actions.
>>
>>61023837
wtf are atoms?
>>
>>61023876
The smallest unit of a compound
>>
>>61023871
>h****ell
You do though. Only a Shitkeller would be retarded enough to make such posts.
>pls shuffle actions
I'm not the retard you were replying to earlier. I'm pretty sure his """language""" can't do that.
>>
>>61023892
But there is no smallest unit
>>
>>61023892
>smallest
What is ``smallest"?
>>
>>61023907
But there is
>>
File: sht.jpg (943KB, 1836x3116px) Image search: [Google]
sht.jpg
943KB, 1836x3116px
I finished my personal manga reader using nuxtjs/vue/bulma.css

Now i just need to fill it with more shit to read and add some UI features that make browsing it on desktop and mobile better.
>>
>>61023919
Prove it.
>>
>>61023919
In that case, what is the difference between an atom and an action?
>>
>>61023924
Atoms were first considered as the smallest element of matter. What happens if you took something and cut it in half, then cut that in half and kept going? The original concept of an atom follows from a presumed result of this thought experiment. Eventually you wound up with something that couldn't be cut. In fact, the word atom comes from the Greek word for uncuttable.

Of course turning this thought experiment into a real one is not practical, so the existence of atoms was debated for centuries. The systematic study of chemistry allowed John Dalton formulate the modern theory of atoms. It is based on the observation that different materials react with each other in fixed mass ratios. For example, if you chemically combine hydrogen and oxygen to form water you will always find that the mass of the oxygen used is 8 times the mass of the hydrogen. It was found that all chemical reactions behave this way. That is how all of the known chemical substances, made of molecules, could be constructed from a much smaller number of atoms. If matter consisted of tiny particles that would only combine in certain ways then this is the way things must be.
>>
>>61023924
>>61023941
But that doesn't preclude other possibilities. The same experimental results would also be found if there was just some peculiarity in the way chemistry worked that forced this behavior. So what other evidence is there?

The study of gasses showed that there was a relationship between the temperature, mass, volume and pressure of all gasses. The Kinetic Theory of gasses states that gasses are made of identical particles that are moving at high speed and they bounce off of each other and the walls of their container. The recoil of these bounces is the source of pressure and speed is determined by the mass and the temperature. From these assumptions the behavior of gasses can be predicted. So here we have another, very different phenomenon, that is explained by the assumptions that matter is made of tiny bits.

This evidence was enough for most people, but not everyone. They thought that atoms and molecules were just a convenient fiction that helped get the right answer, but had no physical reality. This isn't as silly as it might sound. Such convenient fictions do exist. An example of this are magnetic lines of force. Magnetic forces act along these lines and they are a convenient way to compute many effects in electromagnetism. But they don't actually exist.
>>
>>61023924
>>61023941
The clincher came from a well known person, but most people are surprised to learn that it was Albert Einstein. In one the four incredible papers he published in 1905 he showed that Brownian motion could be explained by assuming that matter was composed of tiny particles. His paper not only predicted what the motion should look like but allowed for the computation of the mass of a single molecule. At this point no scientist seriously doubted the existence of atoms. There were just too many different kinds of phenomena that were explained by Atomic Theory both qualitatively and quantitatively.

But now we have even more evidence. Here's a few examples:

The quantum mechanical description of atoms predicts, to an astonishingly accuracy, the details of atomic spectra.

Individual ions (electrically charged atoms) can be manipulated with electric and magnetic fields.

There are even elevation maps of surfaces that show the bumps caused by individual atoms.
>>
>>61023939
atom is a matter, action is a form of work
>>
>>61023960
How are those two things different?
>>
>>61023981
Work is not a "thing"
>>
>>61023985
So it doesn't exist?
>>
>>61024007
Define existing
>>
>>61024014
Define define
>>
>>61024016
Define "Define define"
>>
beginner here

is it normal to spend many hours coding but only produce few lines of code?
>>
>>61024045
>beginner
yes
>>
>>61024045
>beginner
no
>>
>>61024045
>beginner
maybe
>>
>>61024045
>beginner
i dont know
>>
File: le pol.png (654KB, 739x900px) Image search: [Google]
le pol.png
654KB, 739x900px
>>61024045
It just means you are getting used to the language.
>>
>>61024045
No faggot, you will never be employed. Also, you need top notch social skills, be 180 IQ, work harder than nigger slaves, have a PhD in two engineer careers to be even considered to become a python developer.
>le amazon
>>
>>61024069
>>61024101
>le
Definitive sign of a brainlet.
>>
>>61024117
define definitive
>>
>>61024117
mad? you can always return to le reddit if you want
>>
File: 1482034529344.gif (538KB, 318x400px) Image search: [Google]
1482034529344.gif
538KB, 318x400px
>>61018062
I program exclusively in anime.
>>
>>61024127
Define mad
>>
>>61023904
You still haven't posted code.
>>
NEW THREAD
>>61024201
>>61024201
>>61024201
>>
>>61024170
it's when (You) suck le bag of dicks
>>
>>61024212
:define bag
>>
File: 1498062835981.png (2MB, 3840x2160px) Image search: [Google]
1498062835981.png
2MB, 3840x2160px
>>61022403
Thread posts: 331
Thread images: 40


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

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


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