/dpt/ - Daily Programmmmmmmmmmming Thread

What are you working on, Sup Forums?

Last most newly created thread:

Other urls found in this thread:

imgur.com/7vAS2Zm
github.com/jtv/libpqxx/releases/tag/6.0.0
twitter.com/SFWRedditImages

Learn the Haskell programming language

please use an anime image next time

>please use an anime image next time
birds are anime

>please use an anime image next time
Fuck off animefag.

>please use an anime image next time
Unironically kill yourself

Let's check
>lazy evaluation
still in
>prelude
still in
>arbitrary indentations
still in
nope.png

Thanks for using not anime. Today, OP wasn't a fag.

lazy evaluation is good, having both lazy and strict is even better
prelude is better than most standard included libs

please don't turn this thread into a shitpost
1) Sup Forums is an anime imageboard
2) anime girls holding programming books, or engaging in programming, or similar things are a /dpt/ tradition
3) Sup Forums likes anime
if you don't like anime why not try an anime-neutral website like reddit?

>user, what's a monad?

>prelude is better than most standard included libs
Given that other standard included libs are scripting memes that's a low bar.

also
>frogpostboard

in Haskell you use them as a particular way of talking about effects while still remaining pure

they are:
a type constructor M
an instance of the monad typeclass (and hence applicative and functor typeclasses) Monad M, providing the functions:

return :: forall a. a -> M a
(>>=) :: forall a b. M a -> (a -> M b) -> M b

>mixing strict and lazy evaluation without polarized types

>lazy evaluation is good
not as default, as ghc demonstrates

what are polarized types ,user?

Friendly reminder that J is the best functional programming language

x86 assembly or Haskell? Which is more worthwhile?

it doesn't demonstrate that though, people rely on laziness all the time
both strictness and laziness are good, and depending on what you're writing, a different default is more suited
in Haskell, since you use functional programming, function composition, streams, etc so often, laziness is a sensible default
in C strictness is a sensible default, even though you have short-circuiting for operators like &&, ||, etc (though when there are side effects this is different to Haskell)

So Monads are a burrito?

I wish FP would die already.

why would you not learn both

x86 is infinitely more useful.
Haskell is trash, don't use it.
If you want a good FP, learn Idris, Agda, F* etc

learn both
no

Haskell

...

DELETE THIS
HASKELL IS PURE

Using types to parameterize over and mediate between evaluation strategies. Types are assigned polarities which essentially say whether their inhabitants are strict or lazy (for various evaluation orders such as call by value, call by name, call by need, etc.).

how does that relate to data/codata? or is that the same?

LEWD

Training of my penis and pussy hentai generator should be done in at most 12 hours. The resolution of the output images will be 128x128. Next bit will be writing a script to use the generator to decensor hentai, and we will have the very first hentai decensoring program using AI!
Sample generated images: imgur.com/7vAS2Zm

Same thing, really. Good observation.

So how are they different or more useful than just assigning attributes to check against? Seems like unnecessary complexity.

Imperative fags WISH their language was this cute

does call by name have any benefit over call by need?

Born in a world of Pajeets
Against the odds
We choose to code!

...

>1) Sup Forums is an anime imageboard
"Sup Forums is a simple image-based bulletin board where anyone can post comments and share images. Sup Forums's collaborative-community format was inspired by one of the most popular forums in Japan, Futaba Channel. Different boards are dedicated to different topics, from Japanese anime, manga, and culture to videogames, music, and photography. Users do not need to register an account before participating in the community."
Notice it doesn't say simple image-based ANIME bulletin board. is that way.

>2) anime girls holding programming books, or engaging in programming, or similar things are a /dpt/ tradition
Its been disputed tradition for years. The problem is that you NEET animefags have all day to wait and start a new thread with your stupid pictures.

>3) Sup Forums likes anime
"I know what everyone on Sup Forums likes because I like anime so Sup Forums must like it too!"

>if you don't like anime why not try an anime-neutral website like reddit?
If you don't like being called an animefag why not try necking yourself.

look i get that you've got your own interpretation that the site is a website of immigrants and that it should be about immigrant culture and there isn't any inherent culture to the site itself but please take this to another board like >>>/j/

30+ posts in and you're still arguing about the OP pic. for fuck's sake /dpt/ get it together

c++ is the greatest language of all time

hi Bjarne

But we literally weren't for most of the thread. It was the first 3 or so posts and then the last 2 posts. That's 17%.

>Bring this anal pained by a cartoon

Agreed.

No, I'm Bjarne. That poster was Jason Turner.0

Outside of pure languages like Haskell, evaluation strategy has the potential to influence a program's behaviour (i.e. non-determinism). Polarized types let you reuse all the other type machinery like polymorphism and whatnot to specify (if necessary) the assumptions about evaluation strategy a program makes. Also when you put it in the types it's automatic and you don't need to litter your code with things like `seq`.

I mean, types themselves are really just fancy attributes that you check, but it keeps everything simpler if you stay away from ad-hoc systems like what GHC has for strictness.

I believe the difference between call by name and call by need is that call by need has memoization. Haskell is call by need thanks to purity.

