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

File: Hoover_Oshineye.jpg (239KB, 1036x1360px) Image search: [Google]
Hoover_Oshineye.jpg
239KB, 1036x1360px
What are you working on, /g/?

Previous thread: >>61089756
>>
Making Clojure great again.
(use '[clojure.string :only (split)])

(defn idx-query [answer n x]
(mod (bit-xor x answer) n))

(defn first-query [seqs answer n x y]
(let [i (idx-query answer n x)
s (nth seqs i)]
(assoc-in seqs [i (count s)] y)))

(defn second-query [seqs answer n x y]
(let [i (idx-query answer n x)
s (nth seqs i)
a (nth s (mod y (count s)))]
(println a)
a))

(defn read-ints[]
(let [line (read-line)]
(if (empty? line) []
(map #(Integer/parseInt %) (split line #" ")))))

(let [nq (read-ints) n (first nq) q (second nq)]
(loop [seqs (vec (take n (repeat []))) answer 0]
(let [query (read-ints)]
(when (not-empty query)
(let [t (first query) x (second query) y (nth query 2)]
(cond
(= t 1) (recur (first-query seqs answer n x y) answer)
(= t 2) (recur seqs (second-query seqs answer n x y))))))))
>>
>>61094704
What esoteric programming language is that?
>>
>>61094717
C++ 20
>>
>>61094717
clojure
a lisp that's not a lisp
>>
File: 149807916723.jpg (201KB, 1920x1080px) Image search: [Google]
149807916723.jpg
201KB, 1920x1080px
>>61094702
To elaborate on what I'm doing, this lexeme matches what most people would class as identifier strings in C like languages.
>>
File: file.png (9KB, 534x273px) Image search: [Google]
file.png
9KB, 534x273px
Is there a better way?
A million try/excepts looks like garbage
>>
>>61094768
monads
>>
>>61094768

probably not with dictionaries so deep, you can do dict.get(key, default_value) though
>>
>>61094768
>python
>not looking like garbage in a program more than 5 lines long
>>
>>61094745
>sepples
>qt
>boost

i just threw up in my mouth a bit
>>
>>61094768
Why do you need the try catch block?
>>
>>61094804
>she doesn't use all three standard libraries
>>
is there any difference between

>pointer = NULL
and
>free(pointer)

also, what exactly happens when 2 pointers are pointing to the same place and i free one of these pointers?
>>
>>61094702
>Software Craftsman
I'd imagine a craftsman to be something like a sculptor whereas a programmer is someone who pretends a mountain is a sculpture while duct taping more rocks onto it.
>>
>>61094808
The API I'm using doesn't always return all of the values.
>>
>>61094768
space before and after =
newline after every try/except
newline after that title assignment

it'll look completely fine
>>
>>61094818
one leaks memory and the other doesn't
>>
>>61094818
yes, it is a very important difference
in the case of
pointer = NULL
the memory pointed to by pointer is never freed. If you keep allocating memory and failing to free it, you will run out of memory.
>also, what exactly happens when 2 pointers are pointing to the same place and i free one of these pointers?
Both pointers will be invalidated, and it becomes unsafe to read or write through that pointer. It's good practice to NULL a pointer after you free it.
>>
>>61094818
yes, they do completely different things

>pointer = NULL
assigns the pointer to null

>free(pointer)
de-allocates memory allocated to that pointer
>>
>>61094818
free() deallocates that memory, making the pointer invalid, pointer = NULL just changes the value of the pointer and leaks memory

if two pointers point to the same place, and once is freed, they both point to invalid data now.
>>
>>61094818

what the fuck? where on earth are you learning C from? the answer to both of those questions should be obvious after the first paragraph on free or on pointers or on the difference between stack and heap
>>
>>61094845
>>61094853
so i can still use the freed pointer and, ie, point it to NULL? thats really nice to know, i thought it would "delete" my variable
>>
>>61094768
monads
>>
>>61094899
I am not trying to be an ass, but I am genuinely curious... what made you think that, and what book/website are you reading?
>>
>>61094890
i'm starting pointers and i think they're a little confusing, i'm not even sure what is a heap
>>
How can I use pointers in Haskell? I am trying to make a C interpreter that can deal with arrays
>>
>>61094927
Assuming you aren't just going to use arrays themselves, look at the Foreign libraries
You could also use the inline-c library
>>
>>61094926

Forget about the heap. Forget about malloc and free. Make sure you understand how stack variables work with regard to lifetime and pointers before you worry about that.
>>
>>61094924
i'm using different materials, mostly websites, but the problem was possibly a translation thing since english isn't my mother language (i didn't realized 'free the allocated memory' means exactly what it says)
>>
>>61094899
yes. a pointer is like a piece of paper with the address of your house. think of free(ptr) as demolishing your house. now anyone who goes to that address will find garbage and maybe will hurt themselves by steping on a rusty nail or something. ptr = NULL is like erasing your address from the paper and writing "nowhere" instead. the house is still there (or not, depending on if you called free).
>>
C++ debuggers for linux?

I use Atom as an editor. Ease of use is a top priority
>>
llthw
idk yo' this shit's sexy af
>>
>>61094965
I can have arrays? As in, multiple variables pointing to the same array, and actual pointers to the same array (changing one changes the others as well)?
>>
>>61094971
>i'm using different materials, mostly websites

I'm going to stop you right there, that's a terrible idea.
Not only are most website on C misleading, they are often just plain factually wrong. You will learn wrong information that you will have to painfully unlearn piece by piece in years.
Just pirate https://en.wikipedia.org/wiki/The_C_Programming_Language second edition from gen.lib.rus.ec
Friends don't let friends learn C from random websites

>>61094992
>C++ debuggers for linux
gdb, lldb
>Ease of use is a top priority
windows VM with visual studio installed

>>61095003
>No. Lisp is actually the simplest programming language, and has no syntactic cruft. While it wasn't designed to be “easy to learn” like Swift, Python, Ruby, or Basic, there is less overall to learn and you will be writing real, useful programs in Lisp sooner than you could with other languages.
now that's just really misleading
>>
>>61095010
They aren't really pointers, so I guess you're better with just using pointers
>>
Why is malloc() garbage?
Why are there other *allocs? (xalloc)
>>
>>61094927
https://hackage.haskell.org/package/base-4.9.1.0/docs/Foreign-Ptr.html
and the rest of Foreign
>>
>>61095040
>>61095061
Ok, thx
>>
>>61095073
Are you using happy for the parser?
>>
>>61095025
ok, thanks for the call
>>
Where do I start if I want to learn c++?
I already know Java and C#
>>
>>61095123
https://isocpp.org/wiki/faq/csharp-java
>>
>>61095073
Are you trying to interact with C code or just interpret it? If that latter you could probably get away without using Foreign at all.
>>
>>61095123
The C++ programming language by bjarne

it's pretty dry and thick but it's the only real good resource on that abomination of a language
there's the smaller book by bjarne too but I think it's too concise and doesn't explain enough to really understand everything about C++
>>
>>61095123
http://en.cppreference.com/w/
>>
has anyone ever noticed if you take the names of boole and fitch and reverse the consonants it becomes foole and bitch
perhaps this can provide some insight into the conundrum of why all languages derived from theoretical comp sci are ass
>>
>>61095148
this
>>
>>61095132
>https://isocpp.org/wiki/faq/haskell
>this article does not exist yet
why aren't haskell users interested in C++?
because C++ is shit?
>>
>>61095025
>now that's just really misleading
which part?
>>
>>61095091
No, I will write it myself, it's for a uni project

>>61095147
Only interpret, but I will need pointers or something similar for arrays
>>
>>61095123
the c++ standard is actually a pretty easy and enjoyable read. there's no real benefit to reading a book instead
>>
>first day as intern
>working with full stack JS for the next month
how painful will it be?
>>
>>61095054
>Why is malloc() garbage?
It isn't, it's a necessary function
>Why are there other *allocs? (xalloc)
They do different things

>>61095123
By getting off 4chan and actually starting
>>
>>61095180
>""""stack""""
>JS
Not programming related. Fuck off to >>>/g/wdg/
>>
>>61094788
>>61094912
t-this is a new /g/ meme right? haven't been back in a while
>>
>>61095204
b-but JS is a programming language :^)
>>
>>61095180
Full stack what?
>>
>>61095210
>meme
I don't want reddit stink nearby. Fuck off.
>>>/v/
>>61095213
>:^)
So basically you're admitting that you're a redditor then?
>>>/r/ibbit/
>>
>>61095210
seriously use monads
>>
>>61094992
Valgrind is a command line tool for spotting memory leaks, memory corruption, and pointer / array mishandling.
If you're scared of the words "command line tool," don't be. It's really, really easy. As long as you've compiled with the -g flag (which will be necessary for pretty much any debugger), all you have to do is type "valgrind name_of_your_file" and it'll run your program and shit out a full report, complete with the exact lines where things go wrong.
It doesn't help with any kind of error that's not a memory error, though. Which, in all fairness, is rare for C++.
>>
>>61095229
you're trying to hard to fit in. please stop.
>>
>>61094702
Is this a good book? Generally what books would you recommend about patterns (language agnostic)?
>>
>>61095247
I want to see the reasoning why you're not from reddit, which you obviously are.
>>
>>61095235
>muh "moan ads"
>>
>>61095263
they aren't mine, they're ownerless
>>
>>61095263
>muh
>>>/v/
>>
File: old_hag_langs.png (173KB, 600x355px) Image search: [Google]
old_hag_langs.png
173KB, 600x355px
Imagine C++ with Fortran syntax. Shit would be cash.
>>
>>61095271
That may be the case, but regardless, why do Trashkell girlmales produce "moan ads" in which they embed videos of themselves moaning in kode komments to attract l33t masc programmer bfs?
Surely there must be a more efficient way to accomplish the same thing?
>>
>>61095263
I can't read the word monads in my head anymore without hearing this trite bullshit.
>>
Working on my SDL OCaml bindings.

I still have to do graphics primitives and audio (all inputs are handled).
>>
>>61095299
Is this post considered funny in your pathetic corner of the world?
>>
>>61095311
>>61095320
>muh "lamb duhs"
>>
>>61095137

m8

Whenever you think about how C really works under the hood, you think System V ABI. Anything else is just plain wrong.

Not being System V is the reason C programming is a nightmare on Windows and so many other platforms

If you've heard of other ABIs you might as well brain bleach yourself
>>
>>61095361
>Not being System V is the reason C programming is a nightmare on Windows
C ain't a nightmare on Windows, but M$ could have done an effort.
>>
>>61095361
Sure but that's not what standard means
>>
>>61095361
>C programming is a nightmare on Windows
literally just use:
>cygwin
>mingw
>wsl
>anything else
>>
>>61095414
>C on Windows is fine. Just use a System V emulation layer
>>
>>61095430
yes
exactly
the real question is did you have any kind of point in providing that simplification of what i said
>>
>>61094926
The heap is a list of memory blocks managed by malloc/free.

When you call malloc(N) it finds a block of size N, marks it as "in use" and gives it to you. If there are no blocks available, it asks the OS to allocate a shit ton of memory and then tries again. If the OS refuses it returns NULL.

Free just marks the block malloc gave you as "not in use" so that if some other part of the program needs the memory malloc may reuse that block.

In addition to the heap, we have the stack, which is managed at the processor level and connected to the nesting of functions, and static memory sections such as .bss, which are part of your program's image and are allocated when the OS loads your program into memory.
>>
>>61095430
>>61095480
No, C is easy with M$ MSVC tools. nmake is just less powerful than make but it works.
>>
>>61095480
not him but that's gross
>>
>>61095505
>If the OS refuses it returns NULL.
Not on Linux. (No not GNU/Linux, because it's a kernel thing).
>>
>>61095510
>C
>msvc

HAHAHAHAHAAHAHAHAHAHA pls kill yourself
>>
>>61095540
It works perfectly.
>>
>>61095380
>C ain't a nightmare on Windows,

AKA I didn't program any real Windows application back in the day

>>61095414

msys2 is the only thing that's even remotely good and you didn't even cite that m8.

stop posting your theoretical objections because you're just wrong

windows doesn't even have a fucking system call interface

>>61095555
my sides
>>
>>61095538
>Not on Linux

Linux doesn't implement malloc, libc does.

Are you telling me glibc calls abort in out of memory conditions?
>>
>>61095589
>AKA I didn't program any real Windows application back in the day
Because programming real C application is easier on GNU/Linux than on M$/NT? You made me laugh anon. And VS is an awesome debugger.

>my sides
Please provide arguments why it's more painful to do C on M$/NT than on GNU/Linux? Because right now I see nothing.
>>
>>61095589
>my sides
why are you still laughing at someone who is objectively right
(he got quads)
>>
File: braveclojure.png (104KB, 900x900px) Image search: [Google]
braveclojure.png
104KB, 900x900px
>>61094715
http://www.braveclojure.com/
>>
>>61095614
>programming real C application is easier on GNU/Linux than on M$/NT?

Not a chance. Systems programming is hard no matter what OS it is, and out of all the OSes Windows is among the few that has decent asynchronous programming support.

Are you sure you're not talking about Microsoft's bastard version of C++ though? C++ actually has decent support unlike the crippled outdated C compiler.

>And VS is an awesome debugger.

I actually agree there.
>>
>>61095538
Do you consider that a good thing? I personally don't like the thought of waiting for the reaper to kill my process.
https://lwn.net/Articles/104185/
>>
File: peppers escapes.gif (408KB, 300x194px) Image search: [Google]
peppers escapes.gif
408KB, 300x194px
>>61095229
>meme
>I don't want reddit stink nearby. Fuck off.

I'm from YTMND and we call them fads.
>>
>>61095675
>Do you consider that a good thing?
No, I don't like it. But I know why they did that choice and it's not totally insane.

>>61095658
>Are you sure you're not talking about Microsoft's bastard version of C++ though? C++ actually has decent support unlike the crippled outdated C compiler.
No. I'm talking about the C compiler (which is also a C++ compiler), and it's not old, it got updates. I still see no arguments against it doing C with MSVC.
>>
>>61095675
Oh you're talking about overcommitting of memory. Malloc's logic isn't really affected. It will return NULL if the OS refuses, and if the OS doesn't refuse it will just return a valid result. Whether that works properly or kills your process is entirely up to the Linux kernel doing its job right.

Remember that you can turn that Linux overcommitting shit off even at runtime.

>>61095715
https://stackoverflow.com/questions/146381/visual-studio-support-for-new-c-c-standards

>Now, the Visual C++ compiler team receives the occasionally question as to why we haven’t implemented C99.

It's literally incompatible with any modern C project
>>
>>61095781
>new-c-c-standards
Sorry, C is C89, modern "C" have introduced only useless features. So no problem to use MSVC on Windows.
>>
>>61094715
>defn
>>
>>61095781
>dont support a programing language on windows
>as a result people who need to program it program on other platforms
>"we dont support it because no one asks for it"
well done microsoft, all part of your master plan to force all windows users into the .NEET environment
>>
>>61095842
98% of professional C code is C89. M$ is right on that. Only hobbyists use non C89.
>>
>>61095808
>>61095860
>Sorry, C is C89, modern "C" have introduced only useless features.
>can't declare a fucking variable in a for loop
>can't make a fucking // line comment

Yeah I'm just gonna stop replying to you now.
>>
File: 1498079340385.jpg (60KB, 960x692px) Image search: [Google]
1498079340385.jpg
60KB, 960x692px
posted in the stupid questions thread but never got an answer

I'm just now learning programming (as a resume booster/ for fun) and I've just "finished" an intro book on Python. So what's the reasoning behind people throwing a fit about OOP? Is it just because it can become a huge mess, and doesn't promote "straight forward" coding? I honestly have no idea. Sorry if this is a common question.
>>
>>61095887
>>can't declare a fucking variable in a for loop
>>can't make a fucking // line comment
Oh, yes those are fucking awesome features that will totally change my way of C coding.

>Yeah I'm just gonna stop replying to you now.
Yes that's better.
>>
>>61095899

Just 4chan being contrarian as always. Not to say that there aren't advantages to alternative paradigms, but it's hard to make a fair assessment about that until you have a lot of experience under your belt.
>>
>>61095638
I've already read the book. It's a good book senpai.
>>
>>61095904
>New built-in data types: long long, _Bool, _Complex, and _Imaginary
>Several new core language features, including static array indices, designated initializers, compound literals, variable-length arrays, flexible array members, variadic macros, and restrict keyword
>Several new library headers, including stdint.h, <tgmath.h>, fenv.h, <complex.h>
>Improved compatibility with several C++ features, including inline functions, single-line comments, mixing declarations and code, universal character names in identifiers
>Removed several dangerous C89 language features such as implicit function declarations and implicit int

u full of shit m8
>>
>>61095950
I'm impressed by the useless list of feature you just show me.

I forgot how /dpt/ is still a house of code monkeys.
>>
ITT: Write in non-existant languages.
(fun main ((u16 argc) (ch** argv))
(format *stdout* "third int: ~"
(atoi (* (+ str 2)))))
>>
File: degree.hex.png (87KB, 735x582px) Image search: [Google]
degree.hex.png
87KB, 735x582px
>>61095860
>Only hobbyists use non C89.

source: my ass
>>
>>61095976
>I have no argument
>>
>>61096021
https://github.com/tomhrr/dale

https://github.com/carp-lang/Carp
>>
>>61095976
>stdint.h
>useless

enjoy #ifdef hell
>>
File: i have no idea what im doing.jpg (24KB, 460x333px) Image search: [Google]
i have no idea what im doing.jpg
24KB, 460x333px
I have been working on a TSP program using lexicographic ordering (similar to Daniel Shiffman's examples) and I was trying to push the performance of the program. At first I was calculating distance using the distance formula through each iteration. So I decided to first create a table of precalcualted distance values for each set of points. I decided to test it.
The program generates 9 random points and calculates the distance of all 362,880 possible paths where all points are met, the first program used the distance formula at each step, the other used the precalculated distance array.
The distance formula program averaged 27.18s to work through 362,880 possible permutations of a set, while the distance table averaged 27.173s.
Can someone explain to me why a reference to an array provides only a 0.025% improvement over calculating the distance formula
>>
>>61095161
because they know c++26 will be haskell anyways
>>
File: 1490567253965.png (2MB, 1079x1399px) Image search: [Google]
1490567253965.png
2MB, 1079x1399px
>people who don't know nor use language X talking shit about language X
I FUCKING LOVE THIS MEME!
>>
>>61095331
>muh "fun cktars"
>>
>>61095229
First day on 4chan?
>>
>>61096259
Memory is slow REALLY slow, I guess you acces the array randomly and the array is big so cache doesn't help
>>
>>61096287
>muh "funk chuns"
>>
https://www.drupalconfessions.org/

>major PHP project contributor is publicly ostracized after they find out he's a gorean

I wonder what'd happen if these people somehow find my /d/ folder...
>>
>>61096662
I couldn't care less about what he thinks about while masturbating.

Him being a PHP project contributor, however, is a big red flag.
>>
>>61096662
>why would you be contributing to SJW project in the first place? They can't do anything to you if you program in C.
>>
best book to learn python if im already somewhat proficient in c++?
>>
>>61096737
They'll try to get you to rewrite your shit in Rust
>>
My team manager recently decided to require us to use Java "best practices". He's now demanding to know why we're going so much slower, and why there are more bugs.
>>
>>61096783
SICP
>>
>>61095286
My waifus.
>>
>>61095286
Except Sepples is complete garbage.
>>
I'm testing my /dpt/ bot:
C++ is for brainlets, POO IN LOO
>>
File: effectivec++.jpg (73KB, 663x828px) Image search: [Google]
effectivec++.jpg
73KB, 663x828px
Just got this book, /dpt/

Goodbye Haskell, I'm going to be a real programmer now!
>>
>>61096834
twitter.com/dpttxt

Use it to train your AI
>>
>>61096871
>
>>
File: C9HYIAqXUAEbYlb.jpg:large.jpg (96KB, 736x1020px) Image search: [Google]
C9HYIAqXUAEbYlb.jpg:large.jpg
96KB, 736x1020px
>>61096904
my sides
>>
>>61094702
I wanted to be a code monkey but accidentally git good and now im depressed because I realize all the things I dont know
>>
Moving from Scala to C#. Where is the monad transformers library?
>>
File: 4k.jpg (584KB, 3840x2160px) Image search: [Google]
4k.jpg
584KB, 3840x2160px
>>61096904
>and real macros
We get it already, you're homo(iconic).
>>
Are JS switch statements good for anything other than matching strings?
>>
>>61094702
I'm a sadomasochist learning frontend libraries and frameworks like Reactjs, Bootstrap, Sass. I hate web development, the ecosystem is shit. But I need a job.
>>
>>61096021
with io : wl("Hello World")  


--explicit version
md hw
ent with io : wl("Hello world")


--verbose version
md hw

--function
wl is wl("Hello World")

ent with io : wl
>>
>>61097048
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/switch

all the tricks you need to know
>>
>>61097239
oh cool. thanks
>>
>>61097239
switch (true) {
case isNaN(a) || isNaN(b):
console.log('NaNNaN');
break;
case a === b:
console.log(0);
break;
case a < b:
console.log(-1);
break;
default:
console.log(1);
}

WTF am I reading?
>>
>>61094702
posted this in response to someone in the rust hate thread, but it died before i finished. i think it might still be nice for non-C++ users, so here is it:
----------
C++ ultimately allows you to do less with no efficiency drawbacks (most of the time, and when there are, you can revert to C).
templates allow you to define many functions/classes with what seems to be just one definition. compilation is longer, but the codebase is smaller. more generally, they allow you to be more generic.
object oriented programming is another benefit, although improper use and/or blindly abiding by "design patterns" will result in awful code and awful programs.
the standard library is another one of C++'s main selling points, growing beyond the STL of years past. containers, concurrency API, algorithms, etc. really help you program what you want without necessitating that you get caught in the details.
on that note, both new language features (lambdas, some C++17 stuff) and standard library features are making C++ a more viable tool for functional programming.
there are other things, but the final thing i like about C++ is how it's continuously evolving. each new iteration brings lots of neat new things to the language.

it's easy to misuse C++; one of its biggest drawbacks is probably that there are too many ways to do one thing and novices are probably doing it one of the wrong ways. if you're transitioning over from C, i recommend against forcing yourself to use C++ paradigms like RAII or conventional boilerplate. keep programming in C, but read professional articles about C++ and pick up tools as you need them - you'll see where RAII and the other things are useful in due time.
>>
>>61095860

I write C for a living and you're full of shit my guy
>>
>>61097260
An example where the switch evaluates expressions like (a === b) and compares it to true.

Are you blind?
>>
>>61097277
>I write C for a living and you're full of shit my guy
C is embed and it's C89. Modern "C" applications are less and less common today, they are replaced by C++. What you're doing is the 1%.

By the way you suck if you really think that those features are not useless.
>>
writing a noscript friendly dynamic chat server that uses http long polling to get new messages without having to refresh the page or resort to iframes
>>
>>61097376
>how to spot someone who doesn't know shit about what he's talking about, 101.
>>
>>61097399
Whenever I write C I'm just doing things by hand or with macros that are much easier and safer in C++. Things like RAII and templates.
>>
>>61097391
good lad
>>
>>61097376

I do embedded software and its c99 and c++14 :v)
>>
Do people here really think kotlin is shit or are you just meming?
What's a better JVM language then? No lisp shit
>>
>>61097514
Scala > Kotlin

Kotlin is essentially a dumbed down Scala for people who can't cope with full Scala
>>
File: 3c0.jpg (188KB, 650x650px) Image search: [Google]
3c0.jpg
188KB, 650x650px
>>61097399
>>
File: 1497123824494.png (56KB, 370x370px) Image search: [Google]
1497123824494.png
56KB, 370x370px
>>61097524
I don't even know what you where arguing about, I just call out niggers when I see them.
>>
>>61097514
>What's a better JVM language then?
Clojure, or even better, a non-JVM language.
>>
>>61097531
meh, just baiting for reactions, cute girl btw
>>
>>61097514
>meming
>>>/v/
>>
>>61097521
>Scala > Kotlin
If this is true then Kotlin is pure shit since Scala itself is complete garbage.
>>
>>61097521
Shame it will never be viable for android. Android is the reason kotlin is relevant right now.
>>
File: yukari_shush.png (178KB, 349x273px) Image search: [Google]
yukari_shush.png
178KB, 349x273px
>>61095860
>>61097376
>>
>>61094702
Is there a way to drastically reduce your IQ somehow? I need that to get some special privileges concerning education. I already started playing video games.
>>
File: 743.png (167KB, 256x384px) Image search: [Google]
743.png
167KB, 256x384px
>>61097376
>embedded C
>msvc compiler
>>
File: IMG_20170626_161834.jpg (880KB, 4160x3120px) Image search: [Google]
IMG_20170626_161834.jpg
880KB, 4160x3120px
Diploma just came in.

Bull Shit
More Shit
x Piled Higher and Deeper
>>
>>61097625
What do you expect when Google is picking the officially supported languages?
>>
>>61097646
Congrats!
>>
>>61097646

Checkmark unicode character removed from post. Goddammit 4chan.
>>
File: brain-damage.jpg (87KB, 953x960px) Image search: [Google]
brain-damage.jpg
87KB, 953x960px
>>61097524
>claims everyone uses c89
>defends the shitty visual C compiler
>claims other posters are in damage control
>your dmg control image macro represents your own posts
>>
>>61097680
im not even that dude, i sent a random reaction to trigger someone, seems it worked
>>
File: css.png (110KB, 772x586px) Image search: [Google]
css.png
110KB, 772x586px
I feel like he gave me something really helpful but I don't know what to do with this information:

body {font-family: MS pgothic !important;}

where do i put this?
>>
python is such a pain the ass in the lamest ways possible
>>
>>61097689
>I was just baiting

Is this the new ebin version of pretending to be retarded?
>>
>>61097751
Whatever soothes your butt I guess
>>
>>61094992
codelite is my go-to for c++, good VS-like gdb/lldb frontend
>>
>>61097731
Python is the brainlet language, stop using it.
>>
>>61097633
You should try watching Buzzfeed, and popular youtubers.
>>
>>61097646
Master Of Science, cool title
>>
>
std.datetime has been split into a package.
std.datetime is now a package containing the following modules:

std.datetime.date
std.datetime.interval
std.datetime.stopwatch
std.datetime.systime
std.datetime.timezone


I dont understand why they didnt just split it into std.date and std.time, desu.

Why are programmers so devoid of logic sometimes.
>>
>>61097888
>date and time

What's the difference?
>>
>>61097918
Date: 27 June 2017
Time: 00:55 GMT
>>
>>61097929
Time is obviously part of the date, even though you can choose to look at it in isolation.
>>
>>61097918
What you would think it would be.
calendar shit vs time shit
>>
>>61097963
This is time specifically, i.e. time in the context of "date and time", not the abstract concept of time
>>
>>61097888
Link
>>
>>61098013
http://dlang.org/changelog/2.075.0.html
>>
>>61097965>>61098007
There's an abstract concept of time. I imagine it as a real number that counts from negative infinity to positive infinity. Every number describes some state of the universe.

Dates and times are just a way to encode abstract time, just like character encodings represent abstract graphemes. The 24 hour day and 365 day calendar make astrological sense and are historically significant. Even so, there are many calendars out there. Also, these things are 100% defined by politics; the governments of countries literally go out and decree daylight savings time will be in effect for some time period. The tzinfo database has a shit ton of exceptions to the rule recorded in their repositories.

What you're probably referring as a "separate" time is probably just a time duration, counting from some zero time to a given time on the clock, a way to encode and specify an amount of abstract time. Not a way to refer to a specific point in time. Is this accurate?

The above is easily expressed in SI using seconds as unit, but since the value would become large and nobody uses standard SI prefixes for time, it is often converted to hours:minutes:seconds format in a way that hours isn't bound to the 24 hour clock, so that you can specify for example 2000 hours. It's also common to also be able to specify amounts in months, years, effectively reusing the point-in-time date/time format.

These abstractions are fundamentally mixed, but they fulfill different purposes: predicate testing and counting, respectively. Calendars are frameworks for logical propositions in everyday life: "a month from now X will happen". Time durations are useful for counting: "mark. <some time later> how much time elapsed?", and "every X hours I must do something"
>>
>>61098165
Nothing you say in this post is of consequence to >>61098007.
>>61097929 remains ture
>>
>>61098165
It can be shown that time does not exist.
>>
>>61098201
Surely time can't be shown if it doesn't exist
>>
File: Yakumo.Ran.full.1170052.jpg (359KB, 1000x1000px) Image search: [Google]
Yakumo.Ran.full.1170052.jpg
359KB, 1000x1000px
>>61098165
>real number
>counts
>from negative infinity to positive infinity
I honestly have never seen such a mathematically illiterate sentence in my life.
>>
File: 1489367033508.jpg (92KB, 1280x720px) Image search: [Google]
1489367033508.jpg
92KB, 1280x720px
>>61098213
Correct. Time itself can't be shown to exist.
>>
>>61098227
I've fapped to Ran multiple times and you can't stop me
>>
>>61098227
your waifu a shitsune
>>
>>61098165
>""negative infinity"" to ""positive infinity""
Brainlet detected.
>>
>>61098227
Shit taste
>>
>>61098227
>I honestly have never seen such a mathematically illiterate sentence in my life.
You should read this thread more often.
>>
>>61098282
This specific thread? I've seen dumber /dpt/s
>>
>>61098243
>>61098244
>>61098260
Stop that! This is a Christian imageboard.
>>61098282
Most retarded things said on /dpt/ are about programming though. Sure sometimes that stupidity seep into math but this is the worst shit I've ever seen.
>>
>>61098182
Wrong.

If you want a specific point in time, then writing a time without a date is insufficient information. 24 hour day is naturally periodic, so there are as many "00:55 GMT" points in time as there are days.

It is also incorrect to refer to a time duration as "00:55 GMT". A timezone has absolutely zero bearing on the amount of time that is being specified; it is only useful when comparing the time to another equivalent time in another timezone.

>>61098201
Maybe, but it is an useful abstraction.

>>61098227
>>61098252
>your post designed to be easily understood isn't mathematically sound

>>>/sci/
>>
>>61098327
it's not even easily understood, it's the ramblings of an acid user
you failed on both fronts
>>
windows retards - which is the most comfy for development:

>dual boot to linux
>virtual machine
>MSYS2
>>
File: fatty.jpg (73KB, 850x971px) Image search: [Google]
fatty.jpg
73KB, 850x971px
>>61098306
FAT
>>
>>61098327
You're just an idiot desu lfoma
>>
>>61098296
>This specific thread?
These threads.
>>61098306
Someone here was claiming that it's an open problem whether or not "integers are real numbers".
>>61098327
>designed to be easily understood
"pop-sci" is cancer. And even if it somehow wasn't, your posts being ""easier to understand"" isn't worth much if they are puke inducing.
>>
>>61098382
Buy a cheap laptop desu.
Have one for Debian and freebsd
>>
>>61098384
Wow, she should lose some fucking weight
>>
>>61097929
Also, just saying "27 June 2017" refers not to a specific point in time but to a time range: the entire 24 hour period of that day. In software, it is usually interpreted as 27-06-2017 00:00:00, a completely different notion.
>>
>>61098401
>implying you wouldn't tap that
>>
File: ran_situp.webm (938KB, 640x480px) Image search: [Google]
ran_situp.webm
938KB, 640x480px
>>61098384
>>61098401
Found the low test betas.
>>61098396
>Someone here was claiming that it's an open problem whether or not "integers are real numbers".
That can't be real.
>>
>>61097633
vodka, duh
>>
>>61098421
They*
>>
>>61098227
>>61098306
>>61098396

so what exactly is wrong?
>>
Strong static typing is a productive feature of a programming language.


Y/N?
>>
File: smug_ran5.png (325KB, 529x735px) Image search: [Google]
smug_ran5.png
325KB, 529x735px
>>61098442
>so what exactly is wrong?
1. You can't count the real numbers.
2. Real numbers don't include neither the positive nor the negative infinity.
>>
>>61098473
Emphatically yes.

See https://www.youtube.com/watch?v=3U3lV5VPmOU
>>
>>61098442
to start:
given a real number x, what number comes after that?
>>
>>61094768
define a generic, non failing getter that returns an empty string instead of throwing an exception
>is there a better way?
if you have to ask, there always IS a better way
>A million try/excepts looks like garbage
it does
>>
>>61098473
>Strong
If it's too strong, it just gets in the way.
I like weak static typing around the same level as C. You can give the middle finger to the type system when you need to, and you don't have to asinine shit like explicitly casting a u32 to a u64.
>>
What exactly is the purpose of xalloc in C++?
>>
>>61098473
yes.
type driven development is the future, desu.
>>
>>61098546
>Returns a unique (program-wide) index value that can be used to access one long and one void* elements in the private storage of std::ios_base by calling iword() and pword().
>The call to xalloc does not allocate memory.

Something really fucking stupid.
>>
>>61098483
>>61098500

1. he just meant that time can be one number in that infinite set
2. he just meant that time is infinite both backwards and forwards
>>
stop arguing with noio-kun.
>>
>>61098608
>noio-kun

who?
>>
>>61098624
1. io is bad
2. all c influen[...]

Its the same guy, he just likes to argue.
>>
>>61098570
>saying "he" to make it look like someone else agrees with you
time is discrete
time is not "infinite both backwards and forwards"
>>
>>61098633
>1. io is bad
Depends on what "IO" means.
>2. all c influen[...]
Correct.
>>
If you guys want to study what great Date/Time software looks like, Java 8's new libraries are great and really simple.

http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html
>>
What's the best way to learn C design patterns?
>>
>>61098649
Thanks, Reyansh! 2 Rupees have been deposited into your Oracle® Java® Account™!
>>
>>61098670
C has design patterns?
>>
>>61098641
>time is discrete

you can have time as small or as big as you want, it has infinite resolution

a real number is perfect for this
>>
>>61098670
not at all
>>
>>61098678
>a real number is perfect for this
Can you count time?
>>
>>61098673
>>61098679
>he thinks design patterns don't exist in every language
>>
>>61098670
>C design patterns
You're going to need to be a lot more specific than that.

>>61098673
Not """design patterns""", but there are common techniques that are used to handle certain situations in a clean way.
One off the top of my head is the "goto cleanup".
if (!aquire1()) {
goto error1;
}

if (!aquire2()) {
goto error2;
}

if (!aquire3()) {
goto error3;
}

// Do some work

release3();
error3:
release2();
error2:
release1();
error1:
return;
>>
>>61098703
by definition design patterns as a phenomenon are not located within languages

this doesn't mean it isn't a stupid concept or one so stupid it is unworthy of acknowledgement or existence

it is a non concept
>>
>>61098473
correct
>>
>>61098473
Python is the easiest language to be productive in, so no.
>>
>>61098713
that's retarded
you're going to face very different design problems when programing in C than when programing in Haskell
similar languages will share similar design patterns to the extent that they are similar
>>
>>61098670
Read Linux/BSD source every day
>>
>>61098678
>you can have time as small or as big as you want
prove it
>>
>>61098754
>Python is the easiest language to be productive in
this is a myth. have you ever maintained someone else's python program?
>>
>>61098757
different => not a pattern
>>
>>61098695
>>61098771
https://en.wikipedia.org/wiki/Temporal_resolution
>>
>>61098775
incorrect
>>
>>61098799
ah i see you're using the "making a false post" pattern
>>
>>61098772
No, he probably just rewrites it from scratch and misses the corner cases
>>
>>61098790
did you even read that article? it contributes nothing to your stupid point
>>
File: Screenshot_2017-06-26_20-08-58.png (244KB, 625x374px) Image search: [Google]
Screenshot_2017-06-26_20-08-58.png
244KB, 625x374px
My parser is coming along p. damn nicely
>>
>>61098856
Making your own language?
>>
>>61098879
Yep. I'd like it to be ATS, but not gross looking.
>>
>>61094768
Use the entire try / except / else / finally block.
>>
>pointers
how about I point my penis at your face?
>>
>>61099131
I don't think you have a penis.
>>
>>61098649
You mean Joda Time library.
>>
>>61098850
Have you override hashCode in Bird?
Are you using the same instance of bird when you call observations()?
>>
File: Untitled.jpg (137KB, 1920x1080px) Image search: [Google]
Untitled.jpg
137KB, 1920x1080px
help
>>
>>61098646

File I/O is good
Console I/O (stdin, stdout, stderr) is good
Network I/O is good
Peripheral I/O (keyboard, mouse, game controller) is good

What I/O is bad?
>>
>>61099426
not him but it's ok if it's part of a pure programming language
>>
>>61099376
>unhelpful error message
>no debug info
might as well write your own debugger, it will take less time than fiddling with some retarded ide
>>
The kind which steals your Steam games.
>>
>>61099376
That's what you get for using a hand-holding babby IDE lmfoa
>>
um excuse me guys, is this appropriate programming attire?
>>
>>61099431
>a pure programming language
Such as?
>>
>>61099470
Where's your programming skirt dude?
>>
Watching SICP and they're doing type tags by hand, this could be done statically at compile time with typeclasses
>>
>>61099470
Ruby on left
>>
>>61099454
This
>>
File: 1498519243149.png (4MB, 1920x1080px) Image search: [Google]
1498519243149.png
4MB, 1920x1080px
>>61099509
I usually do (static) type-checking and optimization by hand. Can't trust a machine for that.
>>
>>61099431

I/O is good regardless of whether the programming language it is part of is pure. Remember: all of your I/O boils down to impure assembly anyways.

>>61099470

No.

>>61099520

Not my style.

>>61099539

Machines don't make mistakes. They do exactly what you tell them to every time.
>>
>>61099470
only if you'll move the line of the panties so your hole is revealed
>>
Just fixed a problem that I've been pulling my hair out over for the past few days.
It was with threading and database concurrency and not being able to insert/update in one function and see the update in another thread's function. At least it works now.

>threads are hard. even harder when you're dumb
>>
>>61099585
>Machines don't make mistakes.
This would require a deep understanding of physics which nobody has yet.
>>
>>61099585
https://en.wikipedia.org/wiki/Single_event_upset
>>
>>61094702
How would /g/ add 2 numbers without using the + operator?
>>
>>61099690
Which numbers? And what is an ``+ operator"?
>>
>>61099690
a - (0 - b)
>>
>>61099690
int add(int a, int b){
int sum = a^b;
int cum= (a&b)<<1;
while(cum){
a=sum;
b=cum;
sum = a^b;
cum= (a&b)<<1;
}
return sum;
}
>>
>>61099690

log(pow(2,a)*pow(2,b))
>>
>>61099690
add a b = a - (0 - b)
>>
>>61099707
>while(cum)
>>
File: aaaaaaaa.png (5KB, 238x212px) Image search: [Google]
aaaaaaaa.png
5KB, 238x212px
So I started learning java because thats the most used language.
I read through Think Java, made couple of things in java as exercise, like basic 2d physics using ascii graphics.
I probably got my basics down.
Can anyone point me in the right direction so I learn correct design patterns and don't write code like a Poojeet?
I tried to get into Effective Java but that stuff is way too theoretical and have no practical experience to tie it to.
Also any ideas for exercises and where to start with them?
>>
>>61099735
>So I started learning java
>don't write code like a Poojeet

Sorry but you're a Poojeet now.
>>
>>61099707
cum is bad word in English,pajeet
>>
File: 1435860966530.jpg (13KB, 215x358px) Image search: [Google]
1435860966530.jpg
13KB, 215x358px
>>61099744
no memes please this is serious business
>>
File: Jshit.jpg (210KB, 1024x768px) Image search: [Google]
Jshit.jpg
210KB, 1024x768px
>>61099760
>>
>>61099735
you just gotta write a lot of programs man
>>
>>61099735
>"""design patterns"""
>don't write code like a Poojeet
What did Rajesh mean by this?
>>
>>61099777
I can stitch together code, that's not really an issue, java is not my first lang.
>>61099780
thank you for the fresh java memes, they smell like designated shitting street
>>
>>61099797
>they smell like designated shitting street
So you know how a designated shitting street smells like?
>>
>>61099735
>java
>"learn correct design patterns"

sorry dapeek, it's too late for yoyu
>>
>>61099805
ofc
I can code in Java
>>
Is there any way to tag a recursive function in Elixir so the compiler will notify you if it doesn't get tail call optimized during compilation?
>>
>>61099616
Who are you quoting, pal?
>>
>>61099797
>can stitch together code

So you copy n paste everything....
>>
>>61099945
So you type like a redditor...
>>
>>61100048
>implying you can see me type
>>
>>61100093
>implying a 1337 hax0r like me can't hack into your ip mainframe and look at you through webcam
lmao @ this foolish mistake
>>
normie here, any recommendation on html5 game development tutorials/books? i want to know how the game loop should be implemented
>>
>>61100244
>html
>game dev
Huh? You mean a game that runs in the browser, or a game written in html?
>>
>>61100244
There's a million and 1 ways to create a game in HTML5

https://www.babylonjs.com/

https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API

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

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

etc
>>
>>61100263
Not him, but the term "HTML5" more generally includes JavaScript updates for manipulating HTML5 elements. That's generally what people mean when they talk about developing HTML5 apps.

It's mostly a buzzword.
>>
I utilize a thread pool for concurrency but my worker_thread class is fucking massive because it does literally everything.
It works but its ugly as fuck
What do
>>
>>61100341
post code
>>
>>61100341
If that's a problem in your scenario then I'd imagine the obvious solution is to make them more specialized.
>>
>>61100341
you could try composing your worker_thread class out of multiple private nested classes that have their own responsibilities and are implemented in their own files
your code on the whole would become like twice as massive but it would be prettier and also it would feel smaller because each individual file would be smaller
>>
>>61100341
what language, lad?
>>
Have you tried using Frognol?
>>
>>61100506
dumb languageposter
>>
Should I learn clojure? Seems like a meme.
>>
>>61100630
Sounds like someone hasn't tried Frognol.
>>
>>61100639
>meme
>>>/v/
>>
>>61100244
>html5
>how the game loop should be implemented
in c
>>
>>61099707
This is actually very useful when writing fast constant time crypto implementations.
>>
>>61095286
Ada?
>>
File: smug_ran.jpg (632KB, 709x1063px) Image search: [Google]
smug_ran.jpg
632KB, 709x1063px
>>61099690
ln(exp(x)*exp(y));
>>
>>61100639
i you want a lisp that can JVM.
Otherwise, no, lisp is shit.
>>
>>61099690
Of course,
let (x, y) = (12, 13);
let sum = x.wrapping_add(y);
>>
>>61100506
Dumb frogposter
>>
>Jai's first class type syntax is already verbose nonsense
RIPIP
>>
NEW THREAD!!

>>61100986
>>61100986
>>
>>61100506
Never heard of it.
>>
>>61100752
That's not constant time. You need "while(--max_num_of_bits){}" to make it insensitive to a and b.

101010101
+
010101010
runs 0 iterations

1111111111
+
000000001
runs 9 iterations
Thread posts: 323
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.