/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

github.com/aadddddd/shit
cs.ru.nl/~W.Swierstra/Publications/DataTypesALaCarte.pdf
liftweb.net/
playframework.com/
coursera.org/course/progfun
twitter.com/SFWRedditVideos

thank you for using an anime image

How do you find a company name for your software development business?

do a lot of nested threads cause trouble in JAVA?

I get really weird behavior...its so confusing

Will listing Go projects on the CV increase or decrease your value on the job market?

thank you for using a SICP anime image

In the dictionary.

pull a random noun from the dictionary and slap a "solutions" to the end of it.

SICP is entry-level

"Anime solutions" is a pretty good name, in my opinion.

I just finished a shitty text only chan clone:

193.70.41.220:8082

source: github.com/aadddddd/shit

@58770740
>plebthon
stopped reading right there.

You're welcome user

Just make shit up
"Aventi Software" sounds good and I just made that up.
Look up latin words.

Kek binary and hexadecimal is always good to know.
It's still being used a lot and it's so easy to learn.

I've heard people talk about thinking in a programming language.

Is this hyperbolic, meaning simply having a mastery of a language so it's rules are intuitive to you or does the Sapir–Whorf hypothesis possibly apply to programming languages as well?

>does the Sapir–Whorf hypothesis possibly apply to programming languages as well
Yes, of course it does, it's probably the easiest place to see it in action. Someone used to using an OO language will want to use objects for everything, someone used to using a Lisp will want to use macros everywhere, etc.

The brain optimizes out the translation layer at some point.

This, and someone using FP will create software that works.

Well, only mastering a limited number of languages probably affects how you approach problems; Since you spend a lot of your time thinking in terms of the semantics of a language, you will come up with solutions to problems under those semantics as well.
For instance, if a problem requires traverse some sort of structure and you write a lot of C, you'll probably be drawn to for loops, while someone who writes a lot of FP will probably reailze the appropriate fold that would accomplish the task.
It's important when learning multiple languages to realize the equivalencies between the constructs presented in both, and to make sure that you are considering the constructs of both rather than just trying to rephrase constructs from language X into language Y.
FOr instance a new lisper may be tempted to use flags and conditions when it may be a better solution to use higher order functions. But a lisper going to C may try to use recursion and function pointers where it is inappropriate because of C's poor support for the constructs from lisp that is attempting to be emulated.

I should specify that it's more like that person is ONLY used to using certain types of language. The more different languages you know, the less you will be affected.

Reminder

Python is utter garbage

What would you replace it with

See

Haskell

Although well done on making something user even if the language isn't to my taste.

>meme language
No thanks.

In my university we learn Java in a strange way but it presents us with the equivalence between FP and OOP.
For instance the following haskell code:
data NamedColor = Red | Blue | Green
data RGBColor = RGB Float Float Float

toRGB :: NamedColor -> RGBColor
toRGB Red = RGB 255 0 0
toRGB Green = RGB 0 255 0
toRGB Blue = RGB 0 255 0

Is the same as the following Java code:
class RGB {
float r, g, b;
RGB(float r, float g, float b) {
this.r = r;
this.g = g;
this.b = b;
}
}

interface INamedColor {
RGB toRGB();
}

class Red implements INamedColor {
public RGB toRGB() {
return new RGB(255, 0, 0);
}
}

class Green implements INamedColor {
public RGB toRGB() {
return new RGB(0, 255, 0);
}
}

class Blue implements INamedColor {
public RGB toRGB() {
return new RG(0, 0, 255);
}
}

This is of course known the value problem, and while the Java code is obviously more verbose, it does have it's advantages (if you were to add more colors).

This just isn't correct.

How anyone can claim that Go development isn't fast just shows that you don't know what you're talking about.

...

>it does have it's advantages (if you were to add more colors)
class NamedColor a where
toRGB :: a -> RGBColor

newtype Red = Red
instance NamedColor Red where
toRGB Red = RGB 255 0 0

how the fuck do you save instagram photos?

right click doesn't work

i can only save one, by inspecting element... bla bla

>equivalence between FP and OOP
Cool, now implement traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f () in Java.

