/dpt/ - Daily Programming Thread

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

Attached: sagiri astolfo uwu.jpg (1098x1209, 1.51M)

Other urls found in this thread:

github.com/rootcoma/imageglitch
github.com/rootcoma/imageglitch/tree/master/shader_filters
nim-lang.org/docs/tut3.html#introduction-macro-arguments
github.com/pragmagic/karax
twitter.com/NSFWRedditGif

ayyylmao

Don't post new threads before the bump limit you fucking moron. Delete this invalid thread.

first for programming

Attached: smokey.jpg (338x450, 134K)

A CLI TicTacToe
I keep rewriting it

Attached: 52592594.png (720x696, 372K)

nth for Nim!

i made a thing that does a thing

Attached: FireShot Capture 006 - Content Split - localhost.png (1314x2161, 1.41M)

Are images broken for anyone else?

Attached: 1545299175439.png (887x557, 536K)

Do logic puzzles and programming puzzles actually make you a better programmer?

Are they the most efficient way to practice?

now animated!

Attached: elaine.gif (512x512, 1.55M)

What is the point of this?

Attached: 1560193989309.jpg (1003x900, 84K)

not too sure about the details but apparently it helps video quality/compression.
just saw this pic and wanted to try to recreate the effect.

Attached: compression3.jpg (1100x413, 128K)

neat, user!

Can you do one of my picture in

had to shrink it a little but here you go.

Attached: face.gif (752x675, 1.86M)

Sort of reminds me of a project I wanted to do to glitch images github.com/rootcoma/imageglitch

Attached: opengl_is_hard.png (1133x807, 557K)

what does it do?

Clearly it blueitizes them.

Loads images into a opengl texture then uses shaders to modify the image. It can create animated images too. It is sort of like a start to shadertoy but for python. github.com/rootcoma/imageglitch/tree/master/shader_filters

Another static scrot

Attached: output.webm (1920x1080, 387K)

interesting

Nimanon, please tell me about the wonders of Nim and why i should use it?

*slow smooth vaporwave plays*

best way to avoid that:
dedicate 1 day to planning what it will look like, avoid feature creep, then figure out how you plan to implement it. Once that's out of the way just write it and don't stop until its finished.

i start trying solve leetcode hard but i need to prepare more. a lot of things i simply don't know.

What is a decent implementation of a unit tester?

Now I just have a class with a private array of objects I'm testing, and a private array of tuples of pointers and expected values, and a test function that tests everything in the array.

I feel like there can be a tester class I can inherit from, or some better way to do this, but I don't know.

>C# doesn't have Option for reference types
Another one

>public Player Player { get; set; }

Ah yes

Hmm cant preview this one.

Attached: output.webm (800x480, 2.12M)

Is this ok to do?
It feels wrong, but I like to keep the public getters capitalized, and there isn't really another word for what I have.

>the wonders of Nim
>why i should use it?
If you like or don't mind Python syntax, but want to make things that aren't bottlenecked by Python, you'll probably love Nim.
If you like Lisp style meta-programming, but not Lisp itself.
Or if you're simply tired of C++'s complexities, and just want a simpler but equally powerful and performant language.
I wouldn't say it has many flashy features, but it has some novelties like
>AST manipulation
>mutually recursive types
>optional whitespace / curly blocks
>simple user defined operators, macros / templates
template `!=` (a, b: untyped): untyped =
not (a == b)

more reading for meta-programming nim-lang.org/docs/tut3.html#introduction-macro-arguments
But Nim isn't all good, it has its dumb parts.
Its static arrays are called arrays, they look like
array[0..5, int] # [0, 0, 0, 0, 0, 0]
But their dynamic arrays are called sequences, they look like
var
x: seq[int] # a reference to a sequence of integers
x = @[1, 2, 3, 4, 5, 6] # the @ turns the array into a sequence allocated on the heap

In OOP, if you want Inheritance and a clear runtime for debugging, you're stuck with being chained to a built-in called RootObj,
type
Person = ref object of RootObj
name*: string # the * means that `name` is accessible from other modules
age: int # no * means that the field is hidden from other modules

