/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

strawpoll.me/12023125
github.com/graphitemaster/lambdapp
en.wikipedia.org/wiki/Dynamic_array
twitter.com/NSFWRedditGif

Text editor poll continues
strawpoll.me/12023125

First for C++ is shit.

Java is the only programming language

Implement this data structure in a language of your choice

What are the defining features of that data structure?

It's a tree of a certain element type, except each level you go down in the tree it becomes a list of the previous element type.

E.g. root node is a T, its children are vector, their children are vector, etc

{3,({[], ([[1],[3,4]], [[1,2,3],[4,5,6],[7,8,9]])}, [1,2,3,4])}


There I think I did it in about 6 or 7 languages.

What are vectors?
Don't know C++.

Vectors are elements of a vector space.

I suppose you posed that question because it probably won't fit very well in the type systems of most languages, except the esoteric functional ones.

What's a vector space?

CANI ADDU

Que?

...

I'm asking what vectors are in C++, not math.

You should have been more specific then.

>be me
>go to interview in a software company in my area
>after the initial chat, we went for the programming questions
>get asked to write a function to check if a number is prime
>ask if i can write it in python using regular expressions
>they gave me an odd look, but said sure
>write this
is_prime=lambda n:not __import__('re').match(r"1?$|(11+?)\1+$","1"*n)

>get promoted instantly to CEO

>question about vectors
>being asked in daily programming thread
Have a (You).

>things what never happened

Why should I care about anonymous/lambda functions?

how socially inept are you that you can't communicate well on an imageboard?

are you the same autist from x threads ago that was raging about how c++ vectors don't adhere to the pure mathematical definition of a vector?

because if C had lambdas and closures it would literally be lisp in c syntax.

So why should I care? What are they good for that I can't just implement otherwise?

I'll be implementing lambdaC.
Somebody make a logo

github.com/graphitemaster/lambdapp

you mean javascript?

It saves you a couple lines. That's about it.

...for fags
enjoy your bloated garbage

>more people use web toy that is Atom than Emacs

where is your Stallman now?

Name one practical use for it.

enjoy your typecheck errors, pleb

the fuck is so esoteric about idris?

No it wouldn't. C macros are trash compared to Lisp macros.

I use fucking acme because I'm cool

>programming challenges
>practical

Think of them as arrays that can grow in size.
It's not perfectly true, but it's close enough.

...

no you don't.

Java has better macros than C.
At least you can get compiler macros that way.

Just a genuine question. It seems like a lot of abstraction for a little laziness.

Euclidean vectors or an element in vector space?

I'm working on my image viewer, Ivy. I now have this window that you can open that has all the errors that may have occurred. Took me a little while to figure out how to get the (current-error-port) to write all its information to the error log window - what I ended up doing was saving the old error port, creating a custom output-port that writes both to the old error port and to the error log window, then set that as the new (current-error-port). This way, any errors will appear in both the window and on the command line.

both

Euclidean vectors describe direction and length, think of it as an alternative to Euclidean coordinates.

Vector space stuff I don't know a lot about, you should probably look that up in Wikipedia.

>Java has better macros than C
Java doesn't even have macros.

s/Euclidean coordinates/Cartesian coordinates

Vector Space is a class, while Euclidean Vectors are an instance of said class.

Goddamn right I do. alibaba has some pretty decent 3 button mouses, too

what for?

to win internet points?

>alibaba has some pretty decent 3 button mouses, too
link one, please

>tfw no holographic monochrome screen dev rig

y live

kys then

Without S-expressions? No, it would be just C with lambdas and closures.

>here's something that most type systems can't handle! :^^^)

Also, it's totally useless.

mb i will

then ull half 2 live with that the rest of ur life

How did you get a copy of my CS 101 Final Project?!

>hinstance
no wonder that EVAs went berserk if they used Win32 API

>"theoretical"
>fuck off

even algebraic geometry is more useful

Thinking about making something like ncurses from scratch.

I found out about blessed for node.js and it's pretty cool, aside from the fact the code is ugly as fuck, the widgets it can make are nice.

