[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: 23
File: fizzbuzz of the christ.png (402 KB, 1024x768) Image search: [Google]
fizzbuzz of the christ.png
402 KB, 1024x768
verbosefags not allowed edition
>>
>>52353941
kill yourself

so you wrote "fizzbuzz of the christ" what an accomplishment
>>
>>52353965
no need to be blasphemous anon
>>
>Posted before the bump limit
>Not link to old thread
>Meme snake
Delete this thread and kill yourself
>>
print("\n".join(["fizzbuzz" if x%15==0 else "fizz" if x%3==0 else "buzz" if x%5==0 else str(x) for x in range(1,101)]))


I-is this to verbose senpai?
>>
Nothing atm.

Can't think of anything to make.
>>
>>52353941
are we seriously arguing about fizzbuzz jesus christ
>>
Python is bad and you should FEEL bad!
>>
>>52353981
yes
>>
>>52353981
>he posted it twice
>he's trying to get praise for a fizzbuzz on /g/ instead of doing something useful

time to rethink your life
>>
>>52353991
they're saying >>52352868 is """"""""verbose"""""""" compared to other fizzbuzz implementations
>>
Beginners post fizzbuzz (or if you still have a fizzbuzz from when you started out, post that)

        private async void btnRun_Click(object sender, RoutedEventArgs e)
{
for (int i = 1; i <= 100; i++)
{
string Output;
if (i % 15 == 0) { Output = "FizzBuzz"; }
else if (i % 3 == 0) { Output = "Fizz"; }
else if (i % 5 == 0) { Output = "Buzz"; }
else { Output = i.ToString(); }
lstOutput.Items.Add(Output);
lstOutput.SelectedIndex = i - 1;
lstOutput.ScrollIntoView(lstOutput.SelectedItem);
await Task.Delay(500);
}
}


>Even if I could one line it, I wouldn't.
>>
>>52354005
Th-thank y-you very much mi-mister
>>
>>52353434
Anyone?
>>
>>52353899
Posted this in the last thread, but does anyone have experience preprocessing csv's and parsing text with VBScript? Would it be as horrible as it sounds?
>>
One liners are shit if you intend your code to be read (and maintained by others). If it's a "make the most conciest code which makes X" type of challenge it's ok, but elsewhere... it's stupid.
>>
>>52354022
it's very fucking verbose
>>
>>52354022
It does look like it. You could probably either:
1: slice it and choose i if the slice is empty or
2: check if the number isn't 0 when doing mod 3 or 5 then print i, otherwise print the sliced version

No need to do all those checks
>>
>>52354065
>not sharing your cheeky one-liners
do you hate fun?
>>
>>52354069
it's very fucking standard and the others aren't better in any way except for using fewer bytes of source code
>>52354072
>slice
kill yourself
>>
When will hasklel finally have a non-shit AD or SD library?
>>
>>52354065
this

>>52354085
doesn't mean normal solutions are shit
>>
₣ÏŽŽßŪŽŽ
>>
>>52354086
>kill yourself
It's the verb term used for substrings. Do you have a preferred verb for it? If so, imagine I posted that
>>
Reminder that OCaml is the GOAT language and nothing you say or do can change that.
>>
>>52354055
https://docs.python.org/2/library/csv.html

>>52354085
I'm talking about projects shared in github or made at work, mostly. Don't expect most to understand one-liners.

I'm okay if it's fun but don't expect everybody to understand what it does.
>>
>>52354096
It might help if you didn't use meaningless acronyms.
>>
>>52354065

[|1..100|] |> Array.map function
| MultipleOf 15 -> "FizzBuzz"
| MultipleOf 5 -> "Buzz"
| MultipleOf 3 -> "Fizz"
| x -> string x
|> System.Console.WriteLine
>>
>>52354119
Implying OCaml is not just a stupid and useless C wrapper.
>>
>not just importing fizzbuzz
>>
>>52353990
>File Deleted
Ha, I thought it was a bit too lewd.

She was in a bikini though.
>>
>>52354108
>doesn't mean normal solutions are shit
nobody is making that claim

>>52354120
>don't expect everybody to understand what it does
none of the one-liners we've ever posted were ever complex
>>
>>52354122
looks literally retarded
>>
>>52354122
oops
|> Array.iter System.Console.WriteLine
>>
>>52354065
>One liners are shit if you intend your code to be read (and maintained by others)

>I'm serious ENTERPRISE programmer
>readability and maintainability is everything
>especially on scripts that are fucking on line
>>
>>52354122
>System.Console.Write
who comes up with these names?
>>
>>52354143
>I'm used to code that makes me throw everything away to slightly change functionality

>>52354159
(printfn "%A") is an alternative
>>
>>52354133
I laughed!
>>
>>52354159
well you are accessing the console from the system and then writing to it
>>
File: 1278813155815.jpg (3 KB, 126x126) Image search: [Google]
1278813155815.jpg
3 KB, 126x126
>doing a c programming course
>exam in 2 days
>have to understand memory pointing/pointers
>I literally cant grasp the concept
>tried bashing my head to various tutorials
>exam creeping up
>feeling literally retarded
Am I too stupid to live? Should I end it?

Can anyone help? (I dont blame you if you just tell me off and tell me to kill myself instead)
>>
>>52354121
If you weren't retarded, you'd know it stands for automatic and symbolic differentiation and that there's even a (very shitty) hasklel library named simply "ad".
>>
>>52354120
>https://docs.python.org/2/library/csv.html
I know how to do it in python, but the computer's at my office don't have the runtime installed and I don't know if I can convince IT to let me install it on my computer. I want to know if it can be done in VBScript relatively easily so I wouldn't have to install anything.
>>
>>52354142
I'm not talking about this thread, get some reading comprehension.

>>52354151
When you program for/with others, expect people to know better or worse than you. Don't go full leet or full noob, take a middle ground.
>>
>>52354193
http://www.dummies.com/how-to/content/basics-of-pointers-in-c-programming.html

>Memorize this sentence: A pointer is a variable that contains a memory location.
>>
>>52354118
you shouldn't need to use substrings for fucking fizzbuzz. do you have any idea how slow that is vs using string literals? fucking pisskid
>>
>>52354193
Every place in memory has an address

A pointer simply stores that address
>>
>>52354206
>When you program for/with others
Because you need 10 Pajeets to write one line of code?
>>
>>52354225
I havent tried this

I will read it and try to fist my brain with the concept.

>Memorize this sentence: A pointer is a variable that contains a memory location
I know this much, I just fail to grasp the application of it.
>>
>>52353774
>Parentheses, just like any other similar form (f g x -> f (g x))
which is literally the same thing as braces would be
>let fn (x:Int32) (y:Int32) : Int32 = Int32.add x y
that's not the same thing. i could do
let fn : Int32 -> Int32 -> Int32 = Int32.add

just as easily (or even use fun -> there to name the arguments). that makes the line longer and doesn't work as well for any type system slightly more complex than OCaml's (i.e. for dependent typing, where would implicit arguments go?)
btw i'm not trying to hate on OCaml here, I'm just saying that the ML syntax is very specific to the semantics of MLs and doesn't carry over well to other types of languages
>>52354133
lol okay kid
>>
>>52354228
>slow
>fizzbuzz
tippity toppity kek
>>
>>52354172
>>I'm used to code that makes me throw everything away to slightly change functionality
what the hell does that even mean? are you saying it's impossible to write reusable code in other languages?
>>
>>52354181
1 point for me.
>>
Can you even write FizzBuzz in one line in Java?
>>
>>52354245
No, if you're tasked to write some function(s) and Pajeet is expected to write functionality that uses those function(s) he should understand without the need you explaining a one-liner because it's "concise and looks better".
>>
>>52354271
He's a baby duck F# fag.
>>
>>52354193
A pointer literally is a variable containing an address to a location in memory. The type of a pointer indicates which data type is being stored at the location in the pointer.
>>
for(int i=1;i<101;++i)
cout<<(i%15?i%5?i%3?to_string(i):"fizz":"buzz":"fizzbuzz")<<endl;


see, i can play this game too. doesn't mean that it's sensible to program in this way.
>>
>>52354271
I'm saying that what you call stupid is significantly more reusable than other styles

>>52354289
>F# is shit
ok
>>
>>52354193
http://duramecho.com/ComputerInformation/WhyCPointers.html

thank me later.
>>
>>52354315
Why don't you use OCaml proper? You'll certainly like it more if you like F#.
>>
>>52354251
>that makes the line longer
Then put it in an interface instead.
>doesn't work as well for any type system slightly more complex than OCaml's
Bullshit.
>for dependent typing, where would implicit arguments go?
After the type, obviously.
>>
>>52354309
the difference is in some languages you can make it shorter, neater and easier to read
>>
>>52354250
>I just fail to grasp the application of it.
Let's say you have 10 people standing in a circle. One of them is "it". With whoever is "it", they lose $1 and has to choose another person to be "it". That's like how pointers work, you don't always know what you're pointing at, but you can do things to variables and objects that you find yourself pointing at.

In a game (let's ignore design patterns for now), I might want to move to the nearest enemy. Once I find it, I want to have a pointer variable that can reference that enemy for moving to. This can change any frame
>>
>>52354151
some people work on things other than writing python scripts to brag about online
>>
>>52354193
pointer points to a variable just like an address points to your house
>>
>>52354329
There isn't a good enough IDE
>>
>>52354355
and some people work in agile environments or challenging environments where such things are useful
>>
>>52354340
just because it's shorter doesn't mean it's neater. a kiddy book is short but most adults have no use for reading kiddy books.
>>
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
>>
>>52354365
is it possible to destroy that pointer pointing to my house so I can't be traced?
>>
>>52354373
literally fuck off to >>>/g/wdg
>>
>>52354368
>this M$ VS baby trying to lecture people on what good languages are
>>
>>52354251
Actually, it would work fine for dependent types with implicit arguments.
let id {a : Type} (x : a) : a = x

I vastly prefer Haskell syntax, though, which most importantly lets you declare something's type before defining it, and I like the whitespace/brace+semicolon compromise.
>>
>>52354386
using python == coding
>>
>>52354386
Wizard > Software Alchemist
>>
>>52354402
lmao get a job pal
>>
>>52354394
No, not since C99.
>>
>>52354394
enjoy your memory leak lmao
>>
>>52354394
yeah just bore a hole into your RAM at the exact location where that pointer is
>>
>>52354427
you'll be obsolete within a decade webcuck
>>
>>52354379
Good thing I didn't say that, I said it could be all three at once

>>52354405
What's your fucking problem?
>>
>>52354420
module type S = sig
val id : a -> a
end
module M : S = struct
let id x = x
end

It can be declared in advance like this. Even better, it can be split between a .mli (interface file) or .ml (implementation file). This is useful in particular to have documentation separate from the implementation, so that you have 500 lines of implementation, and a separate 500 lines of interfaces and comments, making browsing either much easier.

It's still true that the inline syntax for haskell is better though.
>>
>>52354425
Computer Magus > Wizard.
>>
>>52354394
if you move your house you'll get a dangling pointer

delete the pointer and you're leaking memory
>>
I don't know why I'm programming in racket or reading sicp anymore, think I should just go back to haskell
>>
>>52354525
Arch-Linux > Arch-mage
>>
>>52354535
I call it the 'engine' because it's not strictly related to the application on top of it and provides the functionality I'd need for multiple things(game things, but not necessarily)
framework maybe would've been a better name but who cares really
>>
>>52354489
writing off a language because "There isn't a good enough IDE" is pretty loathsome, m8
>>
>>52354331
>Then put it in an interface instead.
that's both inefficient for the programmer and the compiler to go back and check the other file to find something that can't be inferred.
>Bullshit.
even once you start dealing with relatively simple things like type classes it becomes a pain in the ass having to balance putting the type annotation either in a different file or stuffing the information into a single line along with the rest of the function and its arguments, etc. interface files are okay for some things but there's a reason why Haskell lets you do it right above the definition
>After the type, obviously
wat
how could you put it after the type if the type that comes before it depends on the value of the implicit argument?
>>52354368
Emacs + Merlin
>>52354420
yeah but what i mean is the line becomes crowded as fuck once you start putting the type annotations as part of the declaration like that. eventually you'll end up with shit like
let map {a : Type} {b : Type} {t : Type -> Type} (f : a -> b) (x : a t) : b t = function
(* ... *)

and that's already above 80 chars.
>>52354502
for dependent typing the type annotations are not just for documentation, but mainly because some type inference is literally undecidable without them. splitting up between files would be a huge pain in the ass and would slow down the compiler a lot because of the extra IO operations etc. putting the module type right above is _okay_ but it still doesn't put things in the place that takes the least thinking to write. it's not a bad idea to have both, even, because i will admit interface files are awesome for documentation. it's just not optimal for when you actually have to write out the code yourself
>>
>>52354616
>yeah but what i mean is the line becomes crowded as fuck once you start putting the type annotations as part of the declaration like that.
Fair enough.
>>
In C, it is possible to know when a variable goes out of scope?
>>
any good guides to callback-oriented programming
>>
>>52354647
Here -> }
>>
File: sls44.png (2 KB, 355x58) Image search: [Google]
sls44.png
2 KB, 355x58
>>52353842
this program gets the numbers of the timeline parallel to ours that has already done the next lottery. the chance of it being the numbers of our lottery isn't that high due to diversion but you should have a higher chance of winning if you play these numbers than random ones. ur welcome : O )
>>
>>52354608
>writing off
Did I say it wasn't a good fucking language?
No, I said that's the reason I don't try it
>>
Is UML just some gay shit IS/business majors like?
>>
>>52354405
Is Visual Studio even good for F#? I tried playing around with it before but the F# repl seemed like shit.
>>
>>52354699
It's really good for F#
Make sure you're using the REPL properly
>>
BeOS master race
>>
>>52354690
I don't know anyone who actually uses them.
>>
>>52354690
never used at either of the two companies I've worked at

I really like the idea of it but it's too inconvenient imo
>>
>>52354690
>gay shit IS
h-hey

dont shit on my feelings ;-;
>>
>>52354690
Good for some documentation, IMO. Pain in the ass to make.
>>
>>52354714
Breast expansion OS? Sounds hot
>>
>>52354661
I meant inside the program. That is, write a program that can tell if a variable is in scope or not.
>>
>>52354690
My c++ professor pushed it often. I think it's just a business cuck language
>>
>>52354677
Woah haha I didn't know C++ could get data from other timelines... thanks friend! =l:^)-I--<
>>
>>52354760
No. For what purpose?
>>
>>52354690
considering how cluster-fucked my company's software is, I'd say it has its uses, conceptually at least
>>
>>52354773
Writing a pointer wrapper who free itself when it goes out of scope.
>>
package main

import "fmt"

func main() {
for i := 1; i < 101; i++ {
if i%3 == 0 {
fmt.Print("Fizz")
}
if i%5 == 0 {
fmt.Print("Buzz")
}
if i%3 != 0 && i%5 != 0 {
fmt.Print(i)
}
fmt.Print("\n")
}
}


Did I do good /g/?
>>
>>52354794
Use C++.
>>
File: 1451751832808.png (17 KB, 418x359) Image search: [Google]
1451751832808.png
17 KB, 418x359
>>52354800
>C++
Looks like we got us some new guys chaps
>>
>>52354799
No.
>>
>>52354799
We'll call you :^)
>>
I'm fairly new to C, give me something semi-easy to write.
>>
>>52354854
Fizzbuzz :^)
>>
>>52354854
Chip-8 interpreter/emulator
>>
>>52354854
transliterate english into canadian aboriginal syllabics
>>
File: 1452438717574.jpg (475 KB, 1920x1080) Image search: [Google]
1452438717574.jpg
475 KB, 1920x1080
>>52354854
knock yourself out
>>
>>52354867
>35 opcodes
sounds more interesting than the 21 opcode python vm I wrote before. I'll try it
>>
>>52354854
cmd line irc client
>>
>>52354854
convert between roman and arabic numerals
print out all the primes to 100,000,000 in under a minute
>>
>>52354690
it's very very gay

