/dpt/ - Daily Programming Thread

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

Attached: 1566069410496.png (600x600, 73K)

Other urls found in this thread:

en.wikipedia.org/wiki/Unicode_character_property.
hackage.haskell.org/package/kan-extensions-5.2/docs/Control-Monad-Co.html#t:CoT
hackage.haskell.org/package/comonad
comonad.com/reader/2011/monad-transformers-from-comonads/
github.com/CorentinJ/Real-Time-Voice-Cloning
twitter.com/NSFWRedditGif

>73KB

Attached: 1568218792840(1).png (600x600, 33K)

cool OP

Early thread dumb threadmaking autist

He did fine.

Yeah, at least he used a cartoon in a western style instead of an incel animetard cumbrain image of a girl (possibly very obviously underage)

Why do people think it's a good idea to learn programming at the college level instead of on your own?

>took one C++ class once because i was dumb kid
>hardest project was a menu based "banking program" that added numbers and stored them in a vector and had no persistence
>did this all without knowing what structs or classes are
>got marked down the first week for using for loops because we haven't covered them yet and i didn't want to write a 300 line program that could be condensed in 20 with a loop
>they didn't even touch on saving to a text file, that would be beyond the scope of the class WTF
>teacher didn't even correct my improper usage of getchar(), system("pause") and even calling main() to go back to the main menu instead of using return on the final
>left with a bad taste of programming, thinking everything is too hard and hard to grasp

Attached: am i retarded??.png (891x633, 794K)

BASED C!

Compile time is important. Big sepples applications embed Lua so they don't have to put up with compile times.

Is there a way to find out which category a Unicode character belongs to? See en.wikipedia.org/wiki/Unicode_character_property. I need to check whether a character belongs to the Z group specifically.

>Why
They don't know anything about programming.

How?

Oh goood.

Attached: 1567545708072.jpg (400x580, 225K)

CRINGE C!

Because sepples ruins everything it touches.

you will never be real woman rusttranny.

embed lisp*

Anyone?

Selling more iPhones to fools with to much money and fools that wants to take a loan

I want to FUCK C!
She is petite, swallows anything you feed her while complaining and she does everything well and fast!
She might be dangerous and make retarded faces out of blue but that's her charm!

>swallows anything you feed her while complaining
One of the most accurate Freudian slips I've ever seen.

You have to go to discord tranny

Are you trying to identify whitespace?

In this case yes. But I also want to know how to identify a group a character belongs to.

hackage.haskell.org/package/kan-extensions-5.2/docs/Control-Monad-Co.html#t:CoT
WHAT ARE YOU FOR?

Attached: 1563572034500.jpg (1200x900, 83K)

trying to learn cpp was a mistake. I'm writing code to turn a vector into a comma separated string and I'm frankly disgusted.

Attached: Screen Shot 2019-09-11 at 9.57.38 AM.png (1050x518, 77K)

its a monad transformer for the co monad. if you dont know what a monad transformer is dont use CoT and focus on Co

>its a monad transformer
that much is obvious

Attached: 1564430533647.jpg (462x393, 66K)

im gonna be honest lad I dont even know what a comonad is so you're on your own for this one.

it's a comonoid in a category of endofunctors

is that a little bit like a burrito?

class Functor w => Comonad w where
extract :: w a -> a
-- coreturn
extend :: w a -> (w a -> b) -> w b
-- cobind
duplicate :: w a -> w (w a)
-- cojoin

but monad is category of endofunctors so everything is is category of endofunctors so nothing is category of endofunctors.

Are you using a particular platform/language?

in what programming language?

but think how fast you're going to comma-separate things. it's going to be mind-blowing.

Is there a better way for checking a boolean flag (a user configurable option) from within a loop? For example the flag controls whether result of operation get written to log file, like so:
LogResult= Yes
for File in FucktonOfFiles:
Result = do Shit to File
if LogResult:
write Result to Log
I could write two versions of the loop and do the if check before them but that's redundant code, besides in my real world implementation there is more than just one parameter so there would be many more copies than just two.

