/dpt/ - daily programming thread

git edition

old

Other urls found in this thread:

forum.dlang.org/thread/[email protected]
pastebin.com/RRRnEGeN
twitter.com/SFWRedditGifs

First for D

12 posts too early edition


What are you working on, Sup Forums?

Hey /dpt/, I was wondering what the best way to terminate a python application when a certain key combo is pressed would be?

Fourth for Rust

Fifth for Forth

I'm the guy who wanted to write a scheme interpreter. I finished the lexer and parser, so I'll get to start designing the VM soon. If I implement unhygienic macros and quasiquotation then I'll still be able to implement many of the syntax keywords in terms of others, and I can make it available to players since I have a good idea of how to break the evaluation up into interpreter steps.

why do weebs gather in these threads?
what's the relationship between coding and being a goddamn faggot?

forum.dlang.org/thread/[email protected]

I mean, this guy does bring up some good points, but I find it funny he was butthurt enough to make an account just to post this entire rant.

Animu indexer.

Wrote my own simple decoder for Usenet articles since the one I was using was shit. Also changed the design after an user on the /wdg/ hugely helped me with the styling.
Hopefully tomorrow I can start downloading a few thousand images for the series I've indexed, then I can start working on a proper API.

Please delete this pajeet thread.

calm down user there's no point making a fuss at this point
old thread at 313 and we're 10 posts into this one

So what do I do after learning the basics of a language?

Is that language Haskell?

Point 8 is cancer, he should be embarrassed of himself.

It's nice that the D community is so normal and non-SJW that someone can go to their forum and post a dozen paragraph "your language is shit" thread without being banned

Much better than 4cha-

I know the basics of c, c++, and python but don't know what to do now

Unlearn Python

I need the solution manual to the 3rd edition of Intro to Algorithms. Anyone know where I can find it?

Learn the new C++ standards, they are pretty interesting.

...

I'm trying to grab a variable within a function within a class in python.

main file.
#!/usr/bin/env python

class Aclass():
def __init__(self):
self.returnPrint()

def returnPrint(self):
x=2
if x:
print("returnPrint function")
import second

Aclass()


imported file
#!/usr/bin/env python

h=__import__('__main__').Aclass.returnPrint

print(dir(h))


The imported file doesn't see the variable 'x' at all. How do I fix this?

22th for Go is the best language/platform ever invented

I'm making some simple stuff in PyAudio. I'm new to audio programming

How do you do real-time audio when you have this small buffer you have to constantly fill with a specified number of frames?

I tried setting up another bigger buffer but the audio thread keeps catching up and I get stuttering

I was working my way through K&R and SICP last week, and finished all the exercises for the first chapter of each. Then got really lazy and did nothing this week. Want to change that tomorrow.

Building a regular expression parser entirely in C.
So far it accepts ab, (a|b), a?, a*, a+,
I'm working on escape sequences and compound characters, e.g. "\d" or "[a-z]"

Show code, senpai.

I want to start getting used to .NET Core before work switches over to it - any ideas on console applications to start brushing up on it?

Does python let you introspect a function to get the variables it uses? What kind of shit would that be? The variable x probably doesn't even exist until the function is run, and it will only exist until the function finishes and its environment is dead

You can find it on google

pastebin.com/RRRnEGeN

Link? I can only find the 2nd edition solution manual.

I hope you're using abstract algebraic structures like monoids and rigs for these expressions

>code has been running for more than 3 days
Is this normal for you guys?

>Abtract algebraic structures
>like monoids and rigs for these expressions
This is C, not haskell... I'm building a state automata because that way it matches expressions quickly.

Sounds like it's working

Yeah, that's about the average length of time for most programs

If rngs are rings without identity, are rigs rings without nullification?

>state automata
Are you perhaps using a monad for the state or a comonad for the automata?

rigs are rings without negation
also called semirings
i.e. no additive inverse (and hence no subtraction)

those haskellers trying to put math in everything amirite? xD

Ok, thanks. I know about semirings, but never knew that they could be called rigs.

Hmm cant seem to find it now. I do have it on my home computer though. Ill see if i can find it when i get bqck

Did you did you not read the part about using C?

I really wish Haskell were better for this sort of thing, you can't for instance represent laws or show that something is an instance in multiple ways, or really provide a generic instance for ADTs