the idea of it is okay, like a flow chart so you can communicate a program's design with others. but no, just no.
>>
>>52354938
>the idea of it is okay
not even, because it focuses on planning dumb shit like inheritance over the program's actual logic that's a lot harder to design and more likely to have bugs
>>
>>52354910
it's not about size it's about how you use it
r-right guys
>>
I'm trying to keep track of the number of each possible combination of 2 letters in a given file.
>test sentence
E.G te, es, st, se, en, nt, te, en, nc, ce
So 'te' and 'se' appears twice but everything else only once.

I have a 2d array of size [26,26] and two variable holding the current number and the temporary number, but for some reason when I print the array at the end it is totaling the numbers in a row instead of displaying them individually, so every item in the row displays the total for that row.

These are the two bits of related code:
for (i=65; i<91; i++)
{
for (j=65; j<91; j++)
{
if ((temp == i || temp == (i+32)) && (prev == j || prev ==(j+32)))
{
bigrams[i-64,j-64]++;
}
}
}

and
 printf("     a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z\n");
for (i = 1; i < 27; i++)
{
printf("%c ", (i+96));
for (j=1; j<27; j++)
{
printf(" ");
if (bigrams[j,i] < 100)
{
printf(" ");
if (bigrams[j,i] < 10)
{
printf(" ");
}
}
printf("%d", bigrams[j,i]);
}
printf("\n");
}
>>
>>52354867
he said easy, not 9 levels of hell.
>>
>>52354982
Chip-8 is a pretty simple emulation project m8, it's nowhere near as complicated as shit like the Z80 or 6502 that people write big emulators for
>>
File: 1451621766585.png (285 KB, 800x655) Image search: [Google]
1451621766585.png
285 KB, 800x655
What's the difference between local storage and cookies?
>>
>>52354193
int main() {
// Initialize the pointer variable
char* ptr;

// INSERT BREAKPOINT
// enter the command "p ptr"
// output should be xx00, or the null address
// this is because you initialized the pointer,
// but not set it to anything
// Typing the command "p *ptr", or the value
// at the address the ptr is set to will give
// an error, because that value doesn't
// exist

ptr = malloc(8 * sizeof(char))

// INSERT BREAKPOINT
// The pointer is now set to a reserved piece
// of memory that 8 segments long, each
// segment being the size of one char
// If you type "p ptr" now, you won't see a
// null address, but if "p *ptr" does print,
// the value will be nonsensical because
// it will just be what was residing at the
// address before the program started

strcpy(ptr, "pointer");

// INSERT BREAKPOINT
// Don't worry about strcpy, it just copies the
// second arg to the memory that the first
// is pointing to
// Now, when you type "p ptr" you'll get an
// address, and when you type "p *ptr",
// the char 'p' comes up because the
// address has finally been set by you.
// Do the same thing with "p p+1", "p *(p+1)",
// "p p+2", "p *(p+2)", etc. and you will see
// each character of the string "pointer" in
// sequence.

free(ptr)
// Just "unreserves" the memory. If you
// want, set a breakpoint here and print out
// the same pointer values and you will
// see they haven't changed. They can
// just be overwritten by other malloc calls
// now
return 0;
}


