/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

dlang.org/comparison.html
dlang.org/phobos/index.html
dlang.org/spec/garbage.html
dlang.org/blog/2017/03/20/dont-fear-the-reaper/
dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
wiki.dlang.org/Books
paste.installgentoo.com/view/raw/b6c413f6
tour.golang.org
golang-book.com
dave.cheney.net/2015/07/02/why-go-and-rust-are-not-competitors
techempower.com/benchmarks/#section=data-r14&hw=ph&test=plaintext
developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/ByteString#copyFrom-java.lang.String-java.nio.charset.Charset-
twitter.com/NSFWRedditVideo

Stuff

Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); she's super duper cute; and she's a blast to write in! Say something nice about her, /dpt/!
>Features
dlang.org/comparison.html
>Standard library
dlang.org/phobos/index.html
>GC
dlang.org/spec/garbage.html
dlang.org/blog/2017/03/20/dont-fear-the-reaper/
dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
>Books
wiki.dlang.org/Books

Modern C and further learning dlang-chan.

Reminder that this is the shit FP fags have to go through daily to get anything done and they all have ptsd from it
(define arity-includes?
(lambda (a i)
(and (>= i (car a))
(or (not (cdr a))
(

@60628421
FP != lispshit

>hate Python
>want to find some fairly popular and simple language
>discover Lua
>learn it suffers from backward incompatibility
>hate Lua
What next should I look?

I wanna cuddle with Dlang-chan.

I think I'm finally getting a hang of the functional programming meme.

Rate my elm fizzbuzz, /dpt/
range s e =
if s == e then
[e]
else
[s] ++ range (s + 1) e

fizz n =
if n % 15 == 0 then
"FizzBuzz"
else if n % 5 == 0 then
"Buzz"
else if n % 3 == 0 then
"Fizz"
else
toString n

fizzBuzz l = List.map fizz l

hundies = range 1 100

main =
text (
toString (fizzBuzz hundies)
)

Guile? You sound autistic enough.

OCaml.

I hope that fag who was shitposting like mad last night is at the bottom of some ravine.

Rate my terminal rice script!
It takes the color palette from an image and overwrites your xfce4-terminal config to match it.
Surely, this could be written for any terminal config, I'm only familiar with one though.

paste.installgentoo.com/view/raw/b6c413f6

Fixed so the syntax highlighting doesn't go to shit
(define arity-includes?
(lambda (a i)
(and (>= i (car a))
(or (not (cdr a))
(

...

I need some BASIC-like, not new fun functional languages.

It's a good time to learn Go:
tour.golang.org
golang-book.com

>even Google has just ditched Go in favor of Kotlin
>it's a good time to learn it
Why is /dpt/ so fuck of necrophiles?

@60628517
g* literally has zero superior use cases, google shill.

>BASIC
brain cancer. Seriously get yourself out of it asap

A SHILL!
A SHILLY SHILL!
A SHILLY SHILLY SHILL-SHILL!!

AFAIK, Go and Kotlin have different uses.

@60628575
main.go:5: syntax error: unexpected semicolon or newline before {
it needs put out of its misery

trying to implement clustering to differentiate between two of the same object in a image
im doing sift to extract keypoints and i want to implement some form of cluster analysis
any tips on which one would be good?
thinking maybe structured prediction or k-nearest neighbors

What the fuck. Get this shit out of here holy crap. Ew.

The program is more efficient if you do not check for divisibility by 15 for fizzbuzz. You only need to check for divisibility by 3 and 5. 15 is a subcase for which you have already done the computation at each step. It's redundant.

>Internet: Rust is better than Go
>Go shills: Maybe, but they aren't competitors. ( dave.cheney.net/2015/07/02/why-go-and-rust-are-not-competitors )
>Internet: Kotlin is better than Go
>Go shills: Maybe, but they have different uses.
>Internet: Even modern C++ is better than Go
>Go shills: Maybe, but they have different niches.
Every fucking time.

>Internet: Go is better than Go
>Shill: Maybe, but...
>Shill: ... wha

>google shill
lol no, it's open source and BSD licensed, unlike microsoft shit. you can copy the source code and do whatever you want with it.

>not binary lambda calculus
Lightweight baby.

Fortran.
Do it faggot.

will my language get a waifu when it's complete?
the Sinatra tutorial :^)
nice, I'm not the only nix user here I guess

Go was literally googles attempt at a JS-level language so they can mass-produce pajeets and bootcamp artisans.

but rust and go aren't competitors, you can't write, say, a kernel in go.
kotlin is clearly orientated to replace java in mobile apps... which go doesn't do
c++ is a big ass mess, but it's usually used for different things (mostly high perf programs) than the other langs you mentioned, so...

what, are you telling me that a lang that can do EVERYTHING and can excel at EVERYTHING exists?

I'm still an FP babby though, so I don't know how to do that functionally. Tips? (I also realized I don't need the argument l in my fizzBuzz function declaration)

Already did.
Next?

This is pretty terrible Lisp.

The only legit use case for Go is network services, and all three languages, Rust, Kotlin/JVM and C++, are better at it than Go.

Mathematica.

>I'm still an FP babby though
That has nothing to do with functional programming.
>Tips?
Nesting.

it's mit scheme actually

>already did
So you completely mastered it then? Let's see some advanced program you wrote in Fortran.

Schemes are dialects of Lisp, so is still correct.

Can anyone recommend me a good .NET reference book or something to get up to speed on it?

Nah.

None of your business.

>Rust
not really involved in rust, but I haven't seen much networking stuff done in rust

>Kotlin/JVM
java/jvm are being replaced for good reasons... go solves those problems

>C++
oh yeah, I'm sure you want to write network services in C++

Fuck off then

Make me.

Of course it's terrible Lisp. He's trying to implement classes in Lisp. If you want to write OO code use an OOP language.

If you want to write OO code in Lisp, just use CLOS.

Any suggestions to improve it that don't involve dropping the OOP part?

This nesting gave me a clinical cancer.

> it that don't involve dropping the OOP part?
stick to sepples or java if you need POO to program, pajeet

mit scheme doesn't have clos. lisp has it but also isn't a qt anime girl (male) like scheme is

I would break up that behemoth into smaller functions and compose them where necessary.

>I haven't seen much networking stuff done in rust
Well, it already outperforms Go: techempower.com/benchmarks/#section=data-r14&hw=ph&test=plaintext
>java/jvm are being replaced for good reasons
Java is being replaced with Scala/Kotlin/Whatever, JVM is here to stay. Go's infrastructure is nowhere near JVM.
>I'm sure you want to write network services in C++
I actually do, professionally. If you want the actual high load, like 100Gb/s per 1U server, it's either C or C++.

There is TinyCLOS.

But user, OOP is cute and pretty but all the languages that support it natively smell bad. :-(

Thanks, can't code on phone but will look into

>OOP is cute and pretty
cute girls are nice and simple
only roastie hags need layers and layers to appear attractive. But remove those layers and you reveal their ugliness.

>OOP is cute and pretty

stop being mean to oop-tan she is plenty simple, only types make her bad, but typed languages in general are just awful so no surprise there

>oop-tan she is plenty simple
single inheritance maybe, but MI is T R A S H.

user I love u

multiple inheritance has never been tried
traits are the only path to the future

@60629146
>multiple inheritance has never been tried
nyet, comrade.

embrace the inevitability of traits

i already have.
traits and properties are nice.

hey everyone i just learned javascript

is there any practical use for this language that isn't making shitty spyware websites that will be obsolete in two years

yes, continued use will guarantee your pajeet status for years to come.

javascript guarantees employability now that everyone and their grandmother is writing entire applications and even the backend in pure javascript.

ajax is the most useful feature of javascript it enables you to write things like chat clients

other than that no

thinking of implementing opentracing in Haskell tomorrow, we could use it

>ajax is the most useful feature of javascript it enables you to write things like chat clients
Do you know who invented Ajax?

>nice, I'm not the only nix user here I guess

pretty popular in Haskell community now; I use it personally for many years now as well as using it for in-house and customer projects (currently actually doing terraform + nix + GCE stack)

no
*googles it*
u fokn wot m9

>Well, it already outperforms Go: techempower.com/benchmarks/#section=data-r14&hw=ph&test=plaintext

>Java is being replaced with Scala/Kotlin/Whatever, JVM is here to stay. Go's infrastructure is nowhere near JVM.
does android even use the JVM? also, are Go and Java even comparable in this context? can you write an android app purely in Go?

>I actually do, professionally. If you want the actual high load, like 100Gb/s per 1U server, it's either C or C++.
as I said, high perf. if you don't care about stupidly high performance to the last byte (and don't want potential security issues), you write it in Go. or Rust, or whatever

can anyone source an artist for the OP

nodejs

Hello Baroque-kun. Your taste in music is awful.

What just happen to your English user?

>(define identifier (lamdba (args) ... ))
No, dumbass, if you're going to define a function in scheme, it looks more like

(define (identifier args) ... )

Don't use lambda for every function define.

Also, FP users hate dynamically typed languages like Lisp. One idiot here doesn't even believe there's a such thing as a dynamically typed language.

shitty home automation using python.

>No, dumbass, if you're going to define a function in scheme, it looks more like
>(define (identifier args) ... )
>Don't use lambda for every function define.
But using lambda for every function define makes more sense.
>Also, FP users hate dynamically typed languages like Lisp. One idiot here doesn't even believe there's a such thing as a dynamically typed language.
Scheme isn't dynamically typed, it's untyped.

Workin' on it

>are Go and Java even comparable in this context?
Java/JVM is huge in network services.
>can you write an android app purely in Go?
>you write it in Go. or Rust, or whatever
So, where does Go outshine the others? What's the preferred use case for it?
My point being, there's none, in every concrete case there are better tools for the task.

>So, where does Go outshine the others? What's the preferred use case for it?
Well, you see, there are some things it's better for, and some things other things are better for.

yep I've used it for work too. only been using it about 6 months now on my own computer but I've been messing around with it for the better part of 2 years I think. really wanna see it take off more because it's literally the only distro that just werkz for me

>But using lambda for every function define makes more sense.
We have syntactic sugar for a fucking reason. Using lambdas unnecessarily makes your program look like shit.

>Scheme isn't dynamically typed, it's untyped.
Nah mate, it's dynamically typed. It gives type errors at runtime, which is the definition of dynamic typing.

If I wanted to simulate asteroid orbits in real time, what language would I be using?

>strings aren't numbers

you can add them and they have a zero

Mathematica.

>We have syntactic sugar for a fucking reason. Using lambdas unnecessarily makes your program look like shit.
but functions are first class objects and you must respect the functions by observing that they can be declared just the same as any variable

>Nah mate, it's dynamically typed. It gives type errors at runtime, which is the definition of dynamic typing.
that makes sense but in light of this it really seems like static and dynamic typing have nothing whatsoever in common so it is interesting that they are both called typing

holyC

I want to touch Ran's tails!

can I split a string in java into n-bit chunks?

HolyC is actually really cool along with DolDoc.

If n % 8 == 0 then yes this is trivial (the actual string object may be larger due to bookkeeping data though)
Otherwise no because you'd be trying to split it across a character boundary

>Otherwise no because you'd be trying to split it across a character boundary
but that's exactly what I want
I don't want a character
I want my n bit chunks and do stuff with them

There is literally no reason why you should ever write code dealing with bits at that level in a language like Java. Don't use a screwdriver for nails.

developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/ByteString#copyFrom-java.lang.String-java.nio.charset.Charset-

Verboten.