By the way, the value problem has been solved in FP. Start here: cs.ru.nl/~W.Swierstra/Publications/DataTypesALaCarte.pdf

@58771018
>tumblr

...

Not programming.

Yes, OOP is truly obsolete

class ToRGB a where
toRGB :: a -> RGBColor

-- ad hoc polymorphism through GADTs
data NC where
NC :: ToRGB a => a -> NamedColor

instance ToRGB NC where
toRGB (NC c) = toRGB c

newtype Red = Red
instance ToRGB Red where
toRGB _ = RGB 255 0 0
...

i'm writing a instagram parser to download photos from a random account

i just tried that and doesn't work. i wonder how do other people save them

>OOP is truly obsolete
this assumes it wasn't "obsolete" at some point in time. which is blatantly false

A language as crippled as Go can never be fast to develop in.

It has a shit type system so you don't get distracted with the neat features of Haskell

What language should I learn next?

>Scheme
>Clojure
>Rust
>Idris

Scheme is a meme language. This is my conclusion after taking the EdX Systematic Program Design course from UBC.

The reason is, we spend all kinds of time commenting and templating about what types of data the program should use, but it's all comments that don't do anything.

Trying the same thing in a language with a proper type system would make all the comments redundant and make the programs safer.

I'm going to finish the course, but I'm learning Haskell or OCaml straight after.

You instead spend more time writing the same code over and over and over again.

Any resources out there for great examples of scripts? Doesn't matter the application, language, or industry.

Racket or Rust

Congrats, you've escaped the Lisp delusion.

...

I'd say one advantage Scheme has over say Scala is that it really does have a much tighter and faster development feedback loop. The Scala compiler is painfully slow.

>x is a meme language
stopped reading right there.

>>x is a meme language
>stopped reading right there.
stopped reading right there.

It's meant to be a teaching language. You don't have to specify design recipe bullshit in real programs. They teach this way so that it makes more sense when you are introduced to statically typed languages. And so that you understand that the purpose of types are documentation and verification (not just appeasing the compiler gods, like the poor kids in the intro Java course struggling with the garbage type system).
Python babbies don't even understand the merits to good type systems; they prefer to have special language syntax that are essentially comments ("annotations" gege).

I've been writing a lot of Racket lately and I always include a one line comment and a type signature comment above my functions just so I remember the argument order / return type without having to delve back into the implementation. However I spend the majority of my time writing code or coming up with algorithsm.

More lines of code = more productivity :)

>Scheme

Ultimate meme language (see above).

>Clojure

Good option if you're already on the JVM. Otherwise, why bother?

>Rust

It's never going to replace C.

>Idris

Good candidate.

>meme language
That's where I stopped reading.

>It's never going to replace C.
Just because most people are retarded doesn't mean it's not worth using it yourself where you would otherwise use C or C++.

>It's never going to replace C.
Good job it's not trying to, then. It's trying to replace C++.

Are you a bot?
Also considering filtering "meme language"
But why stop there? Why not just leave Sup Forums entirely?

Pee Pee Software Developement Solutions

He's probably butthurt because somebody called his favorite language a meme language.

>meme language
nice try, but I didn't read any further.
>meme language
stopped reading right there.
and no, in no way did I even imply that I like Scheme.

How do you minimize the need for nested IF statements?

You know it would take you less time to read these posts than to reply to them

That being said, "X is a me** language" is complete cancer

that's not the point. eating my own shit will also take me less time than cooking some quality food but why would i ever want to do that?

Tears falling down his cheek,
Knees trembling, bowels weak,
He shouts and stamps his feet,
As shit sprays on his seat!

>It's meant to be a teaching language. You don't have to specify design recipe bullshit in real programs. They teach this way so that it makes more sense when you are introduced to statically typed languages.

Why not just start with a statically typed language?

>And so that you understand that the purpose of types are documentation and verification (not just appeasing the compiler gods, like the poor kids in the intro Java course struggling with the garbage type system).

I agree with "documentation and verification". However, a type signature comment does not provide any verification.

>Python babbies don't even understand the merits to good type systems; they prefer to have special language syntax that are essentially comments ("annotations" gege).

