[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 320
Thread images: 18

File: shig pee.jpg (133KB, 960x624px) Image search: [Google]
shig pee.jpg
133KB, 960x624px
Old thread: >>52491552

What are you working on, /g/?
>>
>>52496734
First for D
>>
Reading this: https://pigworker.wordpress.com/2015/01/05/linear-dependent-types/
>>
File: 1451218684895.jpg (412KB, 1920x1080px) Image search: [Google]
1451218684895.jpg
412KB, 1920x1080px
has anyone made their own functioning media player complete with gui?
>>
Any tips and recommendations on GPIB programming? I just want to read some data and store it for further processing.
>>
>>52496734
Writing a DHT in Go
>>
>>52496734
Refreshing myself on C, because I've barely programmed all break and I start an internship tomorrow.
>>
rewriting the linux kernel in ocaml
>>
File: snake title and rand.gif (138KB, 751x579px) Image search: [Google]
snake title and rand.gif
138KB, 751x579px
>>52496734
Your snake loads randomly, with 2 nodes to its right

Fruit is placed randomly, and never ends up on a snake. Fruit placement is also its own subroutine for later

Updated my assembler so that labels work, now there is no need to worry about which address a certain line of code is in
>>
File: playv2.png (5KB, 550x147px) Image search: [Google]
playv2.png
5KB, 550x147px
>>52496781

What time of media player? I made one for music that's super simple, because I wanted something that had library view only, no playlists, etc.
>>
https://www.youtube.com/watch?v=hEx5DNLWGgA

Soon enough, C++ will be "C# without Garbage Collection"
>>
>>52496949
And ugly syntax.
>>
>>52496847
wtf are you even on about, the only two forks in OCaml were the OPAM repo and my fork of ocaml-termbox and my personal projects that i didnt post on github add up to ~16k LoC for OCaml (15,686) and there's a few thousand more lines if i count C that i linked against for those projects.
>>
>>52496921

type**, rather.
>>
>>52496949
>Soon enough, C++ will be "C# without Garbage Collection"

Which will be a good thing, because C# is great to program in.
>>
>>52496741
http://stackoverflow.com/questions/4241545/c-switch-case-curly-braces-after-every-case
>>
>>52496921
Perfect! What language did you write it in? I need to write one in Java but I have no idea where to actually start
>>
>>52496975
>I-I posted my github to s-show my experience b-but it's not my real powerlevel!
>m-my real project isn't there, p-please believe me I-I'm experienced ;_;
Triphomosexuals, not even once.
>>
>>52497021
I too hate case statement fallthrough because it makes me use break statements everywhere.

Forget one break statement? That shit's hard to find.

Braces both get rid of breaks and fallthrough, which is excellent for the most common use case of switches.

Unless you consider compiler optimizations like assembly language-style jump-tables "common".
>>
>>52497043
it's okay, im pretty sure that all the code on my github adds up to at least 10x what you've written
>>
>>52496757
when I read haskell's type system is basically just lambda calculus (and thus turing complete), I figured we'd make a bunch of programs which can handle complex types at compile time, making new types effectively static.

instead we get a bunch of kids dicking about, writing entire operations in the type system
>>
>>52497069
>I-I'm s-sure that m-my 2 l-lines of codes are t-ten times more t-than you've e-ever written, b-b-baka!!!
>>
File: 5DsOPcl.gif (49KB, 500x129px) Image search: [Google]
5DsOPcl.gif
49KB, 500x129px
>>52497069
>>52497043
>>
>>52496734
anyone here good at java and wanna make 300 aus?
>>
>>52497112
Did you literally remove your trip so that you could post that? Don't do this, I can't filter you if you do.
>>
>>52497142
LOO IN THE STREETS
PAJEET IN THE SHEETS
>>
>>52497092
That's the same thing, no?

PS: Haskell's type system isn't Turing-complete. You don't want a type system to be Turing-complete, because that means potential non-termination at compile time.
>>
Is using 'auto' in cpp less efficient than using specific type declarations?
>>
>>52497170
It won't make your program run slower, but the compiler will have extra work to do
>>
>>52497151
no but if you want to make fun of me I can't figure out how to make a GUI MP3 player in java
>>
>>52497092
technically the lambda calculus is untyped by default. the Haskell type system is roughly based on the simply typed lambda calculus but with shit like type classes added in. the idea of writing operations in the type system is pretty rare in Haskell, although some of the language extensions like GADTs allow for it to an extent. and it wouldn't be the type system that's turing complete, but the language itself because the type system mimics the _type system of the simply typed lambda calculus_ and not the entire idea of lambda calculus
>>52497151
nope, im not that autistic. but please filter me if you can't take any sort of criticism when you're objectively wrong
>>
>>52497155
wut
>>
>>52497169
>That's the same thing, no?
depends on what types are to you

are types just flags for pieces of data, thus data themselves? yeah, sure, then you want some sort of basic operations in the type system (existential checks are one).

but if your types aren't data (which happens when a program is constructed poorly), then types end up carrying hard work that its not intended to, creating ambiguity. it's literally the same "be clear and explicit and don't use tricks" argument

>PS: Haskell's type system isn't Turing-complete.

it's turing complete up until it isn't. which is like saying division by zero is an undefined operation, yet my program defines the operation by outputting "Error, division by zero." it's just easier to say it is turing complete and move on
>>
>>52497262
I suggest reading up a bit on type theory and the Curry-Howard correspondence. You'll probably find it interesting and it should show you how useful types can be.
>>
>>52497189
Thanks, I feel fantastic now.
>>
>>52497318
yeah I will because im still struggling all over the place. thanks
>>
Is there a way to make a 500x500 solid-color (say #FFFFFF) square and save it (or upload it) in Python?
>>
>>52497375
imagemagick should do what you're looking for. without looking it up, i'm 100% positive theirs an imagemagick wrapper for python
>>
>>52497375
yeah, you import urllib ad the lib of the format you want to use, then you write it to disk as a binary file
>>
If you ask me (and I know you would not, that's the fun in anonymous imageboards), it seems that F# is an attempt to make functional programming a valid choice in those fields were Java or C# would be used, much like Scala but nicer...
I mean you won't write anything really fast nor have a fantastic type system, but for what it is intended, it should be great... What's the problem with it?
>>
>>52497242
DESIGNATED
ESIGNATEDD
SIGNATEDDE
IGNATEDDES
GNATEDDESI
NATEDDESIG
ATEDDEGIGN
TEDDESIGNA
EDDESIGNAT
DDESIGNATE
>>
Guys, I stumbled upon Nim (because of someone who shills it sometimes here), and I think I'll learn it... Is it worth the time?
>>
>>52497455
how do you program something like this
>>
>>52497038
Start with JavaFX.

I did one too in Java a couple of months ago, not much difficult...
>>
const literals   = [{key:"3":val:"Fizz"},{ key:"5", val:"Buzz"}],
ITERATIONS = 100,
i;

for ( i=0; i<ITERATIONS; i+=1 ){
console.log ( literals.map( (ind)=> {
return !(i%literals[ind].key)?literals[ind].val : "";
}) || i );
}
>>
So I gave in and decided to learn how to properly make makefiles.

Which make-like utility will give me the least headache / has the most shallow learning curve?
>>
>>52497479
Wow, ugly
>>
>>52497473
If you find a toy programming language and you want to learn it, ask yourself first: "Is this programming language significantly different from everything else I've already learned, or is it some C/C++/Java clone with a gimmick?"

In other words: If it's not a completely different language paradigm then forget it. You won't learn anything from it.
>>
>>52497474
Here's a reference C implementation:
int main()
{
char *designated = "DESIGNATED\nESIGNATEDD\nSIGNATEDDE\nIGNATEDDES\nGNATEDDESI\nNATEDDESIG\nATEDDEGIGN\nTEDDESIGNA\nEDDESIGNAT\nDDESIGNATE";
printf(designated);
return 0;
}
>>
>>52497479
>here lemme align these equals operators
>these curly braces don't have the same number of space padding around them
>yeah nah fuck that this is good

you a shit
>>
>>52497474
literally just offset the output of the string by 1, then loop through it. do that for the length of the string
>>
>>52497486
GNU Make
>>
>>52497554
ACKTCHAULLY the best way would be through a circular buffer the exact length of the string.
>>
>>52497567
yeah, of course. loop through the string.
>>
>>52497479
All right /dpt/, let's have a fizzbuzz war.
i;main(){for(;i++<=99;printf("%s%s%.d\n",i%3?"":"Fizz",i%5?"":"Buzz",(i%3&&i%5)*i));}
>>
>>52497555
fuck that's what I was going to do if nobody replied

Thank you for saving my time, kind anon.
>>
File: fizzbuzz of the christ.png (402KB, 1024x768px) Image search: [Google]
fizzbuzz of the christ.png
402KB, 1024x768px
>>52497602
>>
In F#, is a .map operation on a Sequence "lazy"?
>>
>>52497663
>having to use two lines
You fail by default.
Have some Perl.
print'Fizz'x!($_%3).Buzz x!($_%5)||$_,$/for 1..100
>>
>>52497683
That IS a one line operation. It's only split in display because it'll fade to jesus otherwise
>>
>>52497703
It's still too verbose.
Here's some PS:
1..100|%{(($t="Fizz"*!($_%3)+"Buzz"*!($_%5)),$_)[!$t]}
>>
Where should I start if I wan't to include live chat in my Laravel app?
>>
>>52497746
>>52497683
>>52497663
Your code is short, but where is your artistry? You have length, but no beauty!
Here is a fizzbuzz for actual programmers:
(dotimes(i 100)(loop for(m s)in'((3"Fizz")(5"Buzz"))if(=(mod(1+ i)m)0)do(princ s))(do()((fresh-line))(princ(1+ i))))
>>
>>52497751
socket io, or just websockets
>>
>>52497777
nobody gives a fuck about fizzbuzz anymore or your copy pasted code lmao
>>
>>52497780
What's the difference between socket.io and webockets, what are their pros and cons.
Can someone give me the summary on that, so I can decide which one to use?
>>
>>52497777
You don't deserve those quads.
>>
>>52497780
socket.io uses different protocolos to communicate depending on devices, etc. one of them being websockets. It's higher level than using raw websockets.
>>
Install Lisp.
>>
>>52497913
YOU CAN'T JUST FUCKING INSTALL A LANGUAGE YOU MOUTH-BREATHING MONGOLOID PIECE OF SHIT CUNT
FUCKING SHIT
>>
>>52497942
sudo pacman -S lisp
>>
>>52497486
learn Make then learn CMake
>>
>>52497474
for i = 0, length(s)
for j = i, i+length(s)
print(s[j % length(s)])

Took me a whole 5 seconds to think of. Practice more senpai.
>>
>>52497038

C#
>>
How difficult is it to make a raycaster like Wolfenstein 3D in C++? Is it easier to just go full 3D instead?
>>
>>52498161
It's essentially just algorithm implementation. Look out though, I've heard that Carmack's algorithms are very efficient but extremely difficult to actually understand.
>>
>>52497664
Yep. Ever heard of google?
>>
DBus is awesome. What's your favorite dbus service?
>>
File: ahri_box_0.jpg (103KB, 698x620px) Image search: [Google]
ahri_box_0.jpg
103KB, 698x620px
>>52498192
/g/ is my own personal google
>>
IDE to program AVR under ganoo/loonix?
>>
>>52498220
GNU Emacs
>>
>>52498209
dbus is awful. Why couldn't they make something better?
>>
>>52498231
whats wrong with it
>>
>>52498220
vim, avr-gcc, make, avrdude.
>>
>>52498231
Define: better IPC

inb4 unix pipes
>>
>>52498242
>>52498228
How about code completion. It's not like you remember all the libraries by heart.
>>
>>52498330
Both Vim and Emacs have great autocomplete & tagging packages.
>>
>>52498330
Why do people think code completion helps them remember anything? It can only give you hints from what you already know...
>>
>reading http://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
>read every "UBsan" as ub-san

I don't even watch anime what the FUCK

On a related note, is having this + address sanitizer enabled for debug builds a good idea? I know there's a performance and memory hit but the upsides seem to outweigh it
>>
>>52498435
less keystrokes, shows you the order of parameters and so on
it's just more comfortable
>>
i was recently asked a question about designing high level infrastructure for a website, but i have no idea what the fuck it is. could anyone explain or give resources with examples?
>>
>>52498330
using vim doesn't mean you can't have code completion.
>>
>>52498561
well what's your question. as it is your question is as good as "what is air?"
>>
>>52498584
then I'll give it a try
>>
>>52498435
Well, fuzzy matching lets you type in gibberish and gives you reasonable candidates back.
>>
>>52498607
https://valloric.github.io/YouCompleteMe/
>>
>>52498595
what's considered high level infrastructure?
>>
>>52498561
you dun goof'd
should've asked for more specifics right away, you missed an opportunity to sound knowledgeable about the subject
>>
>>52498641
it's considered a fancy buzzword to talk about the system architecture and layout.
>>
>>52498641
well, what happens when a request hits the server?
>>
>>52498656
this was a screening question, i didn't have anyone to correspond with
>>
>>52498641
What tools you will use, what general design the application will have, design constraints, possible performance bottlenecks and how to alleviate them, etc. Just pretty much means general overview.
>>
>>52498694
and you failed to googol it?
>>
How can I program a bridge, /dpt/?
>>
>>52497169
https://wiki.haskell.org/Type_arithmetic#A_Really_Advanced_Example_:_Type-Level_Lambda_Calculus
https://wiki.haskell.org/Type_SK
>>
>>52498757
>be gay
>get engineering degree
>build bridge
>program it
>>
>>52498732
you act like /g/ can't provide additional information as well
>>
>>52498780
Googling should give you plenty of information if you're not autistic. If you already looked it up then surely you would have a more specific question, no?
>>
>>52498772
Does he HAVE to be gay?
What about bi?
>>
>>52498815
I don't think engineers have much choice.
>>
>>52498772
Is it okay if I write feminine code?
>>
>>52498836
No. Only masculine code allowed.
>>
What's wrong with sublime text?
>>
>>52498996
Proprietary.
Exclusively used by fags.
>>
File: 1451608321723.gif (937KB, 500x357px) Image search: [Google]
1451608321723.gif
937KB, 500x357px
I don't know much about MSYS2, or software compilation in general. Quick question here.

I'm trying to build a 32bit binary of x264. So I started out just using the 64bit compiler and trying to pass "-m32" as an argument to the configure script, which failed. Maybe because yasm was still generating 64 bit machine code.

I install a 32 bit build of GCC. Launch the mingw32 shell, try to configure, and for fuck's sake, it claims no working C compiler is found. Why. I know a 64 bit compiler is capable of generating 32 bit binaries, and the inverse. How do I get this fuck to work?
>>
>>52498996
It's like vim if vim was dogshit, proprietary nagware.
>>
>>52499017
Something to do with PATH?
>>
>>52499017
Actually, more specifically, why isn't this fuck working?

I'm not sure if the configure script or the MSYS environment itself is erroneous.
>>
>>52499049
I don't think so.
I'll remove mingw32-64 from the PATH and see if it itself still works. I only tested to see if it was conflicting somehow. Maybe this is the problem.

I also wish I could build binaries -completely- static. Right now they're dependent on msys libraries.
>>
>>52499089
It still works.
>>
>>52499104
How do I tell it to build for a 32 bit target host? I tried looking through GCC's documentation, but either I'm entirely inept or it's a mess that tells you everything except what you actually want to know.

Windows, i686... how do I make it know this.
>>
>>52497479
wat language is this?
>>
>>52499191
JavaScript (the new ES2015 standard)
>>
>>52496734
How do you distribute your python scripts to Windows users, /dpt/?
cx_Freeze?
I've looked at Nuitka, but it seems to have some issues with requests/ssl.
>>
>>52499218
Distribute as in compile to binary, or distribute via
PyPI/Pip/Conda?
>>
>>52499233
binary
Ex: User downloads script, runs script, shit runs fine without requiring user to install python & all libraries first
>>
>>52499187
did you try googling "cross compiling i686"?
>>
>>52499253
Check out how other projects do it. MComix comes to mind.
>>
>>52499273
I tried googling targets for cross compilation, and went through the GCC docs.

I know what needs to be done, probably, but can't seem to find the means.
>>
>>52499218
py2exe
>>
>>52499218
Rewrite it in a non-shit language.
>>
What's your opinion on functional programming /g/? Is it worth it? Is it better than OOP? Do you think it will be able to take OOP's place?
>>
>>52497474
srsly though
str = str[strsize] + str;
str.erase(strsize+1,1);
cout << str << endl;
>>
>>52499458
yes and yes once it's performance is up to spec as traditional OOP languages
>>
>>52499458
> Is it worth it?
Yes
> Is it better than OOP?
Yes, in the sense that is more versatile and composable. It needs specific additions to the "minimum spec" to also be more maintainable and more powerful than alternatives, but that's available in most functional languages.
>Do you think it will be able to take OOP's place?
Never ever due to babby duck syndrome, same reason people unironically used C and C-like languages for the past several decades.
>>
>>52499483
>once it's performance is up to spec as traditional OOP languages
Some languages like ATS, Clean, and to a lesser extent OCaml are already there. Scheme and CL implementations such as CCL, gambit, SBCL, chicken, ikarus, bigloo and whatnot are also blazingly fast. If speed was an issue, python (among several others) would never have become popular.
>>
>>52499512
>>52499483
Do any of you have any good book recommendations for complete beginners to functional programming? i.e. ones that aren't autistic and throw things like currying / monads at you from the beginning but also one that doesn't assume I'm a retard
>>
>>52497479
Disgusting.
>>
>>52499589
SICP, then Real World OCaml or OCaml from the Very Beginning (for ML-style languages) or the {little|seasoned|reasoned} schemer series (for lisp-style languages).
>>
>>52497474
#include <stdio.h>

int main(void)
{
char *s = "DESIGNATEDDESIGNATED";
int i;
for (i = 0; i < 10; i++)
printf("%.10s\n", s + i);
return 0;
}
>>
>>52499611
Is the little schemer free? Googling but can't find shit except a site to buy it
>>
>>52497474
void rotate(char *s)
{
size_t i, l = strlen(s);
for (i = 0; i < l; i++)
printf("%s%.*s\n", s + i, i, s);
}
>>
>>52499716
What's this "buy" you speak of?
>>
>>52499825
That doesn't work.
>>
>>52499904
does for me
>>
>>52499976
#include <stdio.h>
#include <string.h>

void rotate(char *s)
{
size_t i, l = strlen(s);
for (i = 0; i < l; i++)
printf("%s%.*s\n", s + i, i, s);
}

int main(void)
{
rotate("DESIGNATED");
return 0;
}
>>
>>52499924
I'm not going to say how but I am in fact retarded.
>>
>>52499400
I'll keep that in mind
nim looks promising
>>52499289
>>52499380
I ended up going with pyinstaller and using the --onefile option
binaries are pretty huge though (bigger than Go :^) - https://github.com/golang/go/issues/6853)
Hello World: 3.2 MB
Hello World + UPX: 2.54 MB
shit breaks after strip -s though
>>
>>52499999
checked
>>
>>52499999
Quints confirm
>>
>>52499999
Quints agree, you are retarded.
>>
>>52500016
Nim is garbage.
>>
>>52499999
Confirmed for the retardest!
>>
>>52500067
Would you care to elaborate?
>>
>>52499836
Link place where I can read the little schemer, I can't find anything on google about it
>>
>>52498249
SysV shm
>>
>>52496755
Only for D (and that's its problem)
>>
File: 1453144232793.gif (2MB, 500x281px) Image search: [Google]
1453144232793.gif
2MB, 500x281px
Any knowledgeable Python users here?

Let's say I have some matrix that looks like this (using a list of lists):
[[0, 0, 0, 0, 1]
[0, 0, 1, 0, 0]
[0, 1, 0, 0, 0]
[0, 0, 0, 1, 0]
[0, 0, 0, 1, 1]]


Can I use slices to assign entire rows/columns or is this not possible?

For example:
matrix[0][0:3] = 5

would yield

[[5, 5, 5, 0, 1]
[0, 0, 1, 0, 0]
[0, 1, 0, 0, 0]
[0, 0, 0, 1, 0]
[0, 0, 0, 1, 1]]


matrix[0:3][0] = 5

would yield

[[5, 0, 0, 0, 1]
[5, 0, 1, 0, 0]
[5, 1, 0, 0, 0]
[0, 0, 0, 1, 0]
[0, 0, 0, 1, 1]]


I tried it myself and it doesn't seem to work, but I wonder if there is a proper way or if I have to use some kind of for loop. It's hard to google this too without getting irrelevant results.
>>
>>52500099
nvm found it https://github.com/bilalq/homework/blob/master/314/scheme/The%20Little%20Schemer.pdf
>>
>>52500209
You would want to use a numpy array instead of a list of lists.
>>
>>52500255
No, I do not want to install and compile an external library just for two function. I already know of numpy.
>>
>>52500255
>python fags needs libraries to be able to work with arrays
lel
>>
>>52500275
http://legacy.python.org/dev/peps/pep-0465/
>>
>>52500255
The closest you can do then is something like
x = range(10)
x[:3] = [5]*3

It's ugly and not built-in functionality, which is why I recommended numpy.
>>
>>52500334
Meant to quote >>52500272
>>
>>52500130
it's not discoverable, introspectable, typesafe, and doesn't have nice high level interfaces

it's literally just a magic buffer
>>
>>52500067
>>52500086
anon pls
>>
I have been away for a while, did /dpt/ write the perfect algorithm that can average two integers?
>>
>>52500353
It's also portable and not slow as shit.
>>
>>52500359
>significant whitespace
Into
The
Trash
(ITT for short)
>>
File: family.png (5KB, 281x334px) Image search: [Google]
family.png
5KB, 281x334px
Let's say i have a family of entities like pic related. they can only have one parent but any number of children. children can be accessed like "this.child[0].child[1]". This would access the entity colored red. How would I go about creating a deep clone of this family? I'm using C# if that matters at all.
>>
>>52500442
yes, but then we discovered it was copyrighted and 4chan got sued so moot shut /dpt/ down until we stopped posting it. It was quite an affair, really.
>>
>>52500508
Just walk the tree and copy them as you go along?
>>
>>52499305
Never mind, I figured it out. Not sure why I missed this.
>--host=i686-pc-mingw32

Last question. I assume x86_64 built libraries will not work when linking a 32 bit binary? Is this true? Are libraries not compiled to machine code?
>>
>>52500483
you can't just disregard an entire language because "I don't like programming style"
>>
>>52500550
>I assume x86_64 built libraries will not work when linking a 32 bit binary?
nope
>>
>>52500540
I'm having trouble thinking about how to do that. The type of recursive function needed. I've never done something like that before.
>>
>>52500561
Retarded feature that reduces readability, introduces an entire slew of bugs completely unrelated to program itself, makes codesharing a mess and multi-user collaboration more expensive != "different programming style".
>>>/trash/, where you belong with your language. ITT you go.
>>
>>52497751
rm -rf laravelApp would be a good start.
>>
>>52500571
to deep copy a tree, deep copy the head node, then deep copy the trees below the head node and add them to the new head node.
>>
>>52500571
Here is some C-like pseudocode:
Node copy_tree(Node src)
{
Node dest;

dest.data = src.data;

for (int i = 0; i < src.num_children; ++i) {
dest.add_child(copy_tree(src.child[i]));
}

return dest;
}
>>
>>52500561
Actually you can. Python has very similar semantics to most interpreted languages. What the fuck is left but syntax?
>>
>>52500604
>indentation/whitespace
>reduces readability
what are you smoking
>introduces an entire slew of bugs completely unrelated to program itself
name 5
>makes codesharing a mess and multi-user collaboration more expensive
seems pretty simple to me
https://github.com/nim-lang/Nim/wiki/Whitespace-FAQ
http://nim-lang.org/docs/nep1.html#introduction-spacing-and-whitespace-conventions
http://nim-lang.org/docs/manual.html#lexical-analysis-indentation

http://forum.nim-lang.org/t/699/
>>
>>52500631
>>52500629
I understood it better with Anon's code. But thank you both.
>>
>>52499999
DESIGNATED
ESIGNATEDD
SIGNATEDDE
IGNATEDDES
GNATEDDESI
NATEDDESIG
ATEDDESIGN
TEDDESIGNA
EDDESIGNAT
DDESIGNATE
DESIGNATED
>>
>>52500458
DBus is pretty fast, and people are always making it faster. DBus is also portable, the default implementation works on windows and osx too
>>
Muh Scala fizzbuzz oneliner, anyone shorter?
(1 to 100) foreach { x => if (x % 5 == 0 && x % 3 == 0) println("FIZZBUZZ") else if (x % 5 == 0) println("Buzz") else if (x % 3 == 0) println("Fizz") else println(x)  }


Ps I miss ternary from java and php.
>>
>>52500680
alright we have the burrows wheeler transform

we can now decode the genome
>>
>>52500681
Fuck off freedesktop shill. Nobody wants your over complicated bloatware.
>>
>>52498098
Nvm then lol
>>
New nim version for all the nimfriends

http://nim-lang.org/news.html#Z2016-01-18-version-0-13-0-released
>>
>>52500744
Nobody cares about your meme language.
>>
>>52500789
i care about his meme language (jk i dont)
>>
>>52500660
Typical nimfag, everybody!
>>
>>52500789
>>52500812
>>52500828
A good way of outing yourself as not being from around here is a negative opinion of nim.
>>
>>52500849
>>>/tumblr/
>>
>>52500849
Nimfag pls, I've been in /dpt/ since epoch 0.
>>
>>52500849
>/dpt/
>Liking nim
>Having a unified opinion about anything
Please, stop projecting this hard. I think you're a new one here.
>>
>>52500715
too bad it's taken over
>>
>>52500849
well there's a lot of python shitters and some FP fags in here but kinda this. i don't use nim but i've had a look at it and it looks good.
>>
>>52501036
I know but I still hate RH.
>>
>>52501096
>being this unsubtle
>>
>>52501101
Redhat is awesome, i hope to get an internship there
>>
>>52501096
>What the fuck is left but syntax?
https://github.com/nim-lang/Nim/issues/521#issuecomment-21007981
>If syntax is all that concerns you, you're a bad programmer.

https://www.youtube.com/watch?v=4rJEBs_Nnaw
>>
>>52498759
lel lemme have a go at it
data Zero
data Succ a

type One = Succ Zero
type Two = Succ One
type Three = Succ Two
type Four = Succ Three

numPred :: Succ a -> a
numPred = const undefined

class Number a where
numValue :: a -> Int

instance Number Zero where
numValue = const 0
instance Number a => Number (Succ a) where
numValue x = numValue (numPred x) + 1

-- divisibility by 3 or 5
class mulThree a
class mulFive a

instance mulThree Zero
instance mulFive Zero
instance mulThree a => mulThree (Succ (Succ (Succ a)))
instance mulFive a => mulFive (Succ (Succ (Succ (Succ (Succ a)))))

-- no divisibility by 3 or 5
class notThree a
class notFive a

instance notThree One
instance notThree Two
instance notFive One
instance notFive Two
instance notFive Three
instance notFive Four
instance notThree a => notThree (Succ (Succ (Succ a)))
instance notFive a => notFive (Succ (Succ (Succ (Succ (Succ a)))))

class FizzBuzz x c | x -> c

data Fizz
data Buzz
data FizzBuzz

instance (mulThree x, mulFive x) => FizzBuzz x FizzBuzz
instance (mulThree x, notFive x) => FizzBuzz x Fizz
instance (notThree x, mulFive x) => FizzBuzz x Buzz
instance (notThree x, notFive x) => FizzBuzz x x
>>
>>52498759
Should have expected that undecidable instances make it, well, undecidable.
>>
>>52501200
>this whole fucking thread
I'm not even going to attempt to try nim, holy fuck! And I thought guido was bad!
>>
File: le never scoring yeb.jpg (187KB, 598x460px) Image search: [Google]
le never scoring yeb.jpg
187KB, 598x460px
>>52501200
>4rJEBs_Nnaw
>JEB
>>
>>52501273
to be fair, that was three years ago
the case/style insensitivity has been removed
>>
>>52501281
Has he stopped being a child? Has he stopped being clinically retarded?
>>
>>52501296
>Has he stopped being a child?
I assume so. I don't see why a company would hire him based on his language otherwise.
http://forum.nim-lang.org/t/870
>Has he stopped being clinically retarded?
go on then anon, go write your own programming language
>>
>>52501200
So you admit the syntax is shit?
>>
>>52500730

Uh.. what?
>>
>>52501326
I have written my own programming language. It compiles to LLVM IR directly, supports full HM inference for typing with several extensions, and uses the boehm GC for the time being (i.e. until I decide to continue developing it and use a non-shit GC instead or implement linear types). His faggy language is a joke compared to mine and I developed mine in under a week from 0 prior experience in the domain.
>>
>>52501333
In my opinion, no.
I think indentation/significant whitespace helps, especially when it comes to readability.
I do think think having functionThingy be equal to function_thingy or func_TION_ThInGY is shit.
That's what that bug report was about though, style insensitivity.
It's been removed.

>http://nim-lang.org/docs/manual.html#lexical-analysis-identifier-equality
>Historically, Nim was a fully style-insensitive language. This meant that it was not case-sensitive and underscores were ignored and there was no even a distinction between foo and Foo.
>Historically
>>
>>52501369
sounds neat, anon
let's see it
>>
>>52501398
Here's a version after 3 days of development. One day I'll git push the rest.
http://neetco.de/languagedev/language
>>
>>52501421
I want to make a language now. Post hello world.
>>
>>52501380
>historically
>started in 2008
So you have brand new language already breaking compatibility with old programs?

Not inspiring much confidence.
>>
>>52501421
God this is so fucking ugly

Do us a favor and don't push the rest
>>
>>52501249
H-how do I use this?
>>
>>52501452
>I want to make a language now.
It's actually surprisingly easy, especially if you use tools like bison/flex or equivalent implementations in other languages like menhir or pyflex. Even compiling to LLVM IR is quite easy, though you have to be careful to make sure blocks are pushed/popped correctly if you want to append instructions at the right point. Also, you must use allocas if you want variables to be settable. And phi nodes are a bit hard to get your head around of at first.

It's really more tedium than difficulty, with how long it takes to implement a standard libraries, and getting all the base features working and compiling.
>>
>>52499017
Doesn't MSYS crate a reliance on the cygwin dll's? You are better off with a clean windows version of mingw-w64, rather than that Cygwin stuff.
>>
>>52501487
t-thanks
;_;

I still haven't figured out a good scheme for AST node compaction by the way. Any suggestions?
>>
>>52501508
Sure, if you're not actually doing anything novel.
>>
>>52500561
> you can't just disregard an entire language because "I don't like programming style"
Most of /dpt/ would disregard an entire language if the dev forum had a "don't act like you're on 4chan" policy.
>>
>>52501569
As you should. Choose a language with an equally autistic audience, e.g. C, lisp, ML.
>>
>>52501515
> Doesn't MSYS crate a reliance on the cygwin dll's?
No. That's Cygwin.

MSys is just a bunch of common Unix programs built for Windows, so that configure scripts, makefiles, etc work. It doesn't generate binaries; that's down to MinGW (which is gcc and binutils for Windows).
>>
>>52501569
I choose base on how a language looks desu
>>
Why is this so slow?

fib :: Int -> Int
fib 0 = 1
fib 1 = 1
fib x = fib (x-1) + fib (x-2)


fib 30 should have to add 30 numbers, but it takes ~5 seconds on my machine. fib 35 takes ~56 seconds and starts eating into my ram hard.
>>
was brainfuck an easy language to write or was it hard as fuck just like any other language?
>>
>>52501674
You can write a brainfuck interpreter in a day.
>>
File: 1407905937240.jpg (23KB, 500x375px) Image search: [Google]
1407905937240.jpg
23KB, 500x375px
>>52501663
>Naive Fibonacci algorithm
That shit blows up exponentially.
>>
>>52501674
malbolge is better
>>
>>52501674
Easy to implement, hard to use
>>
>>52501569
Worse, most people disregard languages because they assume people here know what they're talking about when they meme.

See: C++ isn't better than C
>>
>>52501663
https://mitpress.mit.edu/sicp/full-text/book/book-Z-H-11.html#%_sec_1.2.2
>>
>>52501726
C++ is way worse than C, though.
C++ is complete garbage.
>>
>>52501663
how about this anon. Computed in 0.007 seconds.

    for(int n=0; n<30; ++n){
double fi = (1 + sqrt(5))/2;
double ni = (pow(fi, n) - pow(1-fi, n)) / sqrt(5);
cout << ni << endl;
}
>>
>>52501821
Now explain why that works and that you didn't just copy something off of stackoverflow.
>>
>>52501663
>babby's first Haskell
>>
>>52501841
It's this implemented in code
http://mathworld.wolfram.com/BinetsFibonacciNumberFormula.html
>>
>>52501744
Doesn't haskell cache function results?
>>
>>52501841
Not him but that's Binet's formula, the proof is pretty simple.

It's a terrible way to compute Fibonacci numbers on a computer though, because a double lacks the required precision for phi to compute Fib(n), n > ~60. Also pow() isn't as fast as you'd think.
>>
>>52501875
I don't know haskell, I would assume no because of the memory required to store (n, f(n)) pairs for a shit ton of function calls.

Look into "memoization Haskell".
>>
>>52501366
Didn't realise I was dealing with a winshit
>>
>>52502047
>Javafag calling out a C#fag
>>
>>52502047

It works on Mono too, ya fagort.
>>
test post please ignore[\code]
>>
>>52502104
fuck you
>>
>>52502111
rude desu
>>
desu
desu
>>
>>52502124
babby's first code tags
>>
>>52502104
reported
>>
>>52502130
t b h
>>
File: 5JCkfhw.png (14KB, 384x333px) Image search: [Google]
5JCkfhw.png
14KB, 384x333px
>>52502130
desu
>>
>>52502104
This has me curious

hello
[/
code]
>>
>>52502145
why isn't desu in a code block
>>
>>52502145
Code tags don't work below a number of chars, I think 5-7.

1
12
123
1234
12345
123456
1234567

12345678
>>
>>52502182
1
>>
Do ejs still work?
[ejs]
hello world
[/ejs]
>>
>>52502222
No, but those quads sure do
>>
>>52502228
I'm also the retard who got quints. It isn't special.
>>
Shoutouts to the guy who recommended just cleaning your ass using the shower head instead of wiping yesterday. I've been doing it and it actually takes less time overall.
>>
>>52502350
>/g/ - Ass-wiping tips & loo pooing
>>
>>52502350
I just... what?
How could that possibly net out to less time or effort?
>>
>>52502350

Why the fuck do you have a handheld shower head? It's 2016, not 1916.
>>
>>52502407
>IT IS ${CURRENT_YEAR}
>>
>>52501200
it's funny that one day some anon will sperg about case sensitivity and then another day some anon will sperg about case insensitivity
>>
>>52502392
Yeah boi.

>>52502398
It depends on the quality of your shit. If it's gonna be a multi-wiper it takes less time to just take off your pants, point the head at your ass and clean it a bit. You just dry off your legs in the end.

>>52502407
Removable shower heads propped up above head height are the norm.
>>
>>52502350
>yesterday
So how many samples did you use to come to the conclusion that it takes "less time overall"?

Unless you excreted waste at least 50 times since yesterday, your opinion on this cleaning technique is useless.
>>
>>52502350
except you waste a bunch of water and you now have shit in your bathtub. Dumbass.
>>
memes
>>
>>52502425
2 and it took less time both times. I'd say this makes for a pretty solid case.

>>52502430
You pay for water?

Bathtub?
>>
>>52502350
>designated shitting tub
>>
java confirmed for cucks
>>
File: Capture.jpg (22KB, 290x250px) Image search: [Google]
Capture.jpg
22KB, 290x250px
Does Elm offer any advantages other than taking way more LOC than plain HTML/JS to do simple tasks? pic related
>>
File: 1395982158913.png (46KB, 363x364px) Image search: [Google]
1395982158913.png
46KB, 363x364px
>>52502548
>>
>>52502350
I only ever need to shit once a day at max, so I always just have a shower afterwards anyway.
>>
>>52502548
>pamplemousse
The fuck is that?
>>
>>52502423
>Removable shower heads propped up above head height are the norm.

Perhaps in third world countries. I've been in a lot of showers in the United States and seen only a few.
>>
>>52502670
it's like grapefruit in french
>>52502672
yeah i haven't seen one here in like 5 years
>>
>>52502672
'murrica
>>
#include <stdio.h>

int main()
{
puts("DESIGNATED\nESIGNATEDD\nSIGNATEDDE\nIGNATEDDES\nGNATEDDESI\nNATEDDESIG\nATEDDEGIGN\nTEDDESIGNA\nEDDESIGNAT\nDDESIGNATE");
return 0;
}

Fixed your shit program.
>>
>>52502689
>>52502672
There's no benefit of having it locked in place.
>>
>>52502692
meant for >>52497534
>>
>Amerishowers
>>
>>52502691

Yee haw.

>>52502701

In the United States, we usually also have gun racks above the shower head (just in case someone breaks in during your shower, you can reach up and grab one). If you could move the showerhead up and down, it would interfere with your firearms.
>>
>>52502744
>If you could move the showerhead up and down, it would interfere with your firearms.
>His showerhead isn't also a gun
You disappoint yet again GTP
>>
>>52496734
/me/
>>
File: s.jpg (60KB, 460x480px) Image search: [Google]
s.jpg
60KB, 460x480px
burger here, can confirm my shower looks sort of like this
>>
>>52502082
That anon isn't me, I just got back on the thread. C# and Java are close enough, right? So what are the main principles/design behind your program?
>>
>>52502585
Shitting more than once a day seems a bit excessive. I'd probably be about once every 36 hours or more.
>>
I'm using a portable version of python (don't ask) and none of the python to exe programs work,
How do I make it work?
>>
>>52502852
>So what are the main principles/design behind your program?

There really wasn't any design in mind. It starts up and loads a list of MP3 files in the directory specified by the INI, all of which takes place inside a MediaManager class. This class also lets you access that internal list so it can be displayed in the GUI. It uses the Windows PresentationCore, but I also used NAudio and cscore temporarily.

And.. that's about it. The view lets you modify (filter) the list by typing into the text box, but doesn't actually make any modifications to it.

Uh.. that's about it.
>>
how the fuck does murmurhash work
>>
>>52503049
Just looks like any other iterated hash function.
>>
Is it REALLY a good idea to make a single AJAX function for my website... and use callback functions to handle different requests?

It's incredibly fucking hard to figure out what the parameters of such a function should even BE, since I have so many different things that'll need to be done, many of which require parameters, others which do not. Some just operate on single items. Others load in pages...

Is ONE AJAX that uses Callbacks REALLY what I should do?
Would there be any significantly negative effects of forcing separate function names for each JAXable item? I mean... other programmers and I will STILL need to know the function to call. Moreover, having to pass the proper parameter list and using the proper syntax for the thing will be fuckloads more confusing.

So, the file will be a bit bigger... is there any other problem, really?
>>
>>52503236
Adding to that, a lot of the functions really aren't even AJAX; they're just outright JavaScript...

I literally can't think of how many of the functions would even use the AJAXing function. Shouldn't I just run them separately?
>>
>>52503236
>>52503302
There's a web dev general now
>>
>>52503327
alright, I'll see what they say
>>
>>52499589
Paul Graham's ANSI Lisp is pretty good. Especially chapter six.
>>
>>52502982
dang, how long did it take you?
>>
I'm loading up the 4chan JSON, but when I load a board I only get the first page.

Can't see how I'd search every available page, any ideas?
>>
>>52503461
http(s)://a.4cdn.org/board/threads.json
>>
>>52502981
Add the portable version of Python to your Path variable? If you can do that though, easier to just install it.
>>
>>52503496
Yeah I thought that, but then I'd have to make a request for each and every thread to get any relevant information out of it.

The catalog gives me all the right information, but only for one page, which is a shitkicker
>>
>>52503532
http(s)://a.4cdn.org/board/catalog.json
>>
>>52503532
Indeed.
>>
>>52503461
https://github.com/4chan/4chan-API
>>
NEW THREAD!

>>52503588
>>52503588
>>
File: 1396521920399.gif (556KB, 299x299px) Image search: [Google]
1396521920399.gif
556KB, 299x299px
>>52496920
>>
>>52503580
Yup.

>>52503540
It doesn't seem to give me a value for the number of pages, I assume then that I have to iterate through each page and work out how to tell when the pages run out.
>>
>>52503612
Whatever JSON parser you're using should be able to tell you.
>>
>>52503612
What are you talking about? The catalog is a json array of page objects. Parse the json into a list and iterate across it.
>>
>>52503650
>>52503671
My JSON parser doesn't tell me fuck all, I load up a board catalog into this.

    public class BoardCatalog
{
public int page { get; set; }
public List<Thread> threads { get; set; }
}


I don't know how I'm supposed to get each page to load up.

I'm flying completely blind as it stands.
>>
>>52501333
I think the syntax is shit
I don't have a problem with the indentation

t. someone else
>>
>>52503694
Which parser are you using?
>>
>>52503735
JSON.NET

I'm quite used to using it, but I've never had to pull data from elsewhere before so I'm not entirely sure how I get the data to be how I want it to be.
>>
>>52503735
>>52503757

Never mind I was being a fucking retard, I was taking the list and only eating page 0, I just specified that I wanted the whole catalog and saved it as a list and I was all good.
Thread posts: 320
Thread images: 18


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.