See if this helps, I know I couldn't grasp it until I learned a little bit of gdb and actually saw what was going on with the pointers.
>>
>watching this guy work
>no where near that skill
>5 years of experience
>fucking kill me

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

I know it's sped up
>>
>>52355102
>Shalom
I'm suspicious of him already.
>>
>>52355102
You can't teach yourself autism.
>>
>>52355102
>Bisqwit
This guy is so weird, all his videos where he's actually in them, they look and sound like they're from the 80s.
Also, he's what, a finjew?
>>
>>52355102
Everything about his programming environment makes me want to throw up
>>
>>52355159
throw up dank code
>>
You seen that hackernews post on "How to C in 2016"? Did you like it?
>>
>>52355102
it's okay m8 he's autistic
>>
>>52355130
>>52355159
He has some really cool videos, but the weird it turned up to max.
>>
>>52355102
fucking love bisqwit
>>
>>52355102
In the video, he says the project took him two weeks, with around 3 days of design. He doesnt just sit down and start typing.
>>
>CHIP-8
>hard
literally just 35 opcodes
>>
>>52355193
>portal 2 lets player
into the trash
>>
What's the last language/tehnology you've tried /g?
>>
>>52355302
haskell. Wasn't too bad.
>>
>>52355302
Racket. I like programming in functional style, but I was doing this alongside SICP and the shit in there is hard.
>>
>>52355049
Local storage is a JS API that allows for significantly more space and sophistication in how you store your data. It's entirely client side.