There are a lot of reasons for a Racket hacker to legitimately snob out against Python, but I don't think types is one of them.

>I've been writing a lot of Racket lately and I always include a one line comment and a type signature comment above my functions just so I remember the argument order / return type without having to delve back into the implementation. However I spend the majority of my time writing code or coming up with algorithsm.

Cool that you're doing productive work in Racket. I can definitely see, after using it for a few weeks, what a good dev environment it is.

Learn boolean algebra better?

>Why not just start with a statically typed language?
>I agree with "documentation and verification". However, a type signature comment does not provide any verification.
You are a beginner and we would prefer you not have to fight with the verification tools just yet.

>There are a lot of reasons for a Racket hacker to legitimately snob out against Python, but I don't think types is one of them.
Fair enough.

>Cool that you're doing productive work in Racket. I can definitely see, after using it for a few weeks, what a good dev environment it is.
I really enjoy it. But I'm mainly doing PL stuff, which is kind of what Racket is pushing to be good at anyways.
I also used it to generate plots for a physics lab report, which was very neat and easy to use.

>You are a beginner and we would prefer you not have to fight with the verification tools just yet.
So instead you have to fight more with the debugging tools struggling to figure out an error a compiler could have told you about much more quickly?

see
Though, I would personally say Racket before Rust.

You write tests for every single one of your functions, which are short anyways. HtDP curriculum is supposed to put absolute minimal mental load on the first semester programmer in terms of concepts, which are introduced incrementally.

>I've been writing a lot of Racket lately and I always include a one line comment and a type signature comment above my functions just so I remember the argument order / return type without having to delve back into the implementation. However I spend the majority of my time writing code or coming up with algorithsm.
Use contracts

>use memes

Types make testing easier.

Is it true that LLVM optimisation quality drops significantly when it's used to produce concurrency-type codules?

(check-expect (my-func ..) expected-result)
Is extremely easy to understand for someone who has never touched a programming language before, and is sufficient for basic testing. Semester 1 does not intend to make you a professional software developer.

I can see we have different outlooks on this... my first term at uni was all about types, we used ML.

dynamic typing must be destroyed

Depends on whether or not it's a low level language. If it is then no, otherwise then it would.

If I were interviewing you I'd ask what you thought of Go.

float x = 2.55;
printf("x to the 4th power = %g\n", powf(x,2));


Why doesn't this work in C? Can pow not take variables as arguments?

So, what's the best web back-end language for someone who has a strong programming / software development background?

I don't want to waste time with bad but "easy" languages, I want the most reliable and best designed back-end language there is. Google isn't really helping with this, since all I get from searching are results such as "most in-demand languages" or "highest paying languages", which are hardly good metrics for what I want to know.

Anyone can give me suggestions? Is PHP worth it or is it considered garbage in this day and age?

>wants x^4
>computes x^2

Well what's the error you're getting

Scala with Lift or Play

liftweb.net/
playframework.com/

COBOL

Maybe you should be more specific about the error you're having.
That should work.

Scala is a meme

Play! is a meme within a meme

Just says undefined reference to `powf '

Add -lm to your command line arguments.
You didn't link the math library. It's a common beginner mistake.

Link with -lm

>to your command line arguments
To your compiler command line arguments, I mean.
So gcc prog.c -o prog -lm or whatever

thanks dudes

whats weird is it works without linking as long as I don't include a variable in the arguments. e.g. this compiles with no error:
printf("2 to the 4th power = %g\n", powf(2,4));

The optimiser would have removed the call to powf and just replaced it with a constant value.

Seems interesting, I'll look into it.

I wouldn't touch that with a 10-foot pole.

Calling things a meme is a meme.

Yes, we all know ""X is a meme" is a meme" is a meme.

>meme is a meme in meme meme
okay

>Seems interesting, I'll look into it.
In-depth Scala course:
coursera.org/course/progfun

>when you realize you're nothing but a bundle of memes trapped in skin, flesh and bones

Iven thinking to start learning to code shit

i was told to learn html and css and python/java

Now is that a legit good recommendation?

and where do i go to learn i was looking the lynda courses

Is this the new Millhouse? Have we come full circle?