I already wrote a terminfo parser and library, now I just need to figure out a good API that's ergonomic enough to use and to create additional widgets.

If it's not a C library, it's shit.

>C++ is too hard
it teaches you how to not be a pussy and take care of yourself

I don't give two fucks about C since I don't make software with it anymore.

But thanks for your extremely valuable input!

CS50 worth it?

Every library that doesn't have a C ABI is complete garbage.
You're basically making your library far, far less useful and are tying it to your shitty meme languages for no reason.

every penny

>take care of yourself
I primarily program in C.
I don't consider C++ to be hard, I just consider it to be fucking retarded and designed extremely poorly.

This is trivial in any dynamically typed language. Ruby, Python, JavaScript, Lisp (and the majority of its variants), Lua, and many others can create an array/list that can store objects of different types.

In C++, I could probably generate that with some template magic and recursion, but only up to a known finite depth.

>ABI
API*
although you need the ABI too.

Having a C ABI implies making the API much less ergonomic, which I'm not interested in.

You have ncurses, it's shit, use it and enjoy yourself, I'm going to make a library I enjoy using myself.

All the software I make, I make for myself, I couldn't care less about how useful it is to other people.

>All the software I make, I make for myself, I couldn't care less about how useful it is to other people.
Ok, I'll give you that.
Due to the fact that you were "advertising" here, and were worried about ergonomics, it seemed like you actually wanted other people to use it.

ncurses is fine and you like making life hard for everybody who doesn't use a meme lang

>This is trivial in any dynamically typed language
But is it type safe?

>ncurses is fine
Not him, but ncurses has far too much global state and weird macros for my liking.

It's not even remotely "advertising", I didn't link to anything, I'm just doing what you do in a /dpt/, talk about what you're working on.

Obviously I'm concerned about having an ergonomic API, or I'd be using ncurses.

If ncurses is fine, how am I making life hard for anyone by making an alternative for me (and anyone who wishes) to use?

it's a joke my dude

>It's not even remotely "advertising",
I meant to say ' "advertising" your intentions'. And the scare quotes were to say you aren't actually advertising.

huh, well i do see your point and I resp- FUCKINNNGG KILL YOURSELF YOU FAT NASTY TRASH

>things i stole from reddit

So in short, you're saying nothing, against someone answering the question in OP, nice job!

this

>So in short, you're saying nothing
Pretty much. Once you said that it was only for personal use, I stopped caring.
I just keep replying because I want those (You)s.

It's for personal use, but it's open source, and will be released.

So here, have another (((You))).

>It's for personal use, but it's open source, and will be released.
That's fine. Most of my shit is like that too.

made one of these meme triangles desu

because it's fucking awesome, that's why.
fucking hell, i guess the vendor folded. but the 3 button being sold on amazon rn is 15 bucks and works well enough for chording.
works fine enough for chording, and it's 15 bucks, so yeah. 11 left atm
i actually reverse engineered it

>implying AG is not useful

its not a triangle its a polygon

thanks! I'll get into it, then.

>polygon

As opposed to a unigon?

WTF these threads are only fa/g/s taking shit instead of discussing projects. I'm working on going thru Project Euler with C++, I'm on question 3

Wew

Employed Haskell programmer reporting in

Mommy finally made you go flip patties in the McD's?

>strawpoll.me/12023125
>text editor i use and like most

I use Vim the most but I hate it.
It's just the least worst for me.

The fact you need to say this rather than just acknowledging an obvious joke is rather pathetic, you subhuman.

Jesus fucking Christ. EVERY good programming language is literally just lambda calculus plus a few features. Underselling potentially the greatest human discovery of the 20th century like this is disgusting.

Having a C ABI means that a library can be trivially ported to other languages without rewriting a lot of code.

It is if the container class manipulating it has correct code.

I'm not a C++ user but I'm guessing that they're dynamic arrays.

en.wikipedia.org/wiki/Dynamic_array

TLDR a data structure like an array but when its full just makes a bigger array and copies everything over. Size grows geometrically so you have to do the copying less and less as it gets large but the trade off is wasted space.

Anyone have experience with NVidia FLEX? Documentation seems pretty sparse.

Kek