type f ~> g = forall a . f a -> g a

-- pseudocode
type (f . g) x = f (g x)
type I a = a

join :: f . f ~> f
duplicate :: f ~> f . f

return :: I ~> f
extract :: f ~> I

-- join . return = id
-- extract . duplicate = id

C

...

I'm back to learning Python after 2 years, and I think I forgot everything ffs

Why is this shit not printing like it should ?
I just want to convert a str to a datetime.
The print statement inside the for loop works, but the outside one doesn't

date is a list of str

for j in range(len(date)):
date[j] = datetime.strptime(date[j], "%Y-%m-%d")
print(date[j])
print(date[j])


Output :
[datetime.datetime(2015, 8, 30, 0, 0), datetime.datetime(2014, 9, 11, 0, 0), datetime.datetime(2018, 7, 13, 0, 0), datetime.datetime(2019, 8, 4, 0, 0),

j does not exist outside of for loop?

Does this help?
f = doLogged if logResult else doUnlogged
for file in files:
f(file)

so comonads are the exact opposite of a monad
based

i was hoping youd have some sort of library that would do this for me.

ty for translating

Identity is a monad and comonad
(,) a is a comonad, and when a is a monoid it's a monad
(->) a is a monad, and when a is a monoid it's a comonad

I mean they are also monads/comonads in those situations
Just look at hackage.haskell.org/package/comonad

Still no idea what the fuck CoT is used for

by Z group do you mean these 3 groups? It says there are only 19 of them, so I guess you could just check them all them all.

Zs Separator, space Graphic Character 17 Includes the space, but not TAB, CR, or LF, which are Cc
Zl Separator, line Format Character 1 Only U+2028 line separator (LSEP)
Zp Separator, paragraph Format Character 1 Only U+2029 paragraph separator (PSEP)

no it doesn't

when i try
print(date)

it gives me the same garbled output

hopefully there is but I don't write C++ these days.
even though the speed would be mind blowing.

What if there was more than one parameter to be checked?
LogResult = Yes
Verbosely = Yes
InKlingon = No

What exactly is your problem? That's the exact representation of a datetime object.
>>> repr(datetime.datetime.now())
'datetime.datetime(2019, 9, 11, 17, 15, 54, 356535)'
You generally don't print a list object itself (which will get the representation instead of string value of every member), but every element of the list. Compare
print(date)
with
print(*date, sep=', ')

its for putting the comonad-dervived comonad into your monad transformer stack, whats so hard to understand?

Can this be optimized?

if (reference->y == y && reference->x == x) return EQ;

bool vertical = reference->y > y;
bool horizontal = reference->x > x;

return (vertical * 2) | horizontal;

C99.

>inb4 cnile
>inb4 use instead

i've found this
comonad.com/reader/2011/monad-transformers-from-comonads/

use instead cnile

yep that seems to be the essay its based on
the author appears to be obsessed with comonads and not any practical applications of them. seems right now he's exploring comonads for fun and might stumble on an application one day.

it does not look like the logic is correct
what if one is the same but the other is not
you will not return EQ
and then your bit packed result will lead you to believe the one that was equal was actually less than as it will be a 0 which I am assuming represents less than

The demons deleted a Bible Mandela effect thread on /x/ and scrubbed my post from the archive after I pointed out the demons are editing the Bible. Also is this valid Haskell?
main = main

there's some gui autism talk somewhere
comonads are even more useless than monads
yes

monads are based though

why you guys so schizo

Unless performance is a big problem, I would just check the boolean each time. It shouldn't be the bottleneck here. However, if your question is about customizing behavior, you could combine several functions. Or if you want to try it OOP style, use the Strategy Pattern.

so long no see

Attached: haskell tiddy monster.png (1075x1518, 1.34M)

It essentially compares ordered pairs so I want it to only return EQ if x and y are equivalent

how did the demons edit the bible? what did the bible say before and what does it say now?

I'm the author of this, currently refactoring all

github.com/CorentinJ/Real-Time-Voice-Cloning

if her tits are a comonad is she the Co monad for her tits

anyway it is probably faster to do the subtraction and then check the values with a signum like function then to do multiple conditional statements
but like I said the interface you have does not allow you to express if only one of them is equal

Any front-end devs here? What kind of patterns have you found to work well?

Some key points I've come across:
- State *must* be separated from UI components
- Immutability for state is a must, Redux is great for that
- Event-based program flow is also a must, Redux is great again here when you combine it with something that can perform side effects
- If your components are so monolithic you need to give option parameters to them, they're too big - split them up and use smaller parts instead

because ur a fag
It used to say when two or more gather in my name. Now it says two or three.

Not him but humans have always been editing and translating the Bible for almost a couple thousand years now, and humans are imperfect, so what the Bible says now isn't exactly what it said before. Those imperfections can be put into a religious context and labelled as demons. To be fair, the original bible was also written and compiled by imperfect humans as well though, so it's hard to say if the original bible is more correct and truthful than modern bibles

How's (,) not suitable for a monad instance if you just ignore the left side when doing "a >>= b"?

1) You need a return function which has to pick an A for (A, _)
2) You need >>= return to be id.
The ((,) a) instance is the writer monad. For return it gives you (mempty, _) and for >>= it accumulates the left hand side. (w1, _) >> (w2, a) = (w1 w2, a)

