[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/DPT/ - DAILY PROGRAMMING THREAD
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 20
STATICALLY TYPED IMPERATIVE PROGRAMMING LANGUAGES MASTER RACE

OFFICIAL APPROVED LANGUAGES LIST:
>C++
>Java
>C#
>D
>Nim

PREVIOUS THREAD AT >>52458465

WHAT ARE YOU WORKING ON /G/
>>
First for Java
>>
Reminder that the only approved language is OCaml.
>>
I am a C programmer.
I do not recognize interpreted languages as valid software engineering tools.
All programs should be compiled and linked to the target processor for optimal performance.
>>
File: pclr01.png (12 KB, 579x340) Image search: [Google]
pclr01.png
12 KB, 579x340
I'm making a pretty simple C program to control some hardware processes.

Occasionally, the program outputs debug outputs, mostly sensor values.

I'd like to add color to those outputs, which is easy. However, Some terminals might not have color support or anything, so I'd like to make enabling a color a command-line flag.

The thing is, I'd have to make two sets of printf statements to cover the color and no color scenarios, as well as if statements.

Is there an easier way to set all the printfs to have color without doubling the size of the source code?

pic somewhat related
>>
>>52461896
because?
why was haskell created then
>>
>>52461863
(define (print-OP-preferences)
(display "OP IS A FAGGOT ")
(print-OP-preferences))
>>
>>52461888
88 HEIL HITLER JAVA MASTERRACE CONFIRMED
>>
>>52461863
Writing in imperative languages is basically doing the computers job, use declarative functional languages and save yourself time by writing actual code rather than fixing bugs
>>
>>52461912
It was an experiment on lazily-evaluated languages (one that failed, by the way - see the associated papers). OCaml is:
-Extremely fast
-Extremely high-level
-Actually used in industry
-Outfitted with many libraries to talk to other languages (C, lua, java, etc.)
-Focused on stability and performance, not putting random pieces of code in and hoping it doesn't explode and provide a feature that someone might use (hello, glasgow!)

Additionally, its libraries, while fewer than haskell's, are much more complete and of significantly higher quality. All that without having significant whitespaces and with complete behavior consistency, things haskell programmers only dream of!
>>
>>52461960
ok write a nice game with 3d graphics using a declarative functional language
>>
>>52461909
Write a function that calls printf and prints the color if it's enabled?
>>
>>52461978
If you are trying to push a functional language as a 'get it done' language I really don't understand why you wouldn't say erlang? Shit is most excellent.
>>
>>52461978
>one that failed, by the way - see the associated papers
LMAO HASKELL IS A FAILURE CONFIRMED
>>
File: CWgV0ruUsAAcUD7.jpg (155 KB, 1024x1024) Image search: [Google]
CWgV0ruUsAAcUD7.jpg
155 KB, 1024x1024
>>52461912
>>
>>52462035
Erlang is very domain-specific.
>>
File: 1270711225705.png (578 KB, 550x413) Image search: [Google]
1270711225705.png
578 KB, 550x413
>its a my language is better than your language episode
>>
I don't know how to program and when I push myself to learn I give up because I don't know how to make progress.
>>
>>52462059
>make new meme lang
>write textbooks
>become a millionaire off of the book sales
GOOD GOYIM
>>
>>52462059
>"real world" haskell
>javascript: the good parts
ebin memes
>>
>>52462074
WILD TRIPFAG APPEARED!
>>
>>52461992
And try making it run at more than 3 fps, if it wasn't impossible to write anyway
>>
>>52462100
What's a tripfag?
>>
File: joke_drrrrrrrrrr.jpg (12 KB, 424x335) Image search: [Google]
joke_drrrrrrrrrr.jpg
12 KB, 424x335
>>52462091
look at the bottom left of the image
>>
>>52462100
pls

I trip on general on a different board. Posted there and forgot to remove my trip.
No bully
>>
>>52462076
BABY STEPS ANON

I'M SURE YOU'LL FIND SOMETHING WORTHWHILE IN HERE:

https://docs.oracle.com/javase/tutorial/
>>
>>52462106
https://www.youtube.com/watch?v=t3xdv4UP9-U&t=11m55s
>>
>>52461863
>no haskell
get out
>>
>>52462111
http://4changboard.wikia.com/wiki/Tripfags

>>52462122
IT'S COOL
>>
>>52461978
OCaml is basically Java with closures
>>
>>52462059
how is the spine already worn

you really read that shit?
>>
>>52462059
go back to reddit
>>
>>52462144
>racket is sending that amount of data every frame
>what is a VBO
FP fags don't know about my state
>>
>>52462076
It can take some time to really grasp the concepts Anon. What resources are you currently using to help you learn and what languages have you tried? Not that the language necessarily matters as the concepts are what is important but Java or C# would be easier to learn in contrast to C or some functional languages.
>>
>functional programming is slow
>functional programming uses too much memory
>purity makes programs useless
>the compiler can't prove everything, you need unit tests for full coverage
Your butthurt fuels my determination.
>>
>>52462168
One of the dumbest posts I've read on /g/
>>
>>52462161
>Because they are attention whores

I sensibly chuckled.
>>
>>52462130
Well I start classes in a week or so. Just gonna wait til then, but thanks for caring (づ ̄ 3 ̄)づ
>>
>>52462190
Functional programming doesn't mean "no state".
>>
>>52462176
have you ever heard of a library? no not a collection of code, like a big building full of free books you can read?
>>
>>52462103
Unless you specify in the colors that it's going to be
msg[1:]+msg[0]
(and further offsets all the way down) from the start, it'll look hokey if you get the colors to scroll or not.

But at least getting one of them to scroll would be a step in the right direction.
>>
>>52462200
It's impure. Disgusting
>>
>>52462221
Eh, I'm not sure how to do that. It's actually my first time making something with Python.
>>
File: D.png (8 KB, 125x95) Image search: [Google]
D.png
8 KB, 125x95
>>52461863
Where's the D?
>>
>>52462230
Just like you're mom
>>
>>52462245
In the list, fucknut
>>
In C++, if i have a pointer to an object with operator= defined, how do I invoke it? "->=" doesn't work
>>
>>52462035
Because it's slow, can't do multi-core, and is extremely restricted in module definitions, among other issues such as esoteric syntax for several features and a weak featureset outside multi-program communication.
>>
>>52462168
See Clojure
>>
>>52462059
>Fiction and Fantasy

DESIGNATED
>>
>>52462294
Clojure's even worse

Also, all this 'optional' or 'gradual' typing nonsense going around (not just in Clojure) is basically training wheels and admitting you can't prove shit about your code
>>
>>52462244
Easiest way I can think of off the top of my head (untested) is to make all of the actually called references to "msg" be "white" Then you can still scroll msg and that should work. It'll still look hokey, though, a tornado twisting really slowly, but at least it should get us somewhere.
>>
>>52462272
*x = ...
>>
>>52462294
No, scala.
>>
>>52462321
Shit, never mind. I just relooked at the code and it doesn't work the way I thought it did.
>>
>>52462333
>scala
It's a step up from Java, I'll give it that
>>
>>52462292
>can't do multi-core
Absolutely incorrect.
https://stackoverflow.com/questions/7005759/erlang-on-multicore-cpu
>esoteric syntax
People somehow write in J and K.
>weak featureset outside multi-program communication
Incorrect.

You've typed this all before, which makes me think you are just parroting some other retard's opinion.
>>
tornado guy, im having trouble delaying the torando, and making it display correctly too, fuck, give me more secs
>>
>>52462339
Yeah, nice try tho.
>>
>>52462350
the only way scala is """"""""better"""""""" than java is that its name isn't java
>>
>>52462357
No problem man, take your time, I have the whole night to myself.
>>
File: coincidence.png (270 KB, 1015x552) Image search: [Google]
coincidence.png
270 KB, 1015x552
It's like the Jude Star for the 21st Century.

https://www.youtube.com/watch?v=EF_UCX6BF4w

Go to 4:33 of the video for more info.
>>
>>52462244
So here's something that works, just not very well:

red = red[1:]+red[0]


This scrolls through the "red" variable. Obviously, it turns white for a few frames, as it scrolls the color changing bit, but it' something.

You could do this for all of them, but I think there's a better way to do it. Let me try some stuff.
>>
>>52462318
Optional typing is great. You can declare types for function parameters so they're easier to work with, but use dynamic everywhere else for easier coding.
>>
Name something you can't do in c++
>>
>>52462356
>multiprocessing is real multicore
The shilling is real! One more reason not to use erlang!
>>
>>52462473
Handle exceptions in constructors well
>>
>>52462377
gonna have to reinvent the wheel 'cause functional programming
>>
>>52462397
>>52462359
Move all of your color codes into the print() calls, that works best.
>>
>>52462473
The only reason you can do anything in C++ is because someone else has already done it for you.
>>
>>52462479
Not even willing to read the link I posted. Shills really are real.
>Erlang's default behavior has historically been to run one scheduler, which is basically a native OS thread, which chooses Erlang tasks to run from a queue. With the advent of multi-core and multi-processor systems, the runtime was extended to take advantage. Starting the runtime with -smp enabled will cause the runtime to create multiple schedulers, usually one per logical CPU. You can manually specify the number of schedulers with the -S flag e.g. -S 16.
>>
>>52462479
>running on multiple cores at the same time is not multicore
sure kid
>>
Haven't heard much about Rust recently

I the project still going strong?
>>
My work shackles me to C#, and my god, the garbage collector is so incredibly frustrating. What's wrong with manual memory management?
>>
>>52462499
Is it really that simple? Why didn't I think of it earlier...
>>
File: 1451462464562.gif (2 MB, 237x233) Image search: [Google]
1451462464562.gif
2 MB, 237x233
>>52461863
>Java
>>
>>52462397
Also, yes, I tried that. And yeah, that's what I meant by "messy". My goal is to make it work flawlessly. Thank you for taking the time to help tho, Anon!
>>
>>52462556
I work with C# professionally as well but have never had any issues with the Garbage Collector. If it is causing that many issues why don't you just enable the use of unsafe code? Wouldn't that give you the ability to achieve manual memory management?
>>
>>52462522
>wasting 50% of expected performance on context switch is viable
OK kid
>>
>>52462605
How do you mean "flawlessly?" No messy code and they actually look like a tornado?
>>
>>52462551
If by "strong" you mean "social justice warrior all the way", then yeah.
>>
>>52462588
statically typed ist stronk
>>
>>52462499
Holy shit it works! God I feel stupid. Thanks Anon!
>>52462642
Yes, I want it to work just like the default msg but colored.
print(int(s)*' '+'\033[1;31m'+msg+'\033[1;m')
worked, tho. Now the next challenge will be to pass multiple colors and possibly make a rainbow effect.
>>
File: 1451085406657.jpg (504 KB, 2358x2591) Image search: [Google]
1451085406657.jpg
504 KB, 2358x2591
>>52462666
Java confirmed for Satan's favorite language.
>>
>>52462627
>pulling shit out of your ass to look like less of a retard
>>
>>52462711
>being braindamaged and lobotomized at the same time
>>
>>52461902

What about glue languages, like Lua, TinyScheme, and MRuby, which allow a compiled program to be extended with scripts at runtime?

>>52461909

Link to ncurses. Most terminals do support color, but some may not do so using escape codes. Unless you really, REALLY need to support the terminals that don't, in which case do what >>52462010 suggested.

>>52462551

Yep.
>>
>On the other hand, pmessage is a pointer, initialized to point to a string constant; the pointer may subsequently be modified to point elsewhere, but the result is undefined if you try to modify the string contents.

What? Why is it undefined? I understand that trying to change it to a longer string using the pointer would have issues, but surely it's not undefined to use a pointer to a string to change individual characters within the string?
>>
>>52462722
The variable it points to is constant. Changing a constant is undefined behaviour because you probably shouldn't be doing it. A normal string can be changed normally.
>>
>>52462722
Where a string constant is located in memory is platform dependent. It might be located in a region of memory designated as read-only by the OS that's hosting the process. If you need to be able to modify a string, then allocate it on the heap or use an array or something, assuming you're talking C.
>>
first for PHP
>>
>>52462762
>>52462782
I see. I assumed that

char *pmessage = "a string";


Just acted the same as an array and allocated space for the string normally. Guess not.
>>
>>52462627
>I have no idea what I am talking about and I am not afraid to show it!
>>
>>52462827
A string literal is constant.
char message[] = "a string";
assigns the string literal to a memory space that is not constant. If you wanted to know what was going on.
>>
can't do it, not enough distinct sine values for a nice smooth tornado, sorry i made ya wait
>>
>>52462832
>if I deny reality, maybe erlang won't be absolute dogshit anymore!
>>
>>52462911
Well then, do tell us more about this additional 50 % context switching time.
>>
>>52462588
sauce of gif? some disney research vid or an actual movie?
>>
>>52463010
You haven't seen The Force Awakens I gather.
>>
What should I use for web programming? PHP+MySQL?
Tell me why I shouldn't use node.js.
>>
>>52463010
https://www.youtube.com/watch?v=bY73vFGhSVk
>>
>>52463010
https://www.youtube.com/watch?v=k3A_pzCUwRA

top kek

>>52463057
nope
>>
>>52462958
>he literally has no clue what multiprocessing is
>he still pretends he's a master on this topic
Reminder folks, these are the people who use erlang! Stay away!
>>
>>52463064
>>>/g/wdg

i'm guessing node.js is less bad than PHP
>>
>>52463121
it's /g/, you can't trust want anybody says on here.
>>
>>52463136
node.js is really nice. Worked with it on a class project. It's package and dependency installer cannot be topped.
>>
>>52463070
>>52463073
That rabbit
I wanna fuck it
>>
>>52461863
>WHAT ARE YOU WORKING ON /G/
A fairly useless demo kernel module for an assignment.
>>
int cmp(const char *str1, const char *str2)
{
while(*str1 && !(*str1 ^ *str2)) { ++str1; ++str2; }
return !(*str1 ^ *str2);
}
>>
File: tumblr_mqtjhsABr11rv36vbo1_400.png (197 KB, 294x256) Image search: [Google]
tumblr_mqtjhsABr11rv36vbo1_400.png
197 KB, 294x256
>>52463166
>>
>>52463136

It is. Primarily because you can use node.js without actually having to write Javascript.

I would not recommend it for non-web projects, however.
>>
>>52463272
>tumblr

>>52463198
What the fuck is this trying to do?
>>
>>52463198
int c(const char *a, const char *b)
{
while(*a && !(*a ^ *b)) ++a,++b;
return !(*a ^ *b);
}
>>
I am new to lisp, trying to get this function that tell me the index of an element to work, to no avail
<code>
(defun where (x y)
(cond
((not y) nil)
((eq (car y) x) 0)
(t (+ 1 (where x (cdr y))))
)
)

</code>
>>
>>52463314
Compares two strings
>>
>>52463366
>>>/reddit/
>>
>>52463314
while *str1 is true and the XOR of *str1 and *str2 are not true increment str1 and str2. The return the NOT of the XOR of *str1 and *str2.
>>
>>52463381
>>52463401
I can see it now. That's some fucking bullshit. I hope one day I'll be able to make something like that.
>>
File: 1452670941455.jpg (194 KB, 960x946) Image search: [Google]
1452670941455.jpg
194 KB, 960x946
>>52461863
I'm 19 and in my first semester of college; decided I'll make an image board system for fun. It has been fun, you would certainly hate the code tho.

>pic related
>my system compared to real world solutions
>>
>>52463394
no one loves you
>>
File: img2938579.jpg (17 KB, 259x346) Image search: [Google]
img2938579.jpg
17 KB, 259x346
almost done reading this abomination
>>
>>52463435
Should have gotten C Programming: A Modern Approach
>>
>>52463366
the code tags are separated by [ ] not < >

(define (index-of lst ele)
(let loop ((lst lst)
(idx 0))
(cond ((empty? lst) #f)
((equal? (first lst) ele) idx)
(else (loop (rest lst) (add1 idx))))))
>>
>>52463121
>he still didn't provide any source for his claims
so you have no argument and are only here to shitpost? good to know
>>
>>52463474
>spoonfeeding
I don't even know why I keep coming to this dump anymore. How can the web have become such dogshit that this is still, despite everything, the only place worth visiting? There must be a sekrit club somewhere that hasn't reached this level.
>>
>>52463538
There probably is but you and I will never get in.
>>
>>52463423
>19
>first semester
>actually second semester
>imageboard system
>pic related

what are you on about m9
>>
>>52463570
Are you stupid?
>>
>>52463538
>/dpt/
>worth visiting
let's not lie to ourselves anon
>>
>>52463600
If only it was only /dpt/.
>>
>>52463538
“don't forget: you're here forever”.
>>
>>52463465
>>52463435

Or C Plus Primer by Stephen Prata.

Huge tutorial book with exercises and questions.
>>
>>52463630
8chen was good for all of 3 months though.
>>
Good book for java programmer to transition to C++?
>>
>>52463667
>or cancer bage gar by cashin mann
>>
>>52463689
he wasn't alone
>>
>>52463538
try killing yourself
>>
>>52463465
>>52463667
it was the only book they had for C at the place i was at besides "C programming for dummies"
>>
>>52463570
>19: I took a year to learn English, it isn't my native language
>2nd semester sorry, I've been really confused lately
>pic related: presenting my mentors & coke rocket to /g/
>image board system: it is what it is. Image board site if you prefer, difference is its totally anonymous (doesn't even use IP bans)
>>
>>52463830
>mentos
>>
>>52463691
>implying that actual books aren't worth buying

I've found that the "online tutorial" self-taught programmers are passive code monkeys with barely any flexibility in their expertise.

Whereas the real, respectable programmers tend to be people who study with real educational resources like textbooks and open source university materials. All of which are just as obtainable.

And I'd rather spend a little money on a carefully selected book written by a very reputable author to learn something properly rather than just Google "teach me code plz" like every other pleb.
>>
>>52463465
>>52463773

What is A Modern Approach like? The cheapest copy I can find is like 40. Huge amount. Is it tutorial based or more like a reference?
>>
>>52463880
It's a great tutorial
>>
http://www.zachtronics.com/tis-100/
y/n
>>
Does your meme language have generator functions?
>>
Learning python, good language??
>>
>>52464044
The best.
>>
>>52463895
No wonder it's a fucking fortune to buy then.

C Plus Primer is great so far. I've heard that they're "virtually the same book".

Is A Modern Approach good for complete beginners?
>>
>>52464044
Better to learn an imperative language before a scripting language though.
>>
>>52463989

I've heard rumors it's a fun game.
>>
>>52464044
learn c++ and you will know python already once you get the syntax
>>
I need a C project.
>>
>>52464112
program a quick way to algorithmically solve any SHA-256 hash
>>
>>52464088
> Better to learn an imperative language before a scripting language though.
It appears that you don't understand what either of those terms mean.
>>
>>52464141
I'm on it. Will report back when I'm done.
>>
File: Ra3Ume2.jpg (701 KB, 2007x2477) Image search: [Google]
Ra3Ume2.jpg
701 KB, 2007x2477
>>52461863
>>
>>52464088
>implying Python isn't an imperative language
>>>/reddit/
>>
>>52464190
its oo
>>
>>52461902
>All programs should be compiled and linked to the target processor for optimal performance.
https://www.youtube.com/watch?v=i2fhNVQPb5I
>>
>>52464063
No, it's good for intermediate level C programmers.
>>
>>52464199
Procedural and OOP aren't mutually exclusive.
>>
>>52464225
I'll stick to C Primer Plus then.
>>
>>52464220
Why do these retards immediately go from C to "hurr web dev". C can also resize arrays. I get the joke but they're trying too hard.

Also C is still used for anything that need good performance, not just embedded systems.
>>
>>52464284
Then read A Modern Approach, it's great.
>>
What do you guys think of Go?
>>
Asp MVC site to show cost of what ppl think are essential (nutrition, hygiene, gas) vs income opportunities in the area. A script will fill the database from places like Walmart and I'll have to manually enter information about job offerings.
>>
>>52464112

Tower Defense Game using SDL or Cairo or some shit.
>>
>>52464332
I don't like how opinionated it is.
>>
>>52463862
>>implying that actual turds aren't worth eating

>I've found that the "blue cheese" self-taught foodies are passive food eaters with barely any flexibility in their expertise.

>Whereas the real, respectable foodies tend to be people who dine with real taste buds like shit and open air cooked dungs. All of which are just as obtainable.

>And I'd rather spend a little money on a carefully selected turd shat by a very reputable shitter to feed on something properly rather than just Google "what to eat plz" like every other pleb
>>
>>52464286
>Also C is still used for anything that need good performance, not just embedded systems.
MY FUCKING SIDES!
>>
>>52464483
Name literally anything fast and i'll show you the C that's used underneath. The only reason python is used is because C is carrying it.
>>
>>52464564
Isn't python compiled to machine code these days?
>>
>>52464590
Python uses modules written in C because actual python code would be too slow.
>>
>>52464601
sure, but the python itself compiles straight to machine code
>>
>>52464564
Lisp on lisp machines. Checkmate.
The urweb framework. Checkmate again.
Any fast program (i.e. C++ code). Checkest mate.
>>
>>52464717
>>52464590
Python is something completely different.
It was never meant to be fast, it can't even do multithreading.
>>
>>52464717
>there are retards who actually believe this
>>
best c++ learning reference?? I have cppreference.com anything else?
>>
>>52464748
indeed there are anon. There are smart people who believe it too. In any event, it's the truth.
>>
>>52464780
>this is what /dpt/ is like in 2016
>>
File: wow.png (365 KB, 2616x1424) Image search: [Google]
wow.png
365 KB, 2616x1424
>>52461863
Reversing some World of Warcraft network packet structures.
>>
>>52464725
>Lisp on lisp machines
Epic.

>The urweb framework
Nice one.

>Any fast program (i.e. C++ code).
Congrats, you made one point, finally. Funny though how the language that's fast is an iteration of C.
>>
>>52464818
>I'm retarded and nobody can stop me!
>>
>>52464844
What do you want me to say? The first one only won because the hardware was specifically designed for it. The second I hadn't even heard of so I can't even test if it truly is fast at all and the third is as I said, "C with classes".
>>
>>52464332
>Simple design. Code is easy to read, write, and reason about.
>Completely outclasses meme languages like Ruby, Nodejs, and Python.
>Static binary deployment. Compile it for a target CPU architecture and OS and just execute it.
>Does not use the JVM.

I do all of my web development in Go.
>>
>>52464471
self-taughts getting btfo

seriously tho, if you didn't learn from a book or a formal class, or at least a book used by a formal class, then you're just a codemonkey
>>
>>52464949
That doesn't mean you should try learning from a book widely known to be absolute dogshit and which name was chosen precisely to cash in on a previous, actually good, book.
>>
>>52464882
Why use "C except shitty" when you could use ocaml?
>>
>>52464989
C Primer Plus is shit?
>>
>>52465008
why use apple when you can use orange

both fruit
>>
>>52465025
Morel like, on one hand you have a half-eaten golden and there are worms visible inside, while on the other you have a perfectly ripe organic gala free of any imperfection.
>>
>>52462328
thanks!
>>
>>52464717

Not quite... at least not with the main Python interpreter

https://github.com/python-git/python

You'll note that there is no "arch" folder either at top level or in any of the subdirectories. If Python were JIT compiled into native code, then it would need to have a set of definitions for each architecture it is compiled to. Instead, what we see is that it is simply compiled down to bytecode, which is easier to interpret than just an AST.

CLR bytecode, on the other hand, does:
https://github.com/dotnet/coreclr/tree/master/src/jit
>>
File: 1426548231392.png (141 KB, 800x600) Image search: [Google]
1426548231392.png
141 KB, 800x600
>>52464949
k tard

there are plebs that are self-taught and there are plebs that learned from a book or a formal class. a book or a formal class by itself is nowhere near enough to make you a skilled programmer.
>>
I fucking hate this so much. I just want to program but I hate it so much I don't want to do so much work and thinking of stuff. Why is the fun stuff so much work
>>
>>52465313
>I don't want to do so much work and thinking of stuff.

But that's the fun part. Learning is good.
>>
>>52465313
doing work and thinking of stuff is the fun part. you sound like a coddled kid that wants everything to be easy. non-codemonkey programming is for people who enjoy a good challenge and something to keep themselves busy with.
>>
>>52465339
Fuck off I used to like it but I don't now. How do I like it again?
>>
>>52465339
>non-codemonkey
>programming
Aww, isn't it cute? Pajeet thinks saying 'software engineer' makes him an engineer!
>>
>>52465367
>code monkey is this butthurt
>>
Threadly reminder that you should not refer to the act of programming as coding. It is improper and makes you look like a 16 year old

You are a programmer, not a coder

Software Alchemist is GOAT
Developer is okay
Magician is okay
Software Magus is okay
Software Engineer is okay
Software Architect is okay
Code Guru is okay


Archmage is reserved for only the most senior of programmers

Writing in HTML and CSS is not programming, therefore it should be referred to as designing
>>
>>52461978
>>52462168
>>52462035
shilling too hard desu m8s
>>52464564
FORTRAN
>>
>>52465397
ok
>>
>>52465397
so then what is considered coding?
micro processor shit?
>>
>>52465546
web dev scripting and writing python 1 liners using itertools
>>
>>52465397

at the end of the day you're just a turd wrangler though.
>>
>>52465625
What's the point of python 1-liners? Is it a game? Because they're most definitely not useful.
>>
>>52465625
>web dev scripting
>scripting
>scripting is coding
wat

>python 1 liners using itertools
that doesn't make sense.

actually im starting to feel autistic for even caring about such pointless terminology. fuck it, back to work.
>>
I fucking love higher order functions in Ruby sometimes...

def self.tokenize str
str.split(/\s/).map { |s| re_tokenize s }.flatten.reject &:empty?
end
>>
>>52465695

Ruby looks pretty qute. Also, I'm taking PL this semester so it's pretty much guaranteed I'll be tinkering with it. Any gud books?
>>
>>52465695
i assume |s| retokenize s and &:empty are lambdas?

what do they do
>>
>>52465665
It's called code golf and it most certainly only teaches you bad programming practices
>>
>>52465313
Thinking is part of programming and I don't mean just memorizing the syntax
>>
Is getting a double major in CE and CS pretty easy if you already have a major in CE?
>>
>>52461863
Anyone want to share their Project Euler solutions with me?
Here's my solution to 47 in python. Runs in 1.5s on my T420.
from itertools import *
from sys import exit

def primes():
for p in (2, 3, 5):
yield p
roots = {}
primeroots = frozenset((1, 7, 11, 13, 17, 19, 23, 29))
selectors = (1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0)
for q in compress(islice(count(7), 0, None, 2),cycle(selectors)):
if q in roots:
p = roots[q]
del roots[q]
x = q + 2*p
while x in roots or (x % 30) not in primeroots:
x += 2*p
roots[x] = p
else:
roots[q*q] = q
yield q

all_primes = list(islice(primes(), 1000))

def decompose(n):
for p in all_primes:
if p*p > n: break
while n % p == 0:
n //=p
yield p
if n > 1:
yield n

i = 2*3*5*7
while True:
j = 0
while len(set(decompose(i))) == 4:
i += 1
j += 1
if j == 4:
print(i-4)
exit(0)
i += 1
>>
Anyone have any good project ideas? Does anyone have that image to roll for project ideas?
>>
>>52465981
You are majoring in CE again? But yes, CS is a joke at most unis.
>>
>>52464800
hi shauren
>>
>>52463989
horse shit
>>
What's wrong with python?
No, the performance isn't the best, but for most things, that doesn't matter.

I'd rather throw something together in 5 minutes using python than 30 minutes using C++.
Most of the time, I don't notice that stuff runs 3 seconds slower, and when I do, I don't give a shit.
>>
>>52462267
>in dah lust
Because clearly there is actual talk about D here you nutfuck.
>>
>>52466148
its horse shit
>>
remove("folder/file.txt");

This code is failing to delete the file, because it says permission is denied. Any reason why? The file is closed, and I can't think of any other reason why it wouldn't let me.
>>
>>52466239
Fixed it. There was one other place I was using the file that I forgot about. Turns out I didn't actually close it. It's working now.
>>
>>52466148
Python is fine.
The only thing that's wrong is that you're going on an anonymous image board for affirmation that the language you like is good. Stop that.
>>
>>52466359
python is ~100 times slower than every other language
>>
>>52466416
and much, much quicker to prototype in, so if you need something you don't need speed for, python is very useful. That's why most of the concepts behind it (huge library, dynamic typing) work so well for it, even if, conceptually-speaking, dynamic typing is shit, it supports the python workflow
>>
>>52466492
>much much quicker to prototype in

much, much slower to prototype in
>>
>>52466540
nice meme
>>
>>52466054
https://better-dpt-roll.github.io/ there ya go famalam
>>52466492
what kind of prototyping do you actually get done by using a bunch of libraries other than "look i made the app" and then reimplementing the exact same shit? the point of prototyping should be to make a rough version of the thing you're doing so you have a general sense of how you're going to write the final version, but if you're using a library that isn't available in the language you'll use for the real project then you're not going to be able to easily port over the code and end up starting from scratch with code that's completely different, which obviously doesn't gain much from the prototype
>>
>>52466416
> python is ~100 times slower than every other language
So. Fucking. What.

Well, actually it's 100x slower than statically-typed, compile-to-binary, unmanaged languages (C, C++, Fortran) IF you're using it to write "ground-level" code (i.e. where you're manipulating scalar types directly).

Compared to other dynamically-typed interpreted languages, the margin isn't that bad. If you're using it to write high-level code (where you delegate to the language in larger chunks), it isn't that bad.

And there's a reason it's slow: because it doesn't compromise generality for performance. Compiled languages get their performance advantage from fixing as much as possible at compile time. If you want to handle dozens of distinct types, you need dozens of distinct variants of the code (either written manually or derived from templates). C doesn't give you the generality. C++ does, but at significant added complexity (making it the other language which /dpt/ loves to hate).
>>
>>52466540
So edgy ...
>>
>>52466571
dynamic typing is shit and does not make prototyping faster

>>52466588
[spoiler]you can have generality and high performance[/spoiler]
>>
>>52466574
>what kind of prototyping do you actually get done
For example, for my CHIP-8 vm, I'm not so concerned about the speed of my assembler, so while I type the vm in C, I can write the assembler in python and churn out all the binary game files I want quickly without having to worry about types, compiling, added stuff like main, etc

>>52466619
Not typing out types is marginally faster
>>
>>52466636
>not typing out types

Type inference, automatic generalisation
See Ocaml, F#, Nim, C++ (since auto, still not great)
>>
>>52466636
>For example, for my CHIP-8 vm,
meh, i wouldn't consider that much of a prototyping example, but more like a personal project thing. if you're doing something for fun then yeah i guess python is good, but you're not going to prototype the next microsoft word or whatever in it
>Not typing out types is marginally faster
>what is type inference
>>
>>52466650
>>52466663
The presence of type inference in other languages does not make dynamic typing in python slower, it means other languages have a way of shortening prototyping time too. However, it generally still pales to python's interpreted, huge-library style.

>>52466663
Personal projects aside, my point still stands, doing things like conversion-assembly, base x to base 64, occasional interaction with apis, and even various small tools at my own workplace which speed up engineering time, can all be quickly protoyped with python with no real downside.
>>
>two bitches in arms
what an alpha male
>>
>>52466699
>does not make dynamic typing in python slower
no it means there's no fucking advantage

>huge library
not a language feature
>>
>>52466663
>meh, i wouldn't consider that much of a prototyping example, but more like a personal project thing.
Also I hope you were referring to the assembler as my prototyping example. The vm itself is written in C
>>
>>52466574
> but if you're using a library that isn't available in the language you'll use for the real project
Well if you're going to be writing the real project in C or C++, that's rather unlikely, given that most substantial Python libraries are wrappers around C or C++ libraries.

> end up starting from scratch with code that's completely different, which obviously doesn't gain much from the prototype
Oh, it does. The cases where you really need a prototype are the ones where you have no idea what kind of approach is going to work out in practice. You may end up going through half a dozen substantially different methods before hitting on something that works. That's going to be a lot quicker in a language with an interactive interpreter than spending 3/4 of your time waiting for compiles.

Also, prototyping in Python provides reasonable insurance against some management type convincing themselves that you just need to "polish" the prototype a bit and can then use it in production code.
>>
>>52466724
>no it means there's no fucking advantage
Literally what I said. But It still pales to Python being interpreted and having an huge library

>not a language feature
Doesn't matter. It has it, it makes prototyping fast
>>
>>52466699
checked, also
>does not make dynamic typing in python slower,
until you have to debug something that could have been prevented with a type error
>>
>>52466750
Python being interpreted means fuck all, it's still shit for prototyping
>>
>>52466758
>until you have to debug something that could have been prevented with a type error
For quick prototyping? Compared to the alternatives that deal with types? Nah

>>52466759
It's good lmao, deal with it
>>
>>52466776
>python is good for prototyping by default
>i dont have to prove it
>other languages aren't good by default
>i dont have to prove it
>>
>>52466794
>prove
I don't think you understand the argument, especially since good is an opinionated word

>other languages aren't good by default
Trying to steer the argument by putting words in my mouth won't get you anywhere
>>
>>52466619
> you can have generality and high performance
It's called C++, and having both at the same time is the main reason the languages is so bloody complex.

But it's still nowhere near as general as Python. If a function processes a list of objects, the only thing those objects need to have in common is support for the methods and properties the function uses on them. Attribute access can be overridden via __getattr__ etc. New classes can be generated dynamically via type(). Methods can be replaced dynamically.
>>
>>52466807
Oh, you're one of the reddit fags that think nobody should be allowed to use the word "prove"

You've already shown you're not interested in the truth, you certainly didn't give any justification when you first claimed python was "much, much" faster for prototyping
>>
>>52466825
I've never been to reddit, but using the word "prove" when we're giving our anecdotal experiences makes no sense at all.

And I gave my points
>>
>>52466817
Having both doesn't need to lead to such a convoluted syntax. C++'s syntax is shit because of backwards compatibility, compatibility with C, outdated ideas and design by committe
>>
>>52466850
And someone challenged your claim that dynamic typing meant it was a better prototyping language.
>>
>>52466866
Yes, but don't you see child, these things can't be proven. That's why I gave my anecdotal experience as well an explanation as to how python's features make it quick for prototyping
>>
>>52466920
Jesus christ if someone asks you to prove something they mean show them it's true you fucking autist
>>
Does anyone here know how to compile all files in all folders with GCC using a batch file? I currently have this:

for /r %%i in (*.c) do %GCC% -I %cd%\include -c %%i -std=gnu99 -ffreestanding -O2 -Wall -Wextra



It looks like the path is being truncated and it can't find the file.
>>
>>52462272
->=

My fucking sides
Thread replies: 255
Thread images: 20

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.