C is turing complete
Idris compiles to C
Step up your game


but it would be nice if C had HKTs

>calling inverses "negation"
What is this debauchery?

additive inverse is called negation
no idea where that could have come from

but an indian invented negative numbers

similarly the multiplicative inverse function is often called reciprocation and represented as f(x) = 1/x = x^-1

Thanks for the reassurance anons.

What's your program doing? Finding primes or something?

anyone have any experience with web scratchers?
how do i circumvent ajax?

Want Haskell with dependent types?

"Multiple instances" usually means using records instead of typeclasses, since one of the advantages of typeclasses is exactly that there is at most one canonical instance. Things like Map rely on this coherence to avoid bugs like using a different ordering on different operations. If you wanted to be able to require these instances to satisfy laws, then you would need dependent types just as you would need with a single instance.

it could be just throwing exceptions and populating a log file without you knowing though, had that happen before. ¯\_(ツ)_/¯

There's an alternative, which is to allow defaulting and priority exactly the same way operator precedence works, and allow explicit choose of instances like in Idris, e.g.
fmap#{instName}


Alternatively if you could just have something like
instance Functor MyType where
fmap1 :: fmap
fmap1 = ...

fmap2 :: fmap
fmap2 = ...

someOtherThing :: fmap
someOtherThing = ...

default fmap to fmap1

And other things that rely on something being a functor and optimisations and such can use this

Please do. Thank you. Can any other anons find this? Also, check em.

What do you mean by this? I'm learning Python as we speak. I might want to learn some C later.

In these threads we only like obscure languages that no one actually uses for work.
If they have awful syntax and are verbose even better.

last bump for this, sitting here idle. alternative is going outside

How old is too old to learn programming?

12

I still don't understand.

It's solving the 2D gap equations for the magnetic orderings in the graphene QHE edge states as a function of magnetic field. My 1D code took about 1.5-2 days to run.

Well then you must be doing something wrong.
Mine took only about 5 minutes, I'd recommend you to shut it down and reexamine your code.

user please

What's it using to solve them? Logic or a genetic algorithm?

Logic I believe. I derived the gap equations theoretically and then use a sort of root finding algorithm to find the orderings.

What do the root algo's use?
Numeric or genetic?

Numeric

Sweet summer child, run away from this place before it's too late

Never. Just buck up and read tutorials until it sinks in. It's just thinking and typing,

Is there a reason it's taking so long?

tfw .net wageslave

I'm using Mathematica if that's relevant

but the pay is so high ;_;

Well that might explain it

Try doing it in C or C++ and run it simultaneously

Why does Mathematica run so slow senpai?

(.=) :: MonadState s m => ASetter s s a b -> b -> m ()

>Replace the target of a Lens or all of the targets of a Setter or Traversal in our monadic state with a new value, irrespective of the old.

What did he mean by this, Sup Forums?

assign a new value

But Haskell doesn't support assignment

>Tfw programming is too hard to make a good application

monadic side effects

I don't know what that

I have to create an ASP dotnet core webapp for school, but I dont feel like starting. It's a simple task but I hate dotnet. I just want to pull the strings, I dont want to be pulled by dotNet.

Never, unless you are burned out cunt who doesn't care about learning completely new stuff.

I started at 24, I was NEET the whole time, year and a half later, after spending almost 10-12 h a day every day literally on tutorials and books and doing projects, I am full time employed abroad in germany with starting salary close to 120k/year

I guess with dependent types you could also put the instance that was used (in the Map example) in the type, and only allow things (e.g. intersection) with Map whatevers that used the same instance/implicit?

Haskell has implicit parameters, now please stop trying to ruin typeclasses.

Can't ruin what doesn't work

A 3D cheese pizza MMORPG in WebGL. Gave up on looking for loli / shota models and just shortened and flattened the tits on adult ones lel

First for Python is the fastest.

why do you keep coming back

Fastest runtime failures

It gives me lots of attention and butthurt from autists

This is very encouraging. Thank you

Ya blew it

>first
>91st post
No wonder you like Python.

it's basically spam at this point

>I am full time employed abroad in germany with starting salary close to 120k/year
How did you get the job? need advice please ;_;

No, Python's runtime failures are pretty slow too