>it's hard to say if the original bible is more correct and truthful than modern bibles
It probably is by nature since it mutated less but it still might be hard to extract the genuine intended message because for all we know the powers that be could've corrupted education on the historical context of that era.

Right, fuck, you can't write return if the non-value side isn't a monoid

why do you say that? in context "two or three" makes perfect sense. what benefit do demons get out of this?

All right thanks, I'll look into it. Just thought there was some canonical more elegant and optimized way to do it.

Lisp is the most powerful programming language.

Well two or more could be referring to a congregation. Two or three is a lot more atomized and therefore a lot easier to oppress or control.

similarly

oh alright, i didnt know you shouldnt print a list

I guess my code was alright since the beginnig, thanks

Baste

the monad transformer bit is apparently useless
newtype Co w a = Co { runCo :: forall r . w (a -> r) -> r }

with w = Identity you get Cont, so this is apparently a generalisation of Cont

There may be but you can spend a lot of time optimizing things that don't need it.

I actually interpret the verse a different way. Re-read the entire verse(Matthew 18:15-20), then 2 Corinthians 13:1. Mathew is making pointed references to Jewish law during the passage.

He's not saying that the only way for the Father to be with you is to have two or three people; indeed the Father is with you even if you are alone or amonst a congregation. The passage is about community discipline and how the Father is with you even in that context.

is there a real reason why you can't have nesting comments in C or is the standards body just a running joke
did you know they added more trigraphs in C99 and more in C11

What's wrong with trigraphs? Aren't they necessary in some embedded situations? It's not like they expect you to be using them while editing code on your workstation.

which scheme implementation should I use on windows?
>inb4 you shouldn't be using windows

Attached: 1539507105460.jpg (1410x1200, 1.34M)

Racket :)

Shouldn't be using windows for dec stuff especially more obscure shit like lisp dev. Windows actively makes setting up environments for that shit hard because it's designed for monolithic do-everything applications. Linux makes it easy, and these lisp interpreters are usually developed on Linux for linux

what is the output of the following line?

printf("How are you???(I hope you're doing well)")

i'm learning python from c background, their data type is really weird it confused me sometimes

/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld:xc: file format not recognized; treating as linker script
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld:xc:1: syntax error
collect2: error: ld returned 1 exit status

epic

true 100% autism

>
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld ...
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld ...


instant PTSD, why is linking stuff such a mess

p.s. gcc and clang just completely ignored the new trigraphs added to the standard and did not implement them thankfuly

try with --std=c11