Yes, but is there ever a use case for call by name over call by need?
Also, I think strictness or laziness patterns are quite adequate (though type level may be better as you say).

Why does haskell have such autistic whitespace? Why can't I just use 8 space tabs like a sane person

>8 space tabs
don't do that

I think it would be better if GHC had an option that enabled tabs and gave them a particular number of spaces, like
-tabs=8
But I still think 8 space tabs are retarded.

Call by name works better with effects (not talking about pig disgusting side effects here, but classical control effects like continuations). Call by need is just an optimization of call by name that assumes purity.

I see

this

...

Is there a difference between setting fullscreen on my window vs. setting it on my direct3d swap chain?

Thank you!

no java is the best language

weak

neat github.com/jtv/libpqxx/releases/tag/6.0.0

docs? what does it do, just a stdlib replacement?

official C++ PostgreSQL API

Windows windows doesn't have anything like full screen itself, so you must be using a wrapper library. In that case, I don't know, it probably does something like borderless windowed (maybe with a mode switch) instead of true full screen like you get with a swap chain.

>C++
Get that garbage out of here.

Yeah I'm using SDL. It's a full mode switch but I didn't think SDL was creating anything since I wasn't using a renderer, hence the confusion.

My guess is that SDL gives you borderless windowed mode. Using the swap chain to go full screen will give you exclusive full screen mode, which may be better for performance (and probably give you less latency).

I'm a programmer deep into imperative programming.
I'm considering trying FP. But I'm not sure old dogs can learn to sit or that I'd be able to hold both types of thinking in my head effectively. Anyone have good perspective on this?

I'd really like to play with Common Lisp after having a great deal of fun with The Little Schemer, but I'm having a hard time coping with the environment. The REPL scares me, and while emacs is neat actually using it feels like a cluster.
Can I treat LISP like I might treat Scheme, and write it and run it in two distinct parts, at least to get started?
help pls

you can pick it up
what languages do you use

Not that user but I just quick checked the source and looks like you're right.

C-like C++.
Embedded programmer. So it's not gonna be professionally relevant. I'm just interested. I've just felt that taking in other things leave me with too many questions a lot of the time and the insecurity in what's actually going on hurts for something that's supposed to be for fun. I'm suspecting something similar with FP. But I don't know because I haven't tried of course. So I'd like someones perspective.

in C
use more higher level functions, i.e. taking function pointers as arguments
use discriminated unions where relevant

in C++
use more things like ranged for loop, ranged stuff when that comes out (think std::transform, std::accumulate)

if you knew C# i'd recommend F#
since you know C++ I recommend you try D
those are good intermediate languages

>use more higher level functions, i.e. taking function pointers as arguments
Couldn't do that professionally but I could try that for hobby projects.
>ranged for loop
I don't recognize how this is functional in any way.
>try D
I've considered that. Maybe I should.

is scala good? i think i can find excuses to use scala at work

no.
Scala is awful.

>What are you working on, Sup Forums?
nothing, because i am not a stinking, sweaty, proletarist

carry on, plebs.

Let's say I'm working in C# and I have an instance of a derived class as a reference to its base type, Object. I want to get a list of every public field and property on the actual derived class. That should be possible, right? Reflection or something?

That's what reflection does, yes. What are you trying to do?

damn, Vim's command is so weird.
I've been learning and memorizing vim's key for the last 12 hours, but it's really hard to get it.
Should I just abandon vim and stick to emacs for the time being, or should I learn vim for the "Portability" reason?

atom

I'm working on an extension for the Unity editor. The user can drag and drop anything derived from UnityEngine.Object into an editor field and I need to get a list of the public members of its actual type.

Oh, good, you're actually using reflection properly.

You'll have to work on remote files eventually, so learning basic commands is worth it so you don't have to deal with SSHFS or rsync/scp for minor stuff.

I don't understand what haskell is for.

Vim wastes your time, stop using it.
If you want to though, atleast use VS Code or another modern TE with vim keys so you only waste half the time.

Research into lazy evaluation. EDSLs.

Is there a ---simple--- way to get basic random numbers in c++? I just need a fucking random number from 1 to 3.

Even using the c libs and srand() and rand() I get the same number every fucking time even recompiling like wtf.

Just trying to make a fucking stupid rock paper scissors game.

>I don't recognize how this is functional in any way.
if you rearrange the syntax:
for each x in xs
action(x);

xs.forEach((x) => action(x))
xs.forEach(action)

I recommend D as a starting point, because you'll do a ton of range operations

Nigga seed your random number generator

Are you seeding with the same value every time?

Can somebody pls give me some LISP mascot r34?

-> ~ ((()))

you might as well use map/filter on slices, that way you could actually use them as values too.

You need to pass a different seed to srand every time you need a new random number.

Nah I used the time() function like in examples, I know I need a different seed.

Huh. Post relevant code?

Yes if you want.

Might not be an actually answerable question but what language are most free software written in?

make it precise

C, unfortunately.

C, fortunately.

Not C++ unfortunately.

delete these

java has the best naming conventions

prove me wrong