Cookies are associated with HTTP and, while they can be modified by JS, were originally meant for the server to set on the client (without JS) through HTTP headers.

Cookies are a pain to use in general compared to local storage. (when you have the choice of either)
>>
I'm a scrub starting out. What is a reasonable time frame to learn the basics of java?
>>
>>52355102
>>watching this guy work
>>no where near that skill
>>5 years of experience
>>fucking kill me
He doesn't even program for a living.
>>
>http://www.multigesture.net/articles/how-to-write-an-emulator-chip-8-interpreter/
This is pretty tight. Who else is up for emulator programming?
>>
>>52355324

But, not everyone browser uses local storage, and it's fucked if your client has JavaScript switched off (which is unlikely).
>>
>>52355321

So Racket is essentially a LISP dialect?
>>
>>52355302
don't like trying new meme languages tbqh

rather spend that time improving the language I do know
>>
>>52355349
:(
>>
>>52355401

That's not an answer.
And you could have just told us about the new techniques you've had to learn in Java.

Which is obviously your jam.
>>
>>52355390
The way I understand it, SICP uses Scheme, a dialect of LISP, and Racket is closer to that Sceme than the later Schemes are
>>
>>52355353
stepping it up
http://marc.rawer.de/Gameboy/Docs/GBCPUman.pdf
>>
How can I learn game development with SFML and C++? And I don't mean learning SFML's api, I mean learning how to do game architecture and shit like that.
>>
>>52355102
5 years experience for you, or him?
>>
>>52355455
Read Game Programming Patterns by Robert Nystrom. Personally the SICP of game dev for me
>>
>>52355424
really don't like this hate on Java meme

not saying I'm not a poo-in-loo just that java is a decent enough language
>>
File: 1449016502839.jpg (38 KB, 450x267) Image search: [Google]
1449016502839.jpg
38 KB, 450x267
>>52355324
thank you anon
>>
>>52355435
Racket is based off of scheme, and I think the scheme guys are working on it now, but you have to use some special subset of the language to follow sicp with it or else it won't work
>>
File: 1438972291006.jpg (342 KB, 536x640) Image search: [Google]
1438972291006.jpg
342 KB, 536x640
This fucking guy
https://www.youtube.com/watch?v=HQYsFshbkYw
>>
>>52355480
He's right though, he asked a simple question, you gave a pansy answer like a woman

Now then:
DESIGNATED
>>
>>52355493
meanwhile you are arguing about fizzbuzz
>>
>>52355572
>not enjoying a cheeky fizzbuzz in between wanks
>>
>>52355480

Absolutely nothing wrong with Java.
It's just the culture and community.

And it's spreading...

Fast.

Just look at the start of JavaScript.
There's a new MVC library every 4 days now.
Each one has a corresponding website selling branded clothing.

It's fucking stupid.
>>
>>52355577
>not wanking and writing your fizzbizz concurrently
you some kind of bender, boy?
>>
>>52355493
john madden?
>>
I don't understand why anyone in their right mind would use Java outside of being forced to for school/work.
>>
yeah, there's always new frameworks appearing but in Java at least they tend to stick around for while. Learn spring, javaEE and hibernate and you'll be fine.

With javascript the situation is a lot less tenable.
>>
>>52355639
Java 8 is pretty slick.
>>
Is GTK hard to learn?
>>
>>52355455
Skimming a bit through that book made me realize that I should probably brush up on design patterns before I try applying them to game dev.

Any books you can recommend senpai?
>>
File: 1451754656606.png (17 KB, 418x359) Image search: [Google]
1451754656606.png
17 KB, 418x359
>mfw beating the gf cause her fizzbuzz implementation was longer than mine
>>
>>52355670
read
>>52355476
>>
>>52355650
What did they add besides lambdas?
>>
>>52355493
the way he makes it looks so fluid without planning triggers me hard
>>
>>52355676
Is that pic an illustration of what she looked like after you finished beating her?
>>
>>52355455
>SFML
KEKEK
>>
>>52355688
Optional and Streams
>>
>>52355723
>java is actually improving
WOW! In 2 decades it might even be good!
>>
File: 1451779320598.png (20 KB, 418x359) Image search: [Google]
1451779320598.png
20 KB, 418x359
>>52355713
>"mfw" standing for anything else
>>
>>52355730
Java is good now.
>>
>>52355746
nice try sandeep
>>
>>52355730
>C# is good (despite being incredibly "inspired" by java)
>python is good
>haskell is good
>java is unbelievably bad
epic meme
>>
>>52355302
Julia. I used some MATLAB and python before and saw that it's an alternative which can replace them. It's pretty new (0.4 version when I started, like October last year) and powerful programming language.
>>
>>52355762
but anon
3/4 of those are correct
>>
>>52355747
it has a lot of advantages
But i agree Python is the future
>>
>>52355723
That's it? So they just copied LINQ from C# and Maybe from F#?

Reading about Optionals, they seem strange. Kinda seems like a slightly more explicit way of saying "this might be null", even though every reference type in Java can be null.
>>
>>52355762
this
>>52355783
>>
File: uui9.png (481 KB, 626x988) Image search: [Google]
uui9.png
481 KB, 626x988
>>52355324
It was easier to use than I thought it would be.

function downloadImages(folder){
forEach("div.thread a.fileThumb", function(elem, index) {
var url = "https:" + elem.getAttribute("href");
var downloaded = localStorage.downloaded;

var type = url.split(".");
type = type[type.length - 1];

if(downloaded === undefined) {
localStorage.setItem("downloaded", "");
downloaded = localStorage.downloaded;
}

if(types[type] && downloaded.indexOf(url) === -1) {
chrome.runtime.sendMessage({
url: url,
folder: folder
});

localStorage.downloaded += url;
}
});
}


How long does this storage last and what's the max limit? Does it auto delete when it reaches the max limit?
>>
>>52355790
If it wasn't so slow python would be the shit
>>
>>52355808
Optionals are much more useful when you have a language without null pointers, because they put the responsibility of handling null on the user with the type system and are very composable. If you can type a function such that it cannot be passed a null pointer, you don't need to do a wasteful null pointer check defensively (which is standard in Java).
>>
>>52355847
>Optionals are much more useful when you have a language without null pointers
oh, I completely agree. Optionals are based. But feel a bit weird in Java.
>>
>>52355762
C# is java without all the massive fuckups
>>
>>52355808
>So they just copied LINQ from C# and Maybe from F#?
LINQ is like the only valid excuse Csharts has for why C# would be better than java
>>
>>52355885
>A completely new language.
>>
>>52355935
How about working generics?
Or properties?
Or easy native interop?
Or unsigned integers?
Or struts?
Or pointers?
>>
>>52355493
>fewer than 600 lines of manually typed code
damn son
http://bisqwit.iki.fi/jutut/kuvat/programming_examples/portalrendering/prender.c
>>
>>52355972
>b-but you don't need any of that
>r-right tool for the right job!
>>
>>52355972
my boss sanjay doesnt care about any of that stuff xd
>>
>>52355321
any questions on racket? it's a little easier to learn if you use their docs / tutorials instead of SICP
>>
#include <string>
#include <functional>
int main(int argc, char** argv) {
std::function<int (int)> d=[&](int i){
#define a(b,c) !(i%b)?c:
return i?d(i-1)&&puts(a(15,"FizzBuzz")a(3,"Fizz")a(5,"Buzz")std::to_string(i).c_str()):1;
};
d(100);
return 0;
}


Still readabler than lisp
>>
>>52354811
>C++ literally has very easy to use first-class constructs for when a variable goes out of scope
>makes reference counted/unique pointer wrappers VERY trivial to implement
>they're actually part of the std lib, you don't have to reimplement everything yourself in C++!
Why use C when you want C++ features?
Oh yeah, because you're autistic
>>
>>52355936
I never said that, but it's way better than java
>>
>>52355353
An emulator's going to be my next project, man

It's going to be awesome
>>
>>52356018
None tbqh. It's simple to use, but sicp itself is a real beast to work with.
>>
File: 124.png (819 KB, 1600x900) Image search: [Google]
124.png
819 KB, 1600x900
>>52355102
nice
>>
>>52355840
what do you expect from an interpreter?
>>
>>52355840
>dynamic typing
>not shit
oh anon ; 33
>>
>>52356045
Same. Not sure if I want to do it in C++ or Java. I've been doing vms in python, but I need to go back to something bigger and scalable, as python's class system is quite lacking
>>
>>52356028
>readabler
Good English, fucktard.
>>
>>52356055
I think Neil has a racket package that implements all the stuff that's different / missing between MIT Scheme and Racket.
But yeah SICP is a bit of a brain bender
>>
File: DESIGNATED.jpg (90 KB, 983x455) Image search: [Google]
DESIGNATED.jpg
90 KB, 983x455
>>
>>52356035
>tfw he doesn't get your joke
>>
File: file.png (32 KB, 659x435) Image search: [Google]
file.png
32 KB, 659x435
Sorry, I still haven't managed to figure out what's wrong.


#include <iostream>
using namespace std;

int main(){
int x = 0;
while(x != 1){
cout << "Enter 1 to end" << endl;
cin >> x;
}
return 0;
}


When I compiled and executed this I get pic related. Top part is the console that comes up and the bottom part is from my processes in task manager. They're apparently being used by SYSTEM and I can't close them out.. Compiling from the command prompt doesn't give me the console but it does add another test.exe to the task manager.

What did I fuck up? Anyone have any clue what's wrong? Sorry for being retarded in advance.
>>
>>52355972
>unsigned integers
>structs
>pointers
completely unnecessary in a high-level language

>native interop
JNI is fine if you know how to use it

>properties
haven't even heard of it
>>
What have you been listening to while programming? https://www.youtube.com/watch?v=rprf7LEraU4
>>
>>52356117
You enter the character 1 (which doesn't evaluate to the number 1). Try while(x != '1') instead.
>>
>>52356137
Sorry, the problem is the console isn't accepting any input. It's also not displaying the "Enter 1 to end". Compiling it from cmd doesn't even give me the console window.
>>
File: 1447090709173.jpg (76 KB, 414x340) Image search: [Google]
1447090709173.jpg
76 KB, 414x340
>>52356124
>>
>>52354193

Think of an array. The purpose of an array is to store an indeterminate amount of data. To access a specific element in that array, you use an integer, called an "index". Strings are one type of array, used for storing textual data. If one is using 8 bit ASCII, it is easy to see that the nth character of the string would be the string as an array subscripted by an index of n-1.

Memory, is basically a giant array of bytes, containing all of the data you store. If one is using physical addresssing, one might imagine that the range of indexes would go from 0 to 4 billion (or 8 billion or 16 billion; I don't know how much memory you've got on your box). Mind you, your applications are most certainly not using physical addressing (you're using what's called virtual addressing, so those memory addresses in your application are being translated by hardware into physical addresses), but nonetheless, a pointer is ultimately just an index into a huge fucking array.

What do we use this for? Well, pretty much everything. Say I want to make a function that operates on a string. Maybe I want to take "Hello World" and reverse it. What arguments should that function have? Well, at bare minimum, we're going to want a pointer. After all, how is the function supposed to know where to look for your string? You might also want to pass in another argument to tell the function how big the string is. Why? Well, unless you're using a special character to tell it "this is where the string ends" (a number of C functions do this), then your function might not know when to stop reading/writing characters, and just access successive indexes into that big blob of memory until it hits an invalid memory address).

That's the simplest use. Pointers are also helpful when one needs indirection, such as in a linked list/tree/graph. Ultimately, you use pointers when you need to operate on a block of data, so you can tell your function "this is where the data is".
>>
>>52356124
>this post
jesus christ lads
>>
>>52356074
That's awesome, anon.

For me, I'm going to do it in C++. I'm going to try to do dynamic translation, which means it'll actually get translated to the native language on-the-fly.

I'm opinionated, but if I were you, I would go with C++, since it gives you a lot of freedom to design it however you want (good for personal projects, sometimes bad for teams, imo).
>>
>>52356124
>completely unnecessary in a high-level language
hahhahhahha. I love talking to Javafags.

>JNI is fine if you know how to use it
it's at least 10x more time consuming to use than pinvoke in C#, with no benefits.

>haven't even heard of it
To be expected of the typical Java programer.

Never change anon. You are the standard for all good programmers to strive against.
>>
>>52356124
>haven't even heard of it
It makes "get"/"set" functions transparent, callable just by using normal access/assignment syntax.
// Java:
class Fuck {
public int getFoo () { return 3; }
public void setFoo (int value) { }
}
...
fuck.setFoo(fuck.getFoo() + 1);

// C#
class Fuck {
public int Foo {
get { return 3; }
set { }
}
}
...
fuck.Foo += 1;
>>
>>52356131
http://www.di.fm/darkdnb
>>
>>52356155
>The purpose of an array is to store an indeterminate amount of data.

You literally can't resize an array.
>>
>>52356124
>completely unnecessary in a high-level language
Why do Javafags willingly limit themselves
>>
>>52356152
>>52356159
>>52356163
please dont bully. post code instead.
>>
thanks for the (You)s butthurt Csharts
>>
>>52356160
>to the native language
You mean CHIP-8's language?

I was leaning to C++ anyway, so I guess that's what it'll be in. Cheers m8, and have fun
>>
>>52356190
np bby
>>
File: LINQPad_5_2016-01-10_19-22-29.png (5 KB, 424x121) Image search: [Google]
LINQPad_5_2016-01-10_19-22-29.png
5 KB, 424x121
>C#/F# have their own weird language like sql
damn
these languages have everything
they make php seem like a nothing language
>>
>>52356183
then just use C++ instead of limiting yourself with C#
>>
>>52356200
php has been phasing out for a while
>>
>>52356205
>C# isn't better than Java because C++ is better than C#
>>
>>52356200
F# is the shit
You can create your own embedded language like query

It's effectively a library feature and not a language feature
>>
>>52356200
is this Haskell?
>>
>>52356205
I use D though
>>
>>52356124
>completely unnecessary in a high-level language
I might agree about the unsigned integers, but pass-by-value structs are incredibly important due to both performance and for semantics. We aren't at a point where memory is fast enough to heap allocate everything like Java does

>>52356215
They occupy a different niche

>>52356227
Read the post? It's F#, similar to Haskell but less "pure"
>>
>>52356227
it F# baby
>>
>>52356196
Dynamic binary translation is where you translate from the architecture you're emulating to the architecture you're running on on-the-fly. So in my case, if I were writing a DCPU-16 emulator, my C++ code would translate the instructions to equivalent x86 and then run that.

If the program can/does modify its own code in memory, then it gets tricky.
>>
File: Cover.jpg (884 KB, 2400x2400) Image search: [Google]
Cover.jpg
884 KB, 2400x2400
>>52356131

>>52356169
You're pretty good
>>
>>52356215
even if you think C# is better than java you should at least admit that they are somewhat similar. "C# is incredibly good while java is horrible" is a stupid meme or something that only a peabrain like a murrifat can believe since murrifats only think in extremes with no sensible middle ground.
>>
>>52356249
Isn't that just another word for JIT compilation?

Dealing with self modifying code wouldn't be that big of a deal. Just translate it in chunks, and if a chunk gets mutated or if you jump inside a chunk rather than to the beginning, either switch back into interpreted mode or re-compile it.
>>
>>52356270
>C# is incredibly good while java is horrible
Nobody said that.
>>
In which ways is D better than C++?
>>
>>52356200
F# is tits. Don Syme confirmed for king of /dpt/
>>
>>52356284
it has been said in previous threads, both implicitly and explicitly
>>
>>52354605
However, Sorcerer Linux > Arch
>>
My only complaint about F# is the syntax. I don't like that commas are only used for tuples


let add x y = x + y

just looks weird.
>>
>>52356124

>structs
>unnecessary

Okay Anon, think about things like this... I want to have a data type that concerns a lot of related data of different types. Like a class... except I also want to guarantee with 100% certainty that it will be on the stack... and if it's in a container, I want the data to be contiguous, rather than accessed through indirection. If A is a structure containing a 64 bit integer and a 64 bit float, I want a vector of it to be laid out in memory like this:

(i64 f64) (i64 f64) (i64 f64) ...

And not like this:

(ptr to A) (ptr to A) (ptr to A) ...

A C# programmer can do this, a Java programmer cannot. A C++ programmer or a Rust programmer will laugh at both because they can do these easily without C#'s inability to actually mutate those structs. Ultimately though, while C#'s structs are immutable, at least they allow for writing cache efficient code. The Java programmer lacks such options.

>>52356181

No, but you can create an array of a size determined at runtime.
Thread replies: 255
Thread images: 23

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.