[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 Progtamming 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: 313
Thread images: 26

What are you working on, /g/?

Old thread: >>59469243
>>
First for Rust.
>>
second for Rust
>>
Third for C#
>>
Fourth for Forth.
>>
Fifth for Swift
>>
>>59475428
>tfw swift is now faster than Go
>Even Java is now faster than Go
ayy
>>
>>59475371
Nice image OP
>>
In Javascript, how do I run make a for loop that does something to every image with the class "book"?
>>
>>59475494
for (let element of document.getElementByClass("book")) {
}

Something like that I presume
>>
>>59475494
var books = document.getElementsByClassName("book");
for (var i = 0; i < books.length; i++) {
console.log("ur a faget");
}
>>
What can I read about embedded development in Java?
>>
The whitest languages currently available:
Functional - Idris.
Imperative - Rust.
Anything else is a pleb filter and complete trash.
>>
https://twitter.com/japaricious/status/841165373663793153
>>
>>59475634
>>>/pol/
>>
>>59475655
That's pretty God awful if it's intended to be performant.
>>
>>59475707
Opinion discarded
>>
>>59475707
>it's intended to be performant.
>CPU usage less than 2%
>Literally 160MHz

>performance
>In this scenario
wew lad
>>
>>59475707
>ARM Cortex-M3 microcontroller @ 8MHz
>CPU usage ~1.5%
>That's pretty God awful if it's intended to be performant.
What.
>>
>>59475697
You just confirmed my suspicion that you along with most of this thread are straight from reddit. I wasn't even stating a /pol/ opinion, you have to go back.
>>
>>59475730
meant 1.60MHz
>>
>>59475634
>Functional - Idris
Barely
>>
>>59475787
You mean .16MHz
>>
>>59475802
oh yea
>>
>>59475719
>>59475730
>8mhz*0.015=120khz
>32hz refresh
>120/32 kHz per update.
>3750 cycles per update
>to increment two indices and produce the simple data pattern
Really now.

I'm not saying that it's bad or anything. I'm just saying that the presentation of 1.5% usage leads me to believe that it was an actual concern and the person presenting isn't just showing some nice LED pattern but is rather proud of this very mediocre accomplishment. And I'm fine with undeserved pride. He's happy, that's nice. It's just not impressive in that aspect.
>>
>>59475884
That's just printing an LED pattern your performance concern in there is baseless
>>
>>59475910
>your performance concern
No clearly its the person who posted that Twitter post who has a performance concerns. I didn't measure CPU usage on that stuff.

It's clearly good enough for the task. Standards for performance aren't high for simple embedded applications.
>>
>>59475546
I've tried that before.
books.length is 0.
>>
>>59475655
>>59475707
>>59475719
>>59475730
>>59475739
Lel
It's most likely is using 3x dma streams to control the ws2811, so all the mcu does is setup the streams on startup and then just write to a buffer.
Literally no achievement. You have to be retarded to manage to make it use more than "1.5%" of the cpu.
>>
>>59475371
Which programming language is best for mathematics, specially combinatorics and automata thoery??
I would like it to have C/C++ binding so that I can make opengl, directX programs.

My aim is to make open source matlab.
>>
>>59476046
>when in doubt
Java
>>
>>59476046
>Which programming language is best for mathematics
Julia or Python.
> My aim is to make open source matlab.
Why? GNU Octave is a thing, you know.
>>
>>59476031
>manage to make it use more
Oh don't worry about that. I can fire up those transistors for you buddy.

>>59476046
>remake make matlab
Yeah you will need C or C++. Or maybe possibly java since the JIT does fit the use case of matlab pretty well (running JIT on long computations can be beneficial, people generally don't care about performance for the trivial cases) but that's speculating.
I think most good math kernels/matrix libraries are for C++ though.
>>
>>59476046
nsp
>>
I think I'm gonna look into reddits programming outlets. I don't have a clue what they're like and I suspect it'd be educational.
Wish me luck.
>>
ok, so I am a n00b and I do not understand why this is behaving so.
Im using rubys 'syntax-sugar'
and it is not consistent ?
class Bank
attr_accessor :balance
def initialize(amount=0)
self.balance = amount
end

def -(x)
self.balance -= x
end

def to_s
self.balance.to_s
end
end

acc = Bank.new(20)
acc - 5
puts acc

This will subtract 5 from the amount
but if I mix -=5 with it, it suddenly decides to only use one "sugared" syntax
why can you only use one style/syntax?
>>
>>59476273
other syntax being
-= 5
.-(5)
all work but not when mixed, no errors..
>>
>>59476046
Have a look in GPU programming - OpenCL/CUDA
The resulting memory buffers can be "easily" passed to an OpenGL rendering context, as they already reside on the GPU, so there is less overhead to the visualization.

Any modern language can be used for the shell program but most probably you should use C++.
>>
>>59476071
>GNU Octave is a thing
It truly isn't.
>>
(cross-post) Hi friends, I'm trying to learn SQL before next semester when I take a class on it.

I currently have a few tables (product, component, consumer, reseller and vendor (vendor doesn't exist as a relation in the DB).

Products are made up of components bought from vendors.
Both resellers and consumers purchase from the manufacturer who purchases components from a vendor.

My relations that I have derived from here consist of consumer_orders, reseller_orders and vendor_items. I'm trying to figure out a way to do product_components (a list of the components in a product) but I'm getting stuck and can't figure out a way to do it that makes sense to me.

http://pastebin.com/hJAg0qDH

Any tips would be appreciated or if I've just done this completely wrong feel free to tear me a new one.
>>
/g/ should be freed from shitskin pajeets.
>>
>>59475401
>>59475387
Are you working on a project in Rust?
Will whatever you know about it now will still be applicable in the near future?
Are you not wasting time?
>>
>>59476890
Learning is not wasting time
>>
>>59476902
>Learning is not wasting time
yes but learning rust is waste of time.
>>
I'm following a course on data-structures being taught in Java, but I'm implementing them in Javascript.

Right now, I'm implementing an array-based stack. In the course, the instructor uses Java's native array to build his stack with.

Is it ok for me to use Javascript's native stack? The exercise produces a redundant data-structure, in the sense that it just wraps the native array's methods. However, it could be argued that I am learning about the capabilities of an array-based stack, as a kind of toy programming exercise.
>>
>>59476890
> Are you working on a project in Rust?
Yes, occasionally I do this personal project of mine just for fun.
> Will whatever you know about it now will still be applicable in the near future?
Yes, why not?
> Are you not wasting time?
In the grand scheme of thing, whatever you do is a waste of time, I just waste it on something I find interesting.
>>
>>59476909
How old are you?
>>
>>59476958
32, go shill rust elsewhere.
>>
>>59476983
So you are "32", shitpost in 4chan, concerned about what people like and complain if people like what you don't?

How does being a pathetic manchild treating you?
>>
>>59476983
Or what?
>>
>>59476995
>concerned about what people
Couldn't care less but the rust shilling is getting really obnoxious here.
>>
>>59477045
If that's the case why are you so butthurt?
>>
>>59477045
Why would I not be shilling the best imperative language currently available? Not counting assembly.
>>
>>59476995
How is being literally retarded treating you?
>>
>>59477074
Oh you dodged that bullet didn't ya?
>>
>>59477045
agree, hating on Rust is edgy..we get it.
now can we talk about code ? and not just circlejerk over it.
>>
>>59477074
Please tell us why Rust is a waste of time, reasons someone should not learn it ?
what is time better spent learning ?
>>
File: 1455950055870.jpg (38KB, 652x470px) Image search: [Google]
1455950055870.jpg
38KB, 652x470px
>>59476890
>Are you working on a project in Rust?
>Will whatever you know about it now will still be applicable in the near future?
>Are you not wasting time?
>>59477045
>Couldn't care less
Aww never knew children can be so adorable
>>
>>59477125
I'm a second year computer science student, I like programming and am getting much better at it.

Give me a project that I'll enjoy.

I'm starting to expand my MTG collection, a Database could be fun but what's a project I can expand it with?
>>
>>59477173
>Give me a project that I'll enjoy.
Oh boy
I wanted to work on GTK and it gave me mental illness.
>>
>>59477173
Project Management app/ticketing app.

could implement MTG stuff in it somehow also.
>>
>>59477219
That sounds like a big project, what sort of stuff did you try and develop for it?
>>
>>59477286
I just wanted to patch the file picker man. The fucking file picker. After a month I found myself trying to kill myself.

>C with classes
Oh boy. I hate people that try to involve C with EVERYTHING. Not bashing on C, but now I just do not care.
>>
is JavaScript a decent choice if I want to try some functional programming ?

I mean I know it supports functional style so I assume it will be fine for a first look into functional programming...
>>
>>59477325
>classes
>>>/r/ibbit
>>
>>59477423
If you're mentally handicapped, sure. Otherwise better go with Haskell if you really want to do it just to try some fp.
>>
>>59477455
ribbity ribbit you cannot read
>>
>>59477423
JavaScript is not functional programming.
>>
>>59477497
What defines a functional programming language?
>>
>>59477512
It not being JS is one of the main qualifiers.
>>
>>59477423
Scala is actually really fun!
>>
>>59477528
>POOlang is actually really fun!
nice try, MI6 shill
>>
>>59477527
Being JS is one of the main qualifiers actually.
>>
>>59477540
>>59477527
>>59477455
Gate keeper is back
>>
File: 9781784398224.png (55KB, 810x1000px) Image search: [Google]
9781784398224.png
55KB, 810x1000px
>>59477497
No, because JS is a programming language. You can do FP in JS tho.
>>
>>59477549
Don't bother replying to him, it's the gatekeeper kid
>>
File: 1367452185750.png (69KB, 482x331px) Image search: [Google]
1367452185750.png
69KB, 482x331px
XdXd Le functionnal maymay XdXD Le programming XDDDDDX le coding!!Xd
>>
>>59477546
>>59477555
is that your friend? fuck off back to your irc.
>>
>>59477565
Programming is a meme!
>>
>>59477576
Keep it up, gate keeper. You are doing a great service
>>
>>59477527
PHP can be functional and PHP is not JS. Therefore PHP is more functional than JS
>>
>>59477565
/fpt/ --->
>>
10% of the people here program, 90% are teenage non-normie epic bros.
fight the good fight.
>>
>>59477638
>90% are teenage non-normie epic bros.
And 95% of them are weeb animoo lovers
And 70% of them have shit animoo taste
>>
>>59477676
Your mum is shit animoo taste
>>
>>59477712
You're mom Schwarzschild radius is infinite
>>
>>59477512
>>59477549
"In computer science, functional programming is a programming paradigm—a style of building the structure and elements of computer programs—that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data. It is a declarative programming paradigm, which means programming is done with expressions[1] or declarations[2] instead of statements. In functional code, the output value of a function depends only on the arguments that are passed to the function, so calling a function f twice with the same value for an argument x will produce the same result f(x) each time. Eliminating side effects, i.e. changes in state that do not depend on the function inputs, can make it much easier to understand and predict the behavior of a program, which is one of the key motivations for the development of functional programming." - Wikipedia
TL;DR FP uses expressions instead of statements.
>>
File: 1477392188299.png (698KB, 998x673px) Image search: [Google]
1477392188299.png
698KB, 998x673px
Imagine programming a 3d game in PHP.
>>
>>59478062
http://gtk.php.net/manual/en/tutorials.php
>there are gtk bindings to PHP
>I don't want to check for bindings to opengl
>>
>>59477150
>Aww never knew children can be so adorable
Biggest objection to Rust? That fags think that programming in it automatically makes their code guaranteed to be safe against all attacks, and that it is the only programming language with this property.
>>
I made a program that is so interesting I feel like I should submit it to an academic journal or something
>>
File: 1484835935365.png (104KB, 388x385px) Image search: [Google]
1484835935365.png
104KB, 388x385px
>>59478182
You'd better believe it sonny.
https://pecl.php.net/package/sdl

Anything is possible.
It's just that nobody's been dumb enough to actually do it.
>>
>>59478211
>submit it
Well, you obviously need to write a paper explaining your motivation and results then, but why not do it?
>>
>>59478236

because I'm not part of a university
I don't have much money (I looked into it, it takes 1000+ bucks)
I have no idea how to even write a paper
I have nobody who I can put down as a reference
>>
>>59478306
Put it on github, write a blogpost and post it on HN and reddit.
>>
>>59478211
O(1) fizzbuzz?
>>
Not gonna lie, former C programmer here. This is fucking hilarious watching C segfault and crash. But in all seriousness we can't let these buffers get more overflows.
>>
>>59478306
>because I'm not part of a university
Don't need to be, but it will admittedly be difficult unless you know someone in the community. Academic nepotism is a real thing.

>I don't have much money (I looked into it, it takes 1000+ bucks)
You'd need to pay a member fee and then most likely attend the conference. For journals you need to pay some fee as well, but it's more in the ballpark of $20.

>I have no idea how to even write a paper
That's a bigger problem though. However, I was never told how to write them either, I just read enough of them to get an impression of how they were supposed to be. Although collective writing with coauthors help a lot and also you must target your paper to the conference or journal you are aiming for. They usually have trends and stuff they want you to look at.

>I have nobody who I can put down as a reference
You need references, but not in the job application way. You only need references in the sense that you must cite what isn't considered common knowledge.
>>
>>59478350

I did have it on shithub. 3 unique visitors.

also I put it on fractalforums.com.
>>
>>59478374
Post link
>>
In C each function name is the same in the ABI as in the API but couldn't it still have namespaces?
namespace xo {
void fn();
}

/* other file */
extern void xo:fn();
>>
>>59478427
Jens Gustedt has a proposition for such a modular way to program in C, but it's mostly preprocessor stuff.

>>59478306
There are some open access journals that don't charge fees, you could also pre-publish it to get feedback first.
>>
File: ss.png (7KB, 556x375px) Image search: [Google]
ss.png
7KB, 556x375px
Does /g/ think diversity in tech is an issue?

fucking hell

https://landing.jobs/why-diversity-in-tech-is-still-an-issue
>>
>>59478460
nigger
>>
>>59478460
Diversity is an issue. A woman is more likely to be hired than a man in a male dominant industry.
>>
>>59478460
You have to go back.
>>
>>59478472
?
>>59478486
?
>>
File: (((x^y)-y)*x >> 11) & 1.png (126KB, 1024x1024px) Image search: [Google]
(((x^y)-y)*x >> 11) & 1.png
126KB, 1024x1024px
>>59478370

You need to pay to have it published so that you can access it without a membership fee. This is the one I had in mind. It seemed perfect because it was less than totally formal

http://sprott.physics.wisc.edu/pickover/guidec.html

And by "references" I mean "reviewers" (I actually have a few very relevant references in the sense you mean in mind):
> Please suggest 2 reviewers (names, address, and e-mail) who you think would be willing and able to rapidly review your paper.

>>59478387

I deleted the git repo because I am really bad at git and it was just a huge mess. I ended up ruining it by moving some files. Couldn't figure out how to update it.

When I deleted the git repo I figured to try and get it out there some other way and just removed the fractalforums.com post. I'll post again once I refine the code and make a non-retarded repo.

Not trying to keep it a secret though. This is one of the images I posted. The way I created it was by checking one bit of the result of a randomized function. This function was generated by defining an "instruction set" with opcodes and oprands (either X or Y) and then RNGing these instructions.
>>
any decent java 7/8 refreshers or something? need
>>
>>59478564
>You need to pay to have it published so that you can access it without a membership fee.

Open Access can be expensive to do on your own. But you can get around it by uploading a preprint of your paper somewhere like arXiv. That's what academics do, especially as it can take YEARS to get something published despite nothing obvious happening. (I hate that. Getting stuff published is a major PITA.)

For reviewers, you just need to find the names of a couple of people in about the right field. Googling may help! If you're working on your own, it isn't too hard; it's a lot harder when you're writing that paper with almost everyone in the field who is competent to review the paper in the first place! The best people to pick are mid-career researchers, but senior professors with lots of students also work (provided you don't mind a student actually doing the review). You don't have to accept everything the reviewers say, but you absolutely do need to address it. (Occasionally, it is by pointing out that the reviewer is smoking something and not sharing, or otherwise getting the wrong end of the stick.)

Try to avoid obvious speelign and gramar error. Those waste everyone's time. And do try to cite other related work in order to point out why what you're doing is different (or building on it).
>>
>>59478486
You have to kill yourself. Retard.
>>
>>59478755

So can I just put people down who I have never talked to before as reviewers?

or do I have to email these people beforehand?
>>
I am learning C++. Where could I find the tasks to solve, besides Straustroup's books? I have no experience whatsoever, the only tasks I've done is sorting the array using quicksort and how to convert capital letters into a small ones in string.
>>
>>59478940
Given two strings A and B, write a program that determines if A is a substring of B. Optimize for speed and space.
>>
>>59478956
In Lisp, this is just
(search A B)
>>
>>59475564
google javacard

the closest you're ever going to get

it's garbage though, doesn't even have strings so you have to use byte arrays, but you can't use string literals so you literally have to use {'a', 'b', 'c', '\0'}
>>
>>59479000
>Optimize for speed and space.
>>
>>59478940
>inb4 >>>/ribbit/
/r/dailyprogrammer
>>
>>59478182
OpenGL is an API, in any language OpenGL code is just client calls to a video device which acts as a server.
>>
>>59479025
(let ()
(declare (optimize (space 3)) (optimize (speed 3)))
(search a b))

>>
>>59478564
>The way I created it was by checking one bit of the result of a randomized function. This function was generated by defining an "instruction set" with opcodes and oprands (either X or Y) and then RNGing these instructions
That actually sounds like a lot of fun. I'm going to try and recreate that tonight and see what happens
>>
>>59478696
Java 8 in action. It's actually really good once you get to the bit on streams.
>>
>>59479081
>nice
>>
>>59479081
You don't need multiple optimize clauses, and the optimize quality doesn't need a value if you're going to max it out.
(let ()
(declare (optimize speed space))
(search A B))
>>
This library enables any computer (of an 8*n bit architecture) to do math calculations with numbers unlimited (yeap truly unlimited) in length and precision.

The complexity of the code is linear and irrelevant of the computer architecture or the numbers. This exploits the myth that computers can do much more if they are faster or more equipped with specialized hardware.

This library can run on microcontrollers or any computer on any O/S once compiled. The reason I begun writing this library is to break the RSA encryption mechanism by proving that the complexity of finding two prime numbers is not a big problem when the underlying mechanics are suitable.

https://www.youtube.com/watch?v=PFyx9rPl7_8
>>
>>59479178
so post the code then.
>>
>>59476787
>>>pol
>>
>>59479178
>posts video on youtube
>Comments are disabled for this video
>people can't even discuss the video
>>
>>59479178
>what is fixed-point arithmetic
>>
>>59479178
GIVE MONEY BACK
>>
I guess I should upload my university course assignments to GitHub for a portfolio? They are actual functioning programs.
>>
>>59479103

I encourage you to try it

If you want the source code I'm using you can have it as well. Just leave your email (or a guerilla mail)
>>
>>59479251
doesnt your university provide any site you can upload your code to?
>>
So in order to get my GitHub started I recently started proposing to random repos I found with no CoC to use the contributor covenant. Is there anything else I could do that would easily give me commits?
>>
>>59479336

That's pathetic
>>
>>59479336
/s/he/she/g
>>
>>59479336
Yes, actually write code.
>>
>>59479365
Nice great idea! Inclusiveness and tolerance is a goal every open source project should aim for.
>>
>>59479365
>tshe
>>
>>59479336
Links please?
>>
>>59479336
You're trolling too hard anon.
>>
Can men even code? I doubt it, since they can't focus on something for more than seven seconds without getting distracted and thinking about sex.

All the male "programmers" probably just make coffee or something.
>>
>>59480020
Why do you think we need internet for coding. We fap a lot and when we can we code.
>>
File: 1375555127149.jpg (98KB, 504x470px) Image search: [Google]
1375555127149.jpg
98KB, 504x470px
On Sunday we kode
>>
>>59480034
You probably just copy code from SO that was written by women.
>>
>>59480084
That must be why all of our software is terrible.
>>
>>59480103
Not surprising that men can't even get copy-paste right.
>>
>>59475371
>Daily Progtamming Thread
>Progtamming
Learn to spell.
>>
def convert(unit_type,unit_value): #eg convert('oz',1) >>> 29 ml >>>
ml_in_oz = 29.57353
if unit_type == 'oz':
return unit_value * ml_in_oz #returns ML

def standard_drink(percent): #returns ounces
return 60 / float(percent)


def prompt():
return input("Enter Percentage of Alcohol \n >")

in_oz = standard_drink(prompt())

in_ml = convert("oz",in_oz)

print("Use {} Oz, or {} ML".format(in_oz,in_ml))
>>
>>59480133
If you can't tame programs, are you really a programmer?
>>
>>59480133
Learn to not be so easily triggered. Retard.
>>
>he uses a language where code is implicitly in the Option, Except, and IO monads at all times
>he wonders why his code is difficult to reason about
>>
>>59480020
Men are actually the worst coders. The only time they can actually code something is in the refractory period with their dick in their hands. I've worked in teams of both women and men and found that women worked way harder and were less arrogant than the men. If I could join a team of women again, I would do it in a heart beat.
>>
>>59480201
>monads
Trash.
>>
>>59480217
>couldn't pass his haskell classes
>>
>>59480193
>doesn't mind using absolute garbage
Probably a dynamic language user.
>>
File: CAW CAW.jpg (181KB, 634x635px) Image search: [Google]
CAW CAW.jpg
181KB, 634x635px
>>59480217
take that back
>>
>>59480225
>haskell
Trash.
>>
>>59480246
>p-please professor! i don't want to use haskell! you know i'm not smart enough to understand functors! n-nnnnngh~
>>
>>59480254
whats a functor?, doctor of fun?
>>
File: cheeky_anime.gif (389KB, 500x281px) Image search: [Google]
cheeky_anime.gif
389KB, 500x281px
God tier languages
>C
>Lua
>Rust
>Go
>Erlang

Shit tier languages
>Python
>Java
>C++
>Javascript
>PHP
>>
>>59480278
pythons actually god tier, just mainly for shit tier programs
>>
>>59480266
>whats a functor
A way of emulating functions as a type you can pass around in older versions of C++.
>>
>>59480278
Add all pure FP languages to shit tier, and it'll be complete.
>>
>>59480266
>n-no professor! i don't want reusable code, i want to write the same function over and over again! just doing it once isn't enough for me~~
>>
File: wrong.gif (1MB, 480x287px) Image search: [Google]
wrong.gif
1MB, 480x287px
>>59480293
>>59480300
>>59480306
>>59480278
>>
>>59480314
I may not have known what a functor is, but I Like me some functions

see
>>59480143
>>
>>59480293
Python is shit tier. It doesn't even use tail-recursion optimization. Such a shit
>>
>>59480293
python is for people who can't learn a real language
>>
>>59480345
Python makers don't understand recursion.
>>
>>59480278
Something that I can get behind.
But Python is borderline meh-good tier
>>
File: bait but also true.png (17KB, 522x384px) Image search: [Google]
bait but also true.png
17KB, 522x384px
>>59480329
i agree
>>
>>59480356
No, it's shit.

>>59480355
I sometimes wonder if Guido is trolling the world, or if he actually believes the things he says, like how the compiler knowing almost nothing about your code is apparently a good thing.
>>
>>59480329
Don't worry. Haskell has its merits, one of those being it's good at filling the bottom of a trash can.
>>
>>59480345
My only experience is in python, so Im half gusstimating this, but I wouldnt want recursion in a scripting launguage, at least not with my 2.80 ghz
>>
>>59480389
>still salty that he had to learn some basic haskell in college and struggled with it
>>
>>59480384
The design of python indicate that they suck at coding.
>>
>>59480367
>LOOK MOM! I POSTED IT AGAIN!
>>
>>59480391
What does that have to do with anything?
>>
File: 1805486.1024.jpg (63KB, 1024x1024px) Image search: [Google]
1805486.1024.jpg
63KB, 1024x1024px
>tfw writing C code in Racket
>>
>>59480416
That's the first time I posted it you self obsessed faggot.
>>
>>59480416
You're still triggered by it, I see.
>>
>>59480436

Nah.
>>
>>59480417
lol, I can type at 30 wmp
>>
>>59480443
Uh-huh.
>>
>>59480434
Retard. You're just making it hard for everyone to read your code.
>>
File: halp.png (148KB, 1440x900px) Image search: [Google]
halp.png
148KB, 1440x900px
>>59480468
>>
>>59480468
Racket is an anagram of Retack.

If we rotate the c and move the diagonal lines of the k around we get r and d respectively, and we find that Racket is actually Retard!
>>
>>59480495
ahahaha
>>
File: 1362715703739.jpg (113KB, 680x680px) Image search: [Google]
1362715703739.jpg
113KB, 680x680px
>>59480494
>>
>>59480494
>screenshot

needs more arch
>>
God tier lists
None

Shit tier lists
>>59480278
>>
>>59480494
I hope your instructor gives you an F just for the code style alone.
>>
Europeans should stop using periods as thousands separators and commas as decimal points. English won, get over it.

1,001 does not mean one and a little bit. It means one thousand and one.
>>
>>59480494
Of course, you fucking had to be a subhuman hue hue hue, didn't you?

Now Lisp is tainted forever.
>>
>>59480545
Idris > Haskell > Rust > Scheme > C > other languages
>>
>>59480555
>uses a number system derived from indians
>"English won"
>>
>>59480580
What language are you posting in right now? Exactly.
>>
>>59480554
their fault for not using a real language like C, C++, java, python, javascript, C#

what's the point of teaching some useless language we wont use in our work?

>but functional meme
at least should had put us haskell.
>>
>>59480555
Otherwise known as one thousand and a little bit.
>>
>>59480590
Yes, but I'm posting in on a Japanese imeageboard for Anime fans.
>>
>>59480574
The goal isn't to fill the "shit lists" category my man
>>
>>59480580
No no, "English one. "
>>
>>59480609
>email euro cable store
>tell them I want 1,000 feet of cable
>they send me about 30cm of cable
>>
>>59480639
The buttpain is palpable.
>>
>>59480640
Thats why you neglect punctuation completely
>>
>>59480631
Let me guess, you're a Python fan?
>>
The proper way is to use space as thousands separators, and comma for the fractional part.
>>
>>59480640
>uses furlongs and fortnights
>is surprised when orders get wrong
>>
>>59480686
>>>/int/
>>
>>59480686
Disgusting

>>59480698
>offer services in English
>fuck up when services are used in English
>blame the customer, not own incompetence
>>
Is SICP really worthwhile or is it overcomplicated academic masturbation? I'm on chapter 3.

It seems that almost anyone that did anything in programming or computer science either had no degree or studied maths or physics. Who the hell ever found SICP necessary?
>>
>>59480698
Furlongs and fortnights are perfectly good units of measure.
>>
>>59480743
>It seems that almost anyone that did anything in programming or computer science either had no degree or studied maths or physics
Yes, but they were intellectually brilliant people. Don't try to use them to justify your own laziness.
>>
>>59480743
I use Lisp and I learned everything through practice and other books.
>>
 {
Console.WriteLine(GetBinomialCoefficient(37, 5));
}
public static int GetBinomialCoefficient(int totalNumberOfBalls, int numberOfBallsDrawn)
{
var total = 1;
for (var i = 1; i <= numberOfBallsDrawn; i++)
{
total *= (totalNumberOfBalls + 1 - i) / i;
}
return total;
}


This gives = 351648 when the correct answer is = 435897.

Why ON EARTH does this not work? And why does it give the right answer with (59,6)?
>>
>>59476902
Learning how to juggle while tying ur shoes is a waste of time
>>
>>59480798
Round off errors?
>>
>>59476937
what the fuck is the point of implementing it in javascript if you'll have to do it in Java on your exam?
>>
>>(*)
Post your resumes you fake developers.
>>
>>59480798
>>59481030
Yea, definitely.
59/1 = 59
58/2 = 29
57/3 = 19
56/4 = 14
55/5 = 11
54/6 = 9
>>
File: resume.png (31KB, 712x954px) Image search: [Google]
resume.png
31KB, 712x954px
>>59481076
rate
>>
>>59481092
Work experience not over 'projects'? What is this junior year of high school?
>>
File: 1.jpg (57KB, 445x459px) Image search: [Google]
1.jpg
57KB, 445x459px
what the fuck happened to the api in protobuf version 3
>>
>>59481105
i'm only 18.

relax dude
>>
>>59476937
A data structure is abstract idea. For instance the Stack is defined by its first-in-first-out nature.

Most are built upon other lower level data structures, so what your instructor did is not redundant.

Using JavaScript's native stack would defeat the purpose of the exercise. Build the data structure yourself.
>>
>>59480798
(defun get-binomial-coefficient (total-balls balls-drawn)
(if (< balls-drawn 1)
1
(* (/ (- (1+ total-balls) balls-drawn) balls-drawn)
(get-binomial-coefficient total-balls (1- balls-drawn)))))
>>
Is it possible to implement this data structure in javascript?

"Dynamic array, implemented with a ring buffer (use a statically sized array underneath the hood)"
>>
>>59481189
yeah of course, a ring buffer is just a fixed size array with a pointer to the head and tail
>>
>>59481217
So a more useless linked list?
>>
>>59481160

JS doesn't have a native stack, although its array has a set of methods that come close. Unfortunately, for the OP, they'll just have to use the array to store data within the stack and implement stack-specific methods that emulate array behaviour from scratch.

Either way, crafting a stack in JS is redundant outside of the context of a learning exercise - the native array can be used as a stack, and if you do decide to make a stack you'll need to use that array anyway
>>
>>59481280
>crafting a stack in JS
Hello "code artisan".
>>
>>59481217
The issue I have is that javascript doesn't have static arrays. All arrays are dynamic by default.

Should I try to manipulate javascript's standard arrays to create static arrays with which to implement a dynamic array via ring buffer?
I'm aware that doing so is technically pointless, I'm just using it to learn about data structures.

Or will I have to implement a static array from scratch? Can I do that?
>>
>>59481165
(defun get-binomial-coefficient2 (total-balls balls-drawn)
(loop for i upto balls-drawn
for total = 1 then (* total (/ (- (1+ total-balls) i) i))
finally (print total)))
>>
>>59481313
Hello code monkey.
>>
>>59481313
>being this triggered by the phrase 'craft' that you immediately view me as abstraction

wew lad
>>
>>59481327
Create an object that will behave like a static array.
>>
>>59480278
>Wrong.jpg
>>
>>59481339

wtf is this? Can you write in it C#?
>>
>>59481450
Looks like some gay ass haskel shit, it's pretty easy to translate to a language you want to use.
>>
I don't understand how anyone in their right mind can enjoy indenting their code with Allman
I've been asked to help with a C# project and since they already use Allman I'm stuck with it
I hate every single thing about it
>>
If your language isn't pure functional it's shit
>>
>>59481553
+1
>>
how do I return true or false in racket?
>>
>>59481543
I like allman
>>
>>59481450
Lol, you just need to start from 0 instead of 1 in your loop.
>>
>>59481553
If your language is pure functional it's shit
>>
>>59481582
#t
#f
>>
>>59481597
1TBS only, please.
>>
>>59481553
>>59481614
fucking pajeets
they need everything to be reduced down to shit
>>
File: iqueryable%20and%20ienumerable.png (39KB, 762x452px) Image search: [Google]
iqueryable%20and%20ienumerable.png
39KB, 762x452px
What are some Advanced OOP topics that I should learn?

I know OOP but all the resources I look at only go as far as Interfaces, Should I look into Generics, Templates, and IEnumerable?
>>
>>59481614
wrong

>>59481662
>Generics, Templates, Enumerations are now OOP
god save us
>>
>>59481662
OOP is just memes, bro

I don't even know what IEnumerable is
>>
What useful flags do you use with clang?

right now, i'm using
clang -Wall -Wno-unused-function *.c
>>
>>59481662
Learn the art of cache misses with OOP.
>>
>>59481672
All forms of polymorphism are OOP.
>>
>>59481662
>I know OOP but all the resources I look at only go as far as Interfaces
Because none of the rest of that stuff is OOP.
>>
>>59481662
> IEnumerable
> OOP

Nigga, are you retarded? Are you trying to say implementing classes that inherit/ implement the IEnumerable interface?
>>
File: 1465740370726.png (39KB, 620x456px) Image search: [Google]
1465740370726.png
39KB, 620x456px
>>59481693
>>
>>59481672
We're witnessing the death throes of OOP. Its evangelists, realizing that everyone is beginning to realize that OOP is full of shit (inheritance, shared mutable state, etc.), are trying to widen the definition to include useful things like generics, in order to try to forestall their obsolescence.
>>
>>59481695
>none of the rest of that stuff is OOP.

What is a good starting point to learn that 'STUFF'?
>>
>>59481715
Not just OOP, "advanced OOP".
>>
File: anime.png (786KB, 1000x1300px) Image search: [Google]
anime.png
786KB, 1000x1300px
>>59481718
step into the light

https://en.wikibooks.org/wiki/Haskell
>>
>>59481715
> Include Generics
What is this .NET 2.0?
>>
>>59481728
>trashkell
No thanks.
>>
File: g.png (29KB, 761x561px) Image search: [Google]
g.png
29KB, 761x561px
>>
>>59481718
>>59481728
If $60 isn't an issue, I hear this book is pretty good: http://www.haskellbook.com/
>>
>>59481728
how hard is to learn haskell?
>>
>>59481739
He doesn't mean OO languages incorporating those features, but OO programmers claiming that those features are OOP.
>>
>>59481742
What causes someone to make such a rude comment about a language they know nothing about?

>>59481749
depends how far you go, it's probably different to what you're used to
>>
>>59481749
It's not hard. OOP cultists want to keep you in the cult though, so they'll say it's impossible/useless/etc.
>>
>>59481745
Needs more FactoryBeans.
>>
File: 1473270775971.png (273KB, 518x700px) Image search: [Google]
1473270775971.png
273KB, 518x700px
Do you fully use native prototypal inheritance system in your js code or you force the class-like style faking the classes that some other languages have (java,...)?
I was reading some books(You dont know JS series) where the author is against faking classes.
>>
>>59481756
>>59481764
I want to learn FP, but I really hate dr.racket.

and I'm sure I'm writing C code in it.

so far, I've solved almost all my problems in the homework with just recursion.
>>
>>59481772
Neither, anon.
>>
>>59481756
I have been using Haskell for awhile now, and this is what I have found wrong with the language:
>horrid macro system
>modules are deficient compared to the module system of OCaml or the package system of Common Lisp
>partial functions pervade the language
>broken records (ugly hacks are needed to get around their deficiencies, leading to overengineered libraries like lens)
>most libraries are in alpha and look like a college student's summer project
>library authors tend to pepper their libraries with ugly, meaningless, custom operators, contributing to the overall ugliness of the ecosystem
>String as [Char]
>easily subverted type system with unsafe functions
>laziness makes it a chore even for experienced programmers to reason about algorithmic complexity
>in 30 years of existence, Haskell has yet to become a proven asset in industry
>>
>>59481772
This is 2017. Use ES2015 classes or write typescript 2.0.
>>
>>59481781
You don't have to use Racket to learn FP.
>>
>>59481811
what's the proper way to write functional code?
>>
>>59481834
Follow the principals of functional programming.
>>
>>59481805
>in 30 years of existence, Haskell has yet to become a proven asset in industry
This is how you can tell Haskell is dead. Tools that the industry can actually use always become widespread within the first five years and mainstream within the first ten.
>>
File: f.png (39KB, 1223x251px) Image search: [Google]
f.png
39KB, 1223x251px
>>
>>59481850
where I can learn about this?
>>
>>59481852
>let
>>
>>59481789
Why neither? I mean maybe you dont make some big projects in js? Sorry I just thought that for bigger projects that is bound to be some style to follow (classes or proto inheritance)
>>59481806
Thanks I guess . I just want to be updated with generally accepted ways although I do understand them both.
>>
>>59481753
>OO languages incorporating those features

I don't mind if it's OOP or not, I've used Clojure and started looking at F# which both use Collections, I just want to know the difference between that and IEnumerable.
>>
>>59481805
>partial functions pervade the language
Without this, it would be awkward to use Haskell.

>easily subverted type system with unsafe functions
Not standard, {-# LANGUAGE Safe #-}

>String as [Char]
Programming wise this makes perfect sense, it's simply performance wise where this fails, and even then that's in large applications.

>library authors tend to pepper their libraries with ugly, meaningless, custom operators, contributing to the overall ugliness of the ecosystem
I don't find them meaningless.

>laziness
use the Strict extension, laziness actually does a lot of good for composition

>records, modules, macros
actual flaws in the language
>>
>>59481772
>using inheritance at all
>>
>>59481872
>the <body>s hit the Math.floor()
>>
>>59475371
so, consider a simple loop in C
for (double i=0.0; i<1;i+=0.01){
//do something...
}


How do I do something eqivalent in Python? I have
for i in range(100):
i = i/100
#do something...

but it's ugly as fuck
>>
>>59481834
There isn't a "proper way". If Racket isn't working for you, there are lots of other ways.

Some consider SICP a good way to get started, there are some free videos of the course online at https://www.youtube.com/playlist?list=PL8FE88AA54363BC46 and the book is available for free at https://mitpress.mit.edu/sicp/full-text/book/book.html. Others think you should start with Haskell, which also has free resources available online.

My first exposure to FP was a lecture course on ML.
>>
>>59481897
>Programming wise this makes perfect sense, it's simply performance wise where this fails, and even then that's in large applications.
Programming is about performance.
>>
>>59481905
Why not really? I mean its how the language is built. Is it really that bad or just unnecessary? What am I missing here?
>>
>>59481885
My projects tend to be bimodal, either low-level for which I'll use C/Rust, or high-level for which I'll use a functional language.
>>
>>59481923
>Programming is about performance.
You could not be more wrong.
>>
>>59481932
Don't listen to these retards. Inheritance and modules are great for people that are more than hobbyists.
>>
>>59481923
Programming is about correctness.
>>
>>59481919
for i in range(0,1,0.01):
#do shiet
>>
>>59481932
Use composition and free functions (on components) instead of methods. It's the best for code reuse.
>>
>>59481961
Because everyone likes it when web pages are stuck in a render loop or it takes 8 years to sort something using bubble sort, (insert 10000000s)of other examples). Right?!
>>
>>59481980
> free functions
Lets all pollute the global namespace with trash!
>>
>>59481988
>>>/g/wdg
>>
>>59481973
I tried that in the beginning, but of course it doesn't work. It gives me:
>TypeError: 'float' object cannot be interpreted as an integer
>>
>>59482006
A free function doesn't have to be in the global namespace
>>
>>59482015
I don't wanna test this, but maybe it should be
range(0.0, 1.0, 0.1)
>>
>>59482033
>Python doesn't even have static types and it's STILL more awkward to use than Haskell
embarassing
>>
>>59482015
you could do something like


for x in range(0,10):
x = x * 0.1



or use numpy
>>
>>59482015
>>59482033
I tested it anyway, lol. Apparantly you can't do that shit in Python. Sorry for misleading you, I just wasn't sure.
>>
>>59482050
yeah, I guess I'll go with it even though that's retarded
>>
File: file.png (9KB, 85x88px) Image search: [Google]
file.png
9KB, 85x88px
>>59475371
nothing
>>
>>59475371
>What are you working on, /g/?


def prInt(print_statement):
return print_statement

print(prInt("Hello World"))
>>
New thread:

>>59482218
>>59482218
>>59482218
>>
>>59476273
>>59476291

You are doing two differnt things here!

"acc - 5" is the same as "acc.-(5)", the operator you defined.

But "acc -= 5" means "acc = acc - 5", which is something differnt:
First you are are calling the "acc.-(5)" method which returns "self.balance -= 5", and that is a number! So you casted your bank account to a simple number:

acc = Bank.new(20)
acc.-(5)
puts acc.class # output: Bank
acc -= 5
puts acc.class # output: Fixnum


Next you Next you call "acc.-(5)", but that does nothing. You might as well write "10 - 5": it is a logical operation, but doesn't assign anything. You your Fixnum doesn't change any longer and it seems "broken".


tl;dr: Don't overwrite standard operators unless you know what you are doing.
Scripting langauges like Ruby are great becasue of the power they give you (i.e. implicit casting), but that power can be abused. Especially Ruby lets you do a lot of funky shit. Better keep it simple unless you are an intermediate programmer.
Thread posts: 313
Thread images: 26


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