As you can also see, Nim opts for weird *s denoting private/public status.
And even though Nim has a better GC than D, they still fell in the same trap of "in the future..." in regards to replacing it.
So TLDR situations: (next post)

Ecosystem > however the fuck the language is

You might like Nim if:
>You're tired of Python's speed/dynamic types, and want something better to just get things done
>You're tired of C++'s complexity, and want something comparable in terms of speed, with the offset of a much smaller community and resources
>You're a webdev who wants to try a statically typed language, and still make stuff for the web
Also check out
github.com/pragmagic/karax
>You like Lisp, still want to retain AST control and meta-programming, but want to try a static language
There's a whole lot I didn't cover, and I'll go into more if you want.

Any boomer devs here?
Why does Apple choose to be the cactus?
What's the point of banning openGL and Java?
But for technologically inept white people (Thots, basedboys, trophy wives), applel would have died ages ago.

more please

is there any point in creating new statically-typed languages without HM type inference?

when you want type inference and static compilation for domain specific use-cases but don't have autism.

>You like Lisp, still want to retain AST control and meta-programming, but want to try a static language

I don't really agree with this one at all. Nim isn't anything like Lisp and I've had a look at how Nim does Meta-programming and it's absolutely ugly as sin. Maybe it's gotten better since the time i looked but god that was ugly. Plus in general Lisp is more than just meta-programming. That's just one knack it's good at.

>muh autism
nice argument, Raj.

Is there a good source for Network Function Virtualization?

is there a way to print the name of a table in Lua?
myTable = { }
print(getname(myTable)) --> myTable

for n, v in pairs(_ENV) do
if v == myTable then
print(n)
end
end

tables dont have names
if you do a = { }
b = a
c = a
a b and c are the same table

Yes, when you want a more powerful type system.

for my purposes works fine
i just need a way of passing the table to C without having to explicitly tell C it's name

Does Nim have a REPL like lisps that can be used for live coding?

Best programming language for shitting in the toilet

Attached: jobsnose.png (213x723, 167K)

Holy SHIT there's a lot of boilerplate in web dev.
I expected React to be a nicer experience and it is, but still. This is insane.

Haskell

>C# doesn't have const parameters or any form of const correctness
Another one

>being incapable of google search

I did google after I asked but you seemed so eager to explain

I'm a millennial but late boomer/early genx nerds who love their Apple II and played all the Infocom games when they were new are often very cool people.

WHat are some uses for the language known as "Oh Camel"?

Attached: camelscreenshot.png (344x725, 217K)

Keep at it, you're going to be the next Notch.

Attached: kaos komputing.jpg (1024x768, 139K)

In gitignore how do you ignore all files that start with "poo"
except the file "poop"
?

poo*
!poop

An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined. Put a backslash ("\") in front of the first "!" for patterns that begin with a literal "!", for example, "\!important!.txt".

it's a general purpose language, so same uses as all the other general purpose languages

thanks frens

Can i use it TOO program camels

Attached: images (13).jpg (303x166, 6K)

pls give suggestions for what to do with sockets

fard in them

the usual is to boil or fry them, I prefer my sockets grilled though

I ought to give you a fard of a lifetime, you ****

>self-censoring "bad words"
You must be 18 to post of here, you little fucking shit.

Attached: 1369446960901.png (256x310, 20K)

I'm 41, I just have a sense of decency, you mother****er

you could try writing a real time collaborative text editor

go back

write a bit torrent client

This is Jow Forums, you cunt. You need to go back.

Attached: 1431431869398.png (457x381, 252K)

it's really neat because you can connect to computers all around the world just be careful of security hackers distribute malware through torrents often and probably scan computers running clients so if your developing one they might try to mess w/ your machine at some point.

Rate my 100% functional programming fizzbuzz

equals = $(if $(filter $1,$2),$1)
slice = $(wordlist 2,$(words $1),$1)
map = $(if $(call equals,$(words $2),0),$(strip $3),$(call map,$1,$(call slice,$2),$3 $(call $1,$(firstword $2),$(words $3))))
replicate = $(if $(call equals,$(words $3),$1),$(strip $3),$(call replicate,$1,$2,$3 $2))
range = $(if $(call equals,$(words $2),$1),$(strip $2),$(call range,$1,$2 $(words $2)))

repeat = $(if $(call equals,$(words $4),$1),$3,$(call repeat,$1,$2,$(call $2,$3),$4 $1))
rotate = $(call slice,$1) $(firstword $1)

cycle = $(firstword $(call repeat,$1,rotate,$2))
select = $(if $1,$1,$2)
concat = $(if $(call equals,$1,_),,$1)$(if $(call equals,$2,_),,$2)
add = $(words $(call replicate,$1,_) $(call replicate,$2,_))
addOne = $(call add,1,$1)

numbers := $(call map,addOne,$(call range,100))
fizz := $(call replicate,2,_) fizz
buzz := $(call replicate,4,_) buzz

fizzbuzz = $(call select,$(call concat,$(call cycle,$2,$(fizz)),$(call cycle,$2,$(buzz))),$1)
result := $(call map,fizzbuzz,$(numbers))

print = $(info $1)

.PHONY: all
all: ; $(call map,print,$(result))

>this is Jow Forums
WRONG

Attached: 1547253413591.png (671x603, 168K)

Not programming related but is there a way to access a ext4 partition from W10 using WSL or something?
I have a HDD with movies and shit and need to transfer it a lmaow10

>Not programming related
Then why the fuck are you asking in the programming thread?
How retarded can you possibly be?

Not programming related but is there a way to lace your shoes with the resistance of a double knot while being able to untie them as easily as a simple knot?

Install Gentoo

Childhood is liking C/Haskell/Idris
Adulthood is liking C++

No, C++ is better than both those languages.

wisdomhood is not liking but acknowledging that C++ and Haskell are all you need

No, machine code is all you need
that doesn't make it good though

C++ and haskell is all you need for the good

>Haskell
Overheadful abstractions
GC
Haskell is far from good

>Haskell is far from good
it's still the closest we got from good

>muh GCand abstractions are bad

Reading comprehension, retard.
Abstractions aren't bad. Abstractions are great, but they're only great if they're efficient.
Abstractions that aren't efficient are pointless and shouldn't exist.

>Reading comprehension
the irony

Attached: 1541561344807.png (1600x2162, 711K)

I said
>Overheadful abstractions
not
>Abstractions
Not my fault you can't read

>2019
> still doubting the efficiency of having a GC.

yeah, bro. enjoy ur daily CVE mitigation.

Attached: yeah anon.png (808x605, 390K)

theres nothing efficient about automatic gc

yes yes, we already know you're retarded you don't have to continue
or are you just fishing (You)s at this point?

Attached: 1549208745451.png (1280x720, 594K)

Java really fucked up GC-based langs and now everyone just assumes they're all exactly like Java and have 40 year collection times.
It's a shame software is so stigma-based and it takes 2 decades longer to shake them than it should.

can opengl be "parallelized" by splitting the screen into parts? aside from tearing along the sides, i cant see why not? unless there's a weird resource sharing...

>can opengl be "parallelized" by splitting the screen into parts?
thats what gpus do already genius

every abstraction has an overhead (i.e. simple function calls)
sure you could inline everything, but then you're just bloating your binary.
Just shows how the "word" efficient has no meaning without context

oracle's hotspot always had the current state-of-art GC.

The only person being retarded here is you.
What I said:
>Overheadful abstractions
What it VERY clearly meant:
>Haskells abstractions are not zero overhead, which is bad
What you thought it meant:
>All abstractions are bad, regardless of efficiency
Proof that you interpreted it that way:
>>muh GCand abstractions are bad
>abstractions are bad
Fuck off, and learn to read

>every abstraction has an overhead
what's the overhead of a macro? an inline procedure? an identifier? a namespace? if statement? ...

zero overhead abstractions don't exist