[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 Python 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: 315
Thread images: 39

File: the_lead_designer_of_rust.jpg (78KB, 535x767px) Image search: [Google]
the_lead_designer_of_rust.jpg
78KB, 535x767px
What are you working on, /g/?

Old thread: >>61058989
>>
>>61061258
I just realized that i didn't actually need the angle brackets
fn is_symmetric<I>(it: I) -> bool
where
I: IntoIterator,
I::Item: PartialEq,
I::IntoIter: DoubleEndedIterator,
{
let mut it = it.into_iter();
while let (Some(l), Some(r)) = (it.next(), it.next_back()) {
if l != r {
return false;
}
}
true
}
>>
Kotlin sucks
>>
>>61061513
Making mad bank autoblogging with affiliate link. Python and Selenium is the meat and potatoes. WordPress on the back end.
>>
>>61061563
Weren't you shilling kotlin? What happened?
>>
File: gsfight.webm (3MB, 720x405px) Image search: [Google]
gsfight.webm
3MB, 720x405px
/dpt/-chan, daisuki~

Ask your much beloved programming literate anything (IAMA)

>>61061563
Why?

>>61061513
Please use an anime image next time.
>>
File: 1490395475313.png (522KB, 519x697px) Image search: [Google]
1490395475313.png
522KB, 519x697px
>>61061549
Sorry anon, I love Rust but D is just so much more comfy!
auto is_symmetric(T)(T[] arr)
{
for (auto a = 0, z = arr.length-1; a < z; a++, z--)
{
if (arr[a] != arr[z]) return false;
}

return true;
}
>>
>>61061744

>, in for loops
disgusting
>>
>>61061744
This isn't an equivalent code tho.
>>
File: 5_lei._Romania,_2005_a.jpg (134KB, 800x414px) Image search: [Google]
5_lei._Romania,_2005_a.jpg
134KB, 800x414px
>>61061744
>>
>>61061807
So what is your is_symmetric() doing?
>>
>>61061744
Rewritten in a decent language.
let is_symmetric eq len nth arr =
let rec loop i z =
i >= z
|| nth arr i = nth arr z && loop (succ i) (pred z) in
loop 0 (pred (len arr))
;;

let string_is_symmetric = is_symmetric ( = ) String.length String.get;;
>>
>>61061855
That is straight up puke inducing
>>
How can CL compete with Scheme when it doesn't even have continuations?
>>
>>61061855
>String
>>
>>61061831
It's not mine, but it takes an iterator, not a slice. I.e. it can work with any source of data, including vectors, ranges from BTrees, static slices and lazily generated data, without allocating and copying anything.

Also, your code requires T to be comparable to itself, yet D has no way to express it in the function signature, meaning your API is incomplete and you're gonna get some fancy error when you try to use it with incomparable type. While Rust's code is a self-sufficient and type checked as is, your code is just a glorified macros waiting to be instantiated to be actually type checked.
>>
>>61061878
that's a specialisation
>>
>>61061915
It takes a vector, anon
>>
>>61061872
lol? Most scheme implementations just don't implement continuations because you can't implement in a efficient way, they are fucking slow. Also nobody uses them anyways.
>>
>>61061976
Even worse then.
>>
>>61061991
It takes slices too
>>
>>61061991
it takes a series of functions, it's essentially what rust is implicitly doing
>>
>>61061976
>>61061999
>>61062022
Are you trying to confuse me?
https://dlang.org/d-array-article.html
it's a slice, which is just like Rust's slices, a pointer to an array + the length of the array. I guess you can convert a vector to it implicitly basically for free, but it's still far from being a generic over the container like Rust's version is.
>it takes a series of functions, it's essentially what rust is implicitly doing
Rust version does nothing of sorts.
>>
>>61062081
>it's a slice,
It's a rage of T, anon. Dig deeper.
>>
What's the latest piece of code you've written? Not projects, code.
>>
>>61062131
threadpool in C also some elisp to build my projects.
>>
>>61062100
No it's not: http://dlang.org/phobos/std_range.html . With ranges it would be something like
auto is_symmetric(R)(R arr)
if (isBidirectionalRange!R)
{}

And the code would be completely different since you now have to pop() and check for empty().
>>
>>61062174
I just simply didn't add more abstractions, anon. I knew about bidirectional iterators
>>
>>61062206
Right, so it's not an equivalent code, this is that I've started with.
>>
File: 15626158.jpg (29KB, 716x403px) Image search: [Google]
15626158.jpg
29KB, 716x403px
>>61062230
I have two strings. How can I check if str1[n] == str2[p] in Rust?
>>
>>61062285
return false; // statistically likely
>>
>>61062285
In C it's easy.
str1[n] == str2[p]
>>
File: 334463_1261554852251_500_275.jpg (14KB, 499x275px) Image search: [Google]
334463_1261554852251_500_275.jpg
14KB, 499x275px
>>61062285
Do you want to compare Unicode codepoints or bytes?
>>
File: inr-2-indian-rupee-2.jpg (61KB, 600x352px) Image search: [Google]
inr-2-indian-rupee-2.jpg
61KB, 600x352px
>>61062307
>>
>>61062324
strings
>>
Communism and Python is for brainlets.
>>
>>61062350
Python is pretty fast with pypy
>>
>>61062347
If you want to compare string, then it's just str1 == str2, there's not need for indexing.
>>
>>61062364

Not in all use cases.
>>
I thought you guys were meming about Python. But I gotta say, it's horrible. How is it still popular among the scientists?
>>
>>61062431
numpy
>>
>>61062431
>How is it still popular among the scientists?
Why people love untyped and unsafe language? Because they don't like discipline, exactly the same reason why mono repositories are still a thing today. Developers are not ready for discipline and quality work.
>>
>>61062431
it's basically pseudo code
>>
Fuck, I'll need to deliver an assignment 80% complete. Am I fucked? I've never failed before like this.
>>
>>61062431
I do machine learning and ANN with javascript pre ES5
>>
>>61062431
Scientists spend all of their time developing science shit and statistics, not writing code. They all use python because it is quick to pick up and implement their algorithms.
That being said FUCK SCIENTISTS.They have no idea how shitty their code is and just assume that their algorithms take a long time to run when really basic programming concepts would speed their code up drastically.
>>
>>61061579
Where is this from
>>
>>61062513
No scientist is falling for the speed meme about prog langs, they calculate their algo speed in a different way, as well as python is psuedo code in action, once is deployed its mostly C++ and C stuff anyway.
>>
>>61062466
imexperience you need to have more discipline about types because you have to be careful about what the fuck can happen to your variables. In typesafe languages you know it wont change so you dont have to stress about it.

>>61062513
I dont know how someone can implement complex math heavy algorithms without proper debugging (e.g. stepping into lines). C# is also a very easy language and you can build shit quickly with it.
>>
>>61061855
why not parameterize over modules?
>>
>>61062642
I tried, but which type do you use?
Because you can have a generic type (like for array), but for string the item type is char mandatory.
>>
how do non blocking timers work under the hood? do they just create an other thread, where elapsed time is constantly compared to a given amount?
>>
>>61062656
ah yeah that's true. you could use some opaque type and perform some GADT magic to treat String.t as Char.t String.t or something like that
like
module String = struct
type _ t = Str of char string
let (=) (Str x) (Str y) = x = y
let length (Str x) = String.length x
...
end
>>
Reminder that C++ is objectively superior to C. It has everything C has, including speed, because if you need C-like speed you can just use the C subset, and if that's still slower with a C++ compiler than with a C compiler, you can just compile it with a C compiler, and you're still technically compiling C++, because you compile C++ whenever you compile C, because all C is C++, but not the other way around. C cannot be faster than C++, because the fastest C program is also a C++ program.
>>
>>61062850
This assumes that C is a subset of C++, which is false. C++ doesn't have a standard restrict attribute, for instance, and that's important for performance.
>>
>>61062857
>C++ doesn't have a standard restrict attribute
C doesn't have this either but the C compiler does
Reminder that the C compiler is actually a C++ compiler, just not a complete one
>>
>>61062850
Reminder that you are still a virgin.
>>
>>61062884
reminder that no i'm not (thanks dad) and it's foR THIS REASON THAT I THink aoubt sjucicde often
>>
>>61062857
>C++ doesn't have a standard restrict attribute
What is this?
>>
>>61062877
What I read in your post.
Reminder that sane person are crazy people without madness.
>>
>>61062901
Asserts non-aliasing of pointer accesses allowing for greater optimization.
>>
>>61062910
that is not an accurate comparison because madness can diminish a person's abilities where as c++ does nothing to c but add new things to be possible in it
>>
File: questionrabbit.png (127KB, 795x1000px) Image search: [Google]
questionrabbit.png
127KB, 795x1000px
>>61062937
ELI7 plz
>>
>>61062945
Implying C++ isn't madness and doesn't diminish possiblity.
>>
>>61062696
pls answer?
>>
>>61062937
oh that's the restrict you meant
i thought it was standard but apparently it isn't
>>61062967
it doesn't if you don't adhere to the standard
>>
>>61062850
muh void* casts
muh vlas
>>
>>61062955
not him but it means if you declare a pointer as restrict and do a thing through it then no memory accesses except through that pointer can overlap with the thing you did
>>
>>61062955
aliasing pointer access means, that you can refer to the same memory segment with differently named pointers
non-aliasing is the opposite
>>
>>61063017
>muh void* casts
posble in c++
>muh vlas
psibble in c++
>>
>>61063030
So it asserts that only one pointer exists to access that memory. Is that a little like volatile then?
>>
>>61063042

void* does not implicitly convert to other pointer types, like in the obvious case of malloc
standards-compliant C++ does not have VLAs. Even C11 doesn't necessarily have it
>>
>>61063017
>muh void* casts
(void*)
you should be using this in plain C anyway
>muh vlas
these are bad practice in C
>>
>>61062955
void swap(int *restrict p, int *restrict q) {
int t = *p;
*p = *q;
*q = t;
}

// illegal
int x = 10;
swap(&x, &x);

// legal
int x = 10;
int y = 20;
swap(&x, &y);
>>
File: 1498108612020.webm (924KB, 600x336px) Image search: [Google]
1498108612020.webm
924KB, 600x336px
>>
>>61063056
It's not like volatile at all.
>>
>>61063056
>Is that a little like volatile then?
no
volatile asserts almost the opposite: that even if nothing in your code changes some data, it's liable to change without warning, e.g. for hardware reasons, so any repeated accesses shouldn't be optimized away
>>
>>61063141
wait so does this mean
int const volatile* restrict

is a valid type?
>no one inside this program can read or write this data except me
>even i can only read it
>but things outside this program are allowed to write to it
>>
>>61063103
dereveotyan eto ti?
>>
>>61063287
It would be wrong for it to be const, but restrict and volatile can be used together.
>>
>>61061744
pali x = let t@(a,b) = bounds x in x == ixmap t (b + a -) x
>>
>>61063467
/me pukes on anon
>>
>>61063443
>It would be wrong for it to be const
Why?
Volatile and const can be used together too.
Can const and restrict not be used together?
>>
>>61063560
Why are you so latent? Accept your feelings of arousal.
>>
>>61062850
I link my C++ code with the C compiler because it's faster, and because none of my C files compile under the C++ compiler without adding tons of -fpermissive shit.
>>
>>61063597
Oh, never mind, you can use them together. A volatile const variable is a variable that can change at any time but the code itself can't write to it. "const" is just a bad name for what it really means.
>>
>>61063597
Pretty sure they can be used together. https://stackoverflow.com/a/4597164
>>
>>61063467
if you use viewpatterns you can probably avoid the let
>>
File: 96f.jpg (20KB, 600x450px) Image search: [Google]
96f.jpg
20KB, 600x450px
>>61063287
int const volatile* restrict snek;
>>
>>61063687
#define const
#define volatile
#define restrict
#include <code.h>

NAP btfo
>>
File: hzAOi9g.jpg (25KB, 720x480px) Image search: [Google]
hzAOi9g.jpg
25KB, 720x480px
>>61063707
>>
>>61063741
#undef NAP
#define state
>>
>>61062431
I'm working with Python among scientists. It's hell. I hate Python. I hate dynamically typed languages. I hate Guido van Rossum and his "pythonic" cult following.

Python has to die.
>>
>>61063889
Python is one of the least offensive dynamically typed scripting languages you could be working in.

Still sucks for anything longer than about 200loc
>>
Why are most "programmers" aware of the evils of premature optimization (sometimes to the point where all optimization looks evil) but precious few ever consider premature abstraction?
>>
>>61064143
Quit your memeing.
>>
>>61064143
>>61064143
Blame software engineering. People overestimate how useful chunks of their code actually are and end up making horribly maintainable call stacks because of it. Example: OOP
>>
>>61063091
Am I being dumb or does this example not really need non-aliasing guarantees?
>>
File: ec6.jpg (39KB, 500x380px) Image search: [Google]
ec6.jpg
39KB, 500x380px
/dpt/ in shellnut
>>
>>61064202
restrict isn't a guarantee, it's an optimization hint that could lead to undefined behaviour if you don't ensure you're using it correctly.
>>
>>61064217
On this note when were all the hasklel memelords btfo? I am noticing they are no longer here to stink up the place with their big smelly butts. But I am unclear as to why this has happened and when.
>>
>>61064143
>premature abstraction
It's called programming
>>
Why doesn't python simply have something like dir() but to view the names of the function arguments?
>>
>>61064282
They are pursuing their computer science degrees.
>>
>>61064340
>the names of the function arguments
A good language doesn't maintain garbage data like this at runtime.
>>
>>61064316
Don't mind me, just programming.
// TODO: rename to better reflect the common elements of the classes that implement it
interface Thinger {
// TODO: might have to change this signature because we don't know what has to happen yet when this method is called
void foo(int x, float y);
}

// TODO: implement foo
abstract class AbstractThing implements Thinger {
// TODO: rename to reflect how it's used
int field;
}

Whew, that was hard work, time for a break.
>>
>>61064354
>tfw getting a degree is the most you will ever do in computer science because you are a hasklet
>>
>>61064355
you can call everything as a kwarg though
>>
File: 1498287254076.gif (132KB, 326x52px) Image search: [Google]
1498287254076.gif
132KB, 326x52px
>>61064282
>>
>>61064382
what's the point of args or kwargs
just pass a list or a dict
>>
File: captchaa.jpg (5KB, 300x57px) Image search: [Google]
captchaa.jpg
5KB, 300x57px
>just want to do some matrix multiplications
>have to add fuckhueg numpy as a dependency
captcha related
>>
>>61064143
Because on larger projects, development is done in parallel. If there are no interfaces/abstractions to program against, development turns into a clusterfuck.
>>
>>61064391
for all I know it's a dict under the hood
it makes your code more clear though
>>
>>61062535
High school of the dead
>>
>>61064376
Languages don't matter, but it's nice to use something that was built upon more contemporary achievement of theoretical computer science.
>>
>>61064408
**kwargs is accessed as a dict though isn't? And *args is accessed as a list
>>
>>61064407
>trying to do things in parallel when one depends on the other
I thought computer scientists were supposed to understand not to do this.
>>
File: kiddo4.gif (3MB, 448x287px) Image search: [Google]
kiddo4.gif
3MB, 448x287px
>>61064389
>>
>>61064419
wew lad
>>
>>61064419
>theoretical computer science
Science is either theoretical science or computer science. There is no overlap.
"Theoretical computer science" is just trash.
>>
>>61064360
>thinking this is abstract
>>
>>61064360
>premature abstraction
>this
Bitch please.
THIS is premature abstraction.
     

>>
>>61064466
Isn't "theoretical science" just mathematics?
>>
>>61064466
One says "theoretical computer science" to distinguish it from software engineering and other close fields. Indeed, there is one computer science, and it's a part of mathematics, therefore it's theoretical (well, I admit there is "experimental mathematics").
>>
>>61064412
Thanks
>>
>>61064488
>a distant stream of farts is carried through the open air
>its unceasing cacophony seems to imply it is being produced by someone large, due to the constant indigestion he must endure to adequately sustain his girth
>it vaguely resembles "all star" by smash mouth
>the song plays out to its conclusion
>the air now stinks
>>
>>61064517
see: >>61064540
>>
>>61064553
We already know you couldn't handle your math and now hate it. There is nothing to be embarrassed about.
>>
>>61064606
no no you don't understand, it's flatulence
>>
>>61064621
Yes, I just don't care.
>>
>>61064685
No but see it's all star
The fat man farted out all star
This is important god dammit
>>
>he still manually types out "exit" to terminate bash
>>
File: pug.jpg (246KB, 400x800px) Image search: [Google]
pug.jpg
246KB, 400x800px
>>61064774
>bash
>current year
>>
File: 8man x saika.jpg (58KB, 500x581px) Image search: [Google]
8man x saika.jpg
58KB, 500x581px
Is bash just slow to start up or is it really slow compared to lightweight POSIX-compliant shells like dash?

Do posix-compliant shell scripts run faster than ones written with bashisms?
>>
>>61062696
alarms
>>
>>61064911
>Is bash just slow to start up
What? You're on a Gameboy?
>>
s.coords = [(mat * np.matrix(coord).T).flatten().tolist()[0] for coord in s.coords]

There has to be a better way to do a matrix multiplication of a 2-item list and end up with a 2-item list again. ..right?
(mat is a rotation matrix)
>>
>2017
>still using syntactic inheritance instead of semantic inheritance

zoz
>>
>>61065277
what
>>
>>61062696
https://stackoverflow.com/questions/1719071/how-is-sleep-implemented-at-os-level

https://stackoverflow.com/questions/175882/whats-the-algorithm-behind-sleep

The short and sweet version: The kernel calculates when your process is supposed to wake up and shoves it in a queue ordered from farthest wake-up time to closest wake-up time. It then either goes handle other processes, or does busy work until the timeout is reached (it knows the timeout is reached either by polling - "looping on a condition" - its value or by being waken up by an hardware interrupt - basically, a cpu-level "exception").

This is the basic idea behind timers. You might want to look at the linux kernel's source code or read a book on Operating Systems for more details. It's sad and telling of /dpt/'s quality that no one gave you a proper answer before I did.
>>
Jesus christ, bash on Windows 10 is amazing. Almost enough to make me overlook the botnet.
>>
Friendly reminder that C++ would be SO much better if it just abandoned C.
>>
>>61065569
just like write your own programming language then if ur so smart
>>
>>61065306
I assume he means using composition or whatever to model "A is a B" without inheritance as a language feature.
>>
>>61062347
>Cfag is too stupid to understand the difference between a unicode codepoint and a byte.
>>
>>61065510
last time i used it. there was some race condition whenever you tried to
mv somefiles
out of the lxss. That still a thing?
>>
>>61065711
Who said that?
>>
A proving & programming language that puts implementation first and uses irrelevant refinements for reasoning.
>>
/dpt/ why couldn't C have just taken the small extra step to be comfy?
>allow types to have size 0
>void becomes a complete type but with size 0
>still stands for nothing, it's just that nothing is now a valid "object"
>standardize the behavior of malloc 0
>whichever behavior is decided as standard, make it compatible with free and realloc
>>
>>61066308
You might like my language.
>>
>>61066308
Use Nim, it compiles to equivalent C
>>
where can i find resources for manipulating large amounts of data (in csv format, but can be converted to json if needed) with python?
>>
>>61066348
>source: my ass
>>
>calls himself a programmer
>hasn't even fed a starving child in Uganda

ISHYGDDT
>>
>>61061513
>What are you working on, /g/?
a way to kill all marxists
>>
void strcpy(char *s, char *t){ while (s*++ = t* ++); }
>>
QUICK, GIVEN A LIST OF PHONE NUMBER PREFIXES (US ONLY), RETURN A LIST OF ALL POSSIBLE NUMBERS WITH THAT PREFIX
E.G. WHEN PREFIX = 480, THE ITEMS IN THE LIST WILL BE OF FORM 480xxxxxxx
>>
>>61066558
...wouldn't that just be counting from 0 to 9999999 and prefixing it with 480?
>>
>>61066541
>s*++
this is invalid
>>
>>61066610
dereference operator is on the wrong side of the variable
>>
>>61066541
this will segfault if s is not at least as long as t already
>>
>>61066595
>4801
>a real phone number
lmao
>>
>>61066663
>a real human bean
>>
>>61066558
>implying 0000001 will show up
>>
>>61066663
pad the middle with zeros then you aspie
>>
>>61066628
better to crash loudly than to stay unnoticed
go fix your program
>>
>>61066483
I'm invincible
>>
>>61066663
What language are you using that doesn't have a built-in to pad a number? Assembly?
>>
>>61066685
what do you mean my program
>>
>>61066680
>making such a basic programmer mistake
>>
>>61066704
yes anon, i'm doing my homework in assembly
>>
>>61066683
>>61066704
>implying it makes more sense to do this than just to count from 4800000 to 4809999
>>
File: sicp.jpg (40KB, 912x561px) Image search: [Google]
sicp.jpg
40KB, 912x561px
Have you read your SICP today, /dpt/?
>>
>>61066738
Lisp is old lol.
>>
wish there was a SICP with a non-shit language.
>>
>>61066767
There is, it's called SICP.
>>
>>61066719
I'm not a programmer, you whore, I'm a coder.
>>
>>61066767
This, lisp is so slow lmao.
>>
>>61066778
wow, 1337 mr hackerman!
>>
>>61066800
I'm literally hacking a wifi right now.
>>
>>61066776
Lisp is for losers.
>>
>>61066831
Tru, all they do is jack off to their useless macros.
Look at that dude Doug Hoytes, what a loser.
>>
>>61066826
have you connected it to the cia mainframe???
>>
File: how.png (77KB, 842x641px) Image search: [Google]
how.png
77KB, 842x641px
wow
http://i-programmer.info/news/98-languages/10859-redmonk-rankings-reveal-the-languages-we-love.html
>>
>>61066862
Can't do it yet, but if I read enough tutorials.
>>
File: anime_q.png (10KB, 370x320px) Image search: [Google]
anime_q.png
10KB, 370x320px
>>61061579
should I stop using command line tools? The other programmers make fun of me.
>>
>>61066950
You're not bound by any one proprietary IDE or monolithic software tool, fuck them.
>>
What's with the recent /dpt/ backlash against SICP and Lisp? Just six months ago /dpt/ highly recommended both.
>>
>>61067036
>waaah my neet ideals were fought against
use a real language, plebeian
>>
>>61067036
SICP is fine, Lisp is not.
Lisp has no practical use, and if not for the JVM, would be even more irrelevant and dead.
>>
>>61067096
What's not real about Lisp?
>>
>>61067109
It's not used.
>>
>>61067128
I have used it.
>>
>>61067135
t. neet
nobody in the real world uses lisp
you're better off learning languages which give real use to people, and whom will allow you to learn a lot
after that, lisp is fine for hobby shit (and to jerk off to it)
>>
>>61066483

I'd like to contribute.
>>
>>61067180
Its not even that lisp is jobless, its just that its literally worse in any use case.
>>
>>61066558
import std.stdio, std.algorithm, std.range, std.array, std.string, std.conv;

void main()
{
string prefix =
readln
.strip
.split
.front;

iota(10)
.map!(to!(string))
.array
.join
.array
.permutations
.filter!(a => a.startsWith(prefix))
.chain
.map!(a => a[0..$-1])
.chain
.writeln;
}
>>
>>61067212
This, but I can't come up with any examples, help me out here.
>>
>>61067220
>it took him an hour to do this
lmao
>>
>>61067220
the fuck language is this
>>
>>61067220
It's like I'm staring at javascript.

congrats, i wanna puke
>>
>>61067247
>web
>systems
>games
>desktop

And D now beats it in quick scripts with ease of building + performance.

And Haskell is a better base if you want to build your own language.

>>61067220
I really hate idio D and one function a line.
also which compiler are you using?
>>
>>61067266
huh?
>>61067315
>one function a line.
D is not whitespace sensitive
>>
>>61067346
>D is not whitespace sensitive
I know that, but its unofficial std that you do that obnoxious shit. And his program doesnt even compile as of latest DMD.
>>
File: Screenshot.png (144KB, 1920x1080px) Image search: [Google]
Screenshot.png
144KB, 1920x1080px
>>61067373
>>
>>61066897
proof vim is not for peasants
>>
>>61067402
Nevermind, coedit is just a piece of shit.
That shits unbearably slow though.
>>
>>61067482
Also use local and selective imports, lad.
>>
>>61067482
Coedit doesn't have a built in terminal. I spoke to the author. He says he wants to rewrite it in GTKD and terminal will be integrated
>>
>>61067542
Well i use VS Code for my main things, but used Coedit for learning D before switching. I still use it for quick /dpt/ stuff, but im probably just gonna phase it out.
>>
>>61067554
Come to the IRC, you'll get to know a lot of things
>>
>>61067564
Im too much of a brainlet and /dpt/ is the extent to my social interaction. Thanks anyway lad.
>>
>>61067698
get a gf
>>
>>61067709
had one, 2much trouble for an aspie like me, desu.
>>
>>61066897
>D more active tha Go
Lol
>>
>>61067877
What do you expect from a language with 1 (One) use-case.
>>
>>61067897
>1 (One) use-case.
namely?
>>
>>61067944
network shit.

I dont know why Google just doesnt build their own general purpose language instead of funding a bunch of gimmick ones.
>>
>>61067962
>I dont know why Google just doesnt build their own general purpose language instead of funding a bunch of gimmick ones.
How do you think Go came to exist?
>>
File: tori2.webm (3MB, 800x600px) Image search: [Google]
tori2.webm
3MB, 800x600px
>>61061513

more GLSL practice
>>
>>61068108
Go is hardly multi-purpose, its just gonna end up like Dart soon.
>>
File: 1f9.png (412KB, 600x445px) Image search: [Google]
1f9.png
412KB, 600x445px
>>61063379
>>
>>61068218
why make a language that does a lot of things ok, instead of a language that does a specific thing well? so it can become their employee's pet language, or one taught a lot for people's first language? why would they want that?
>>
You do release all your projects as free (as in free speech) software, don't you /dpt/?
>>
>>61068248
GPL
>>
>>61068237
>wanting a thousand languages for really specific use-cases instead of 1-2 that does everything well.
>>
>>61068313
>1-2 that does everything well.
yeah that part's delusional. domain specific languages are going to be better at their domains than python
>>
>>61068351
>python is the only language that can do a variety of things
>>
lads, so whats the deal with cabal vs stack?
Is stack going to/already has deprecated cabal?
Or is this just a case of "i dont like thing in cabal, so im gonna make my own"?
>>
the solution to an algorithm problem i was asked over a year ago in an online interview just came to me. it's to find how many groups of objects are in an array, where a group are objects that touch and an object is a 1, empty space is 0. i was trying to solve it without using any extra memory than an integer that was the count of the groups. i'm such an idiot, not a hard question at all
>>
unimportant poll http://www.strawpoll.me/13278730
>>
>>61068446
It's like you already have your mind made up but being an indecisive faggot like you're, you still have to ask.
>>
>>61068520
i have my mind made up about what i am interested in and what i'm not, but i don't imagine construction workers are particularly interested in their jobs. they do it because it makes them money
>>
is there a book that compiles descriptions of various computational problems (0-1 knapsack, towers of hanoi, Longest Common Subsequence, etc...) and methods to solve them (greedy, dynamic, linear)? like some sort of glossary or handbook
I realize I could google search all of this and find solutions to each individual problem, but it would be nice to have a book I can look everything up in quickly
>>
i wish i wasn't retarded and understood how sound chips work

programming them is so fucking hard
>>
File: 1493526220146.jpg (76KB, 515x698px) Image search: [Google]
1493526220146.jpg
76KB, 515x698px
>>61061513
Trying to create a program which wipes out all marxists.
>>
>>61069427
stalin.exe
>>
File: 1495948549411.gif (2MB, 360x344px) Image search: [Google]
1495948549411.gif
2MB, 360x344px
>>61069435
Good idea, but I would need another program to wipe out this program.
>>
>>61069250
https://en.wikibooks.org/wiki/Algorithms
>>
>>61069473
time.exe
>>
>>61069482
a good start, but not enough things in it
>>
>>61067180
What is a "real world"? Is there a "fake world"?
>>
reminder that true haskell has never been tried
>>
>>61069898
>true haskell
Its called Idris.
>>
>>61069911
Are you suggesting that Idris is shit?
>>
>>61069955
No, Idris is the superior and evolved form of hasklet.
>>
>>61069911
>>61069960
haskell is superio to irdis
>>
>>61069976
D E P E N D E N T
T Y P E S

>inb "i dont need them"

Your language isnt truly functional or pure if it doesnt have first class types
>>
>>61069991
>functional or pure
this is not a useful or desirable property of a language
>>
>>61070021
t. Pythonista
>>
>>61070027
>Python
this is not a useful or desirable property of a language either
>>
File: 1489503850148.jpg (41KB, 394x353px) Image search: [Google]
1489503850148.jpg
41KB, 394x353px
>>61069960
Anything being "true" Shitkell would instantly make it garbage. Idris is strictly superior to Shitkell so it isn't "true Shitkell".

>>61069991
>Your language isnt truly functional or pure if
Functionality isn't in any way related to what type system a language has. It would be very hard to make Shitkell pure even if they added dependent types.
>""first class"" buzzword
My parents warned me about this.
>>
61070038
>buzzword
>>>/v/
First-class attributes are a real thing.
>>
reminder that your language doesn't have first class types unless you can assign a type to a variable that can be used in all the same contexts as any other variable
C-like (but non-C) example:
type my_type = int;
>>
File: 1495502075228.png (204KB, 355x451px) Image search: [Google]
1495502075228.png
204KB, 355x451px
>>61070047
>/v/
How is the word "buzzword" related to gaming?
>""First-class attributes"" are a real thing.
There is nothing """first-class""" about types.
It's just a phrase used to make a language sound better. It's not really needed. Not for discussing decent languages.
>>61070067
>""first class"" types
Maybe the web "dev" threads might be a better place for you?
>>
>>61070076
name one thing wrong with having all types be legal values
>>
>>61070103
Hes just shitposting, stop engaging.
Hell argue anything you say no matter how factual it is.
>>
>>61070103
Nothing. That's actually a desirable thing and a prerequisite for a language not being shit.
>>
>>61070113
quit contradicting yourself
>>
>>61061549
you are triggering my OCD

every '{' belongs in its own line


FIX IT.
>>
File: 1474335032135.png (115KB, 289x277px) Image search: [Google]
1474335032135.png
115KB, 289x277px
>>61070122
Where did I contradict myself?
>>
>>61070132
Anon, we are unfortunately the minority in the formatting debate.
>>
>>61070138

>>61070076
>>61070113
>>
>>61070076
Are you retarded bruh? Take your shitposts somwhere else.
>>
>>61070132
>i just love scrolling down guise
moron of the year award
>>
>>61070132
>every '{' belongs in its own line
this is objectively wrong
no bracket ever belongs on its own line, including close brackets
>>
File: 1494961733735.jpg (362KB, 1008x720px) Image search: [Google]
1494961733735.jpg
362KB, 1008x720px
>>61070150
Point to the exact line which contains a contradiction.
>>61070151
What are you saying exactly, anon?
>>
>>61070165

>>61070076
>>""first class"" types
>Maybe the web "dev" threads might be a better place for you?
>>61070113
>Nothing. That's actually a desirable thing and a prerequisite for a language not being shit.
>>
>>61070171
>""first class"" types
In what way is this a contradiction? "first-class" anything in programming languages is a retarded and meaningless phrase.
>Maybe the web "dev" threads might be a better place for you?
Anyone who seriously thinks "first-class types" is a good description of anything belongs on web "dev" threads.
>>
>>61070186
>In what way is this a contradiction?
Specifically with:
>>61070113
>Nothing. That's actually a desirable thing and a prerequisite for a language not being shit.
>>
File: 1457486413312.jpg (83KB, 551x511px) Image search: [Google]
1457486413312.jpg
83KB, 551x511px
>>61070202
In what way is accepting the blatant and self-evident reality of pure type systems being a good thing contradictory to acknowledging that ""first-class types"" is a fucking retarded phrase?
>>
>>61061513
I was trying to build a 3-Dimensional array, but there was just way too much to type. So I busted out python to do all formatting and stuff for me. Yippy!

TL;DR Code Gen with Python
>>
>no bracket ever belongs on its own line, including close brackets

It's a format thing, Its the way it was taught to me, and it's what I've stuck with.

Personally makes it easier for me to go through large amounts of code, especially when you're on a text editor that doesn't auto-color.

I do acknowledge that I'm in the relative minority here, especially in Python. This is more commonly seen in Java.
>>
>>61070225
You say that types that can be values are "desirable" and necessary for any language that isn't shit. But before that, you called them "retarded" and a "phrase," the first of which contradicts what you'd go on go say about them, and the second of which simply makes no sense: a type system cannot be a phrase.
>>
>>61070252
did I get this right?
arr = malloc(sizeof(T) * x * y * z);
arr[(i * x) + (j * y) + z];
>>
>>61070254
>, Its the way it was taught to me, and it's what I've stuck with.
Thats how it is to everyone, thats why the debate is eternal. Theres logic from both sides but it really just boils down to subjective taste.

Personally i just cant wait for a language that has an autistically good parser so we can be done with the whole thing.
>>
File: 1486099560527.jpg (40KB, 261x260px) Image search: [Google]
1486099560527.jpg
40KB, 261x260px
>>61070285
>You say that types that can be values
This makes no sense. Either types themselves have types or they don't. There is no "can be" here.
>you called them "retarded"
The phrase "first-class x" in relation to programming languages is retarded regardless of what "x" is.
>the second of which simply makes no sense: a type system cannot be a phrase.
I think you got a D in English.
>>
>>61070328
>The phrase "first-class x" in relation to programming languages is retarded regardless of what "x" is.
Not programming related.
>>>/lit/ -- A more appropriate board for discussing semantics.
>>
>>61070338
>Not programming related.
The sentence directly mentions programming.
>/lit/
Not programming related.
>>
>>61070346
>The sentence directly mentions programming.
I could go off on a tangent about how programming reminds me of fishing with Pa, and that wouldn't be programming related either.
Go satisfy your dictionary fetish elsewhere.
>>
>>61070328
>Either types themselves have types or they don't.
Wrong.
In C, types themselves do not have types.
In Ruby, types themselves have types.
Do types themselves have types? Yes or no?
>>
File: 1472010699645.gif (982KB, 320x287px) Image search: [Google]
1472010699645.gif
982KB, 320x287px
>have a pretty complicated class
>it doesn't really do anything until you run init(stuf);
>creating a vector of them FUCKING BREAKS ALL MY SHIT FOR SOME REASON???
>creating a vector of unique_ptr<ComplexClass> totally fixes all my problems
WHY DOES THIS HAPPEN?
>>
File: 1474134532978.jpg (24KB, 512x512px) Image search: [Google]
1474134532978.jpg
24KB, 512x512px
>>61070363
Halfheartedly resist until the pain becomes too much and the struggle becomes real.
>>61070377
>Wrong.
I'm claiming that only two things are possible, either types of a particular type system have types or they don't.
>>
>>61070328
>Either types themselves have types or they don't.
StrOrInt : Bool -> Type
StrOrInt x = case x of
True => Int
False => String


>StrOrInt True
Int : Type
>StrorInt False
String : Type
>>
>>61070381
Are you following the rule of 3? Destructors, copy constructors, copy assignment operators: if you need one, chances are you need them all.
>>
>>61070394
>I'm claiming that only two things are possible, either types of a particular type system have types or they don't.
Yes, and they are both possible.
Not together, of course, but no one said anything of the sort.
>>
>>61064014
funny way to spell ruby

py2 vs 3 is the most "offenstve" shit there is
>>
>>61070400
Are people so stupid they need mnemonics and memorized design patterns to do basic shit like allocate and free an object?

Is this what people go to college for?
>>
>>61070397
In what context is that a response to my post?
>>61070417
That poster claimed "types can be values" when talking about a single language.
>>
>>61070442
>Are people so stupid they need mnemonics and memorized design patterns to do basic shit like allocate and free an object?
Yes and so are you
>>
>>61070448
>That poster claimed "types can be values" when talking about a single language.
This is accurate, though. Types don't have to be values.
>>
>>61070400
but I only ever access the object by reference
>>
>>61070464
>Types don't have to be values.
He was talking about a language where types are precisely values.
It doesn't make sense for them to be values and for there to be a possibility of them being values at the same time.
>>
>>61070467
You do. The vector doesn't necessarily.
I doubt the fact that the pointer is a unique_ptr matters. It could just be an ordinary pointer and it would still fix it. The point is that in any case your object is never being copied by value when the vector screws around with its innards.
>>
>>61070484
from a performance perspective wouldn't it be better for it to only have to copy around pointers than a phatass class?
>>
>>61070471
>He was talking about a language where types are precisely values.
>It doesn't make sense for them to be values and for there to be a possibility of them being values at the same time.
Of course it does. For all P, P => <>P. Basic modal logic right there.
>>
>>61068193
fugg how do you make this shit dude
>>
>>61070494
You'd think. But that's just not how it works. I think there's some third party library implementing by-reference containers for exactly this sort of reason. In the meantime, using a vector of pointers seems like a reasonable solution.
>>
>>61070484
>object
Why would anyone use that?
>>
File: 1492740544716.jpg (263KB, 800x601px) Image search: [Google]
1492740544716.jpg
263KB, 800x601px
>>61070545
Because objects are really useful when you're trying to represent objects in a game world.
>>
>>61062850
>Reminder that C++ is objectively superior to C
How can a language be superior to itself?
>>
File: 1483523503287.png (251KB, 447x597px) Image search: [Google]
1483523503287.png
251KB, 447x597px
>>61070557
>game world
Why would anyone use that?
>>
File: 1480099279789.png (117KB, 400x400px) Image search: [Google]
1480099279789.png
117KB, 400x400px
>>61070578
video games define technology
>>
File: 1466978220058.png (14KB, 266x220px) Image search: [Google]
1466978220058.png
14KB, 266x220px
>>61070584
>video games
Why would anyone use that?
>>
>>61070494
Well, the objects still need to be stored somewhere. The point of a vector is that it is a contiguous container, whose access is more efficient due to the way the CPU cache works. If you store pointers, you lose this advantage.
>>
>>61062850
your logic is trivially flawed. imagine a new language, c+++, which is a superset of c++. unfortunately, c+++ introduces new language features that are bad. all of your arguments for c++ are also applicable to c+++, but c+++ is not a better language. by extension, c++ is not better than c just because it is "has everything C has".
The best thing C++ has going for it is that everyone knows it, it's the lingua franca of developers.
>>
I've had to program a couple of MCUs in C before. I could use interrupts to my advantage; e.g. when I had communication over RS-232 I didn't have to poll the receiving buffer periodically, I could just have an interrupt routine be launched (and the rest of the program be halted) when something was received.

That was really nice. Can I do the same (or a similar) thing in Python? Preferably with arbitrary variables and across parallel threads. For example, I have Thread A playing back some audio and Thread B communicating with some other device over TCP/IP. When Thread B gets a message saying "stop" over the network connection, it should signal Thread A to stop playing the audio, without Thread A having to poll Thread B.
>>
>>61070750
python's signal module can do that. just remember signals must be created and processed in the main thread (but other threads can trigger, etc.)
>>
>>61070852
Cool, I'll look into it. Thank you.
>>
File: py.jpg (1MB, 2250x2700px) Image search: [Google]
py.jpg
1MB, 2250x2700px
Anyone know if this book is any good?
>>
>>61061549
>>61061744
>>61061855
C++ is the best
return equal(arr.begin(),arr.begin()+arr.size()/2,arr.rbegin());
>>
NEW THREAD!!

>>61070891
>>61070891
>>
>>61070713
C++ have a lot of features C does not have.
Most programmers view these features as good, at least when you use it to make desktop applications.
>>
>>61067564
>IRC
Which one? installgentoo?
>>
C++ is shit. It's like C except that it got cancer
Thread posts: 315
Thread images: 39


[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.