[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 19
old thread: >>52369894

bearded komari is for sexual edition
>>
>>52372532
If you're not programming a virtual machine, you ain't nothing
>>
>>52372532
Fuck off weeb
>>
>>52372565
Where do you think you are?
>>
>>52372575
The programming general of the technology board of an anonymous imageboard.
>>
Well, at least you posted a beard image, OP. Programming capability is directly related to the size of one's beard.
>>
File: 1450955979823.jpg (89 KB, 891x810) Image search: [Google]
1450955979823.jpg
89 KB, 891x810
I'm writing a sudoku puzzle validator as part of my sudoku solver.
I've written a row and column validator, and I still need the 3rd validator that checks if the numbers 1-9 are present and unrepeated in every 3x3 square in a 9 * 9 grid.
I was planning on doing this by splitting the grid into equal parts and calling the other validators on every part.
In order to make it scalable, what's a good way to split an N * N grid into equal pieces of sqrt(N) * sqrt(N) each assuming that sqrt(N) yields a whole number?
>>
Does Rust have any flaw?
Is Rust the perfect language?
>>
>>52372575
/g/. You're clearly mistaken between /g/ and /a/
>>
>>52372583
that's the only thing we CAN make lmao
>>
>>52372595
>>52372625
This is the Anime & Programming thread on the Anime & Technology board on an Anime imageboard.
>>
>>52372622
>there are people on this website that think this drawing of children is sexually arousing.

Look at your life choices, m8s. Introspection is good for the soul.
>>
>>52372622
don't split it in the sense of splitting arrays, do your horizontal and vertical checks, then pass the bounds of each split part into a function which adds all the numbers in it. It needs to total the nth triangular number
>>
>>52372646
who are you quoting?
>>
>>52372532
>This garbage thread
>>
>>52372646
>Look at your life choices, m8s.
Not him, and not an anime fan either, but you are on 4chan. Take your own advice
>>
>>52372667
My trolling pales in comparison to the 24/7 weebdom these faggots fill their lives with. I stop being a troll when I close Chrome.
>>
>>52372551
why does it matter?
>>
Can any haskell artisans here tell me what the following code does?
printAll [] = return ()
printAll (x:xs) = putStrLn x >> printAll xs

Because it makes no sense to me and the references I can find are all written in broken english.
>>
>>52372644
oh lawdy
>>
>>52372622
>I've written a row and column validator, and I still need the 3rd validator that checks if the numbers 1-9 are present and unrepeated in every 3x3 square in a 9 * 9 grid.
Try making a general validator that can check for presence of 1-9 in any arbitrary list of nine squares (or nine numbers, if you prefer). Then you can simply construct such a list for each row, column, and box. A bonus feature of this approach is that you can very easily adapt it to weird sudoku variants with irregularly-shaped boxes, or with 1-9 on the diagonal, or whatever.
>>
>>52372646
Oh wow. So now you can't even be sexually attracted to children.
What is it. the puritan police?
>>
>>52372736
making newfags and redditors mad
>>
>>52372644
ok now this is an honest attempt at getting the anatomy right

not that deviantart shit from the last thread
>>
>>52372703
It prints all the strings in a list recursively.

More accurately, it recursively traverses a list of strings to build up a computation that will print out the strings in the list when run. The >> operator combines two computations without giving the second the result of the first (which is ()) anyways. It could be written as:
printAll [] = return ()
printAll (x : xs) = do
putStrLn x
printAll xs

or, even better, as:
printAll = mapM_ putStrLn


For example:

printAll ["Hello", " ", "World"] = do
putStrLn "Hello"
putStrLn " "
putStrLn "World"
return ()
>>
>>52372758
Don't know what happened to that last code block:
printAll ["Hello", " ", "World"] = do
putStrLn "Hello"
putStrLn " "
putStrLn "World"
return ()
>>
>>52372736
That's bound to be a deleted image, friend.
>>
>daily programming
>half thread is just people posting anime shit

It's sad because it's just the same 2-3 anons ruining the thread.

Can't a mod just ban these fuckers already?
>>
>>52372736
I-I can s-see her naughty bits
>>
>>52372758
Wow that's pretty cool, thanks anon.
>>
>>52372644
>>52372736
>>52372783

I get what you're trying to pull:

You're educating the 4chan file deletion bot to understand what images are safe by posting them on a blue board.

Congrats, anon.
>>
How does this make you feel, /g/?
unsigned **create_2Darray(unsigned r, unsigned c)
{
/* creates r * c sized 2D array */
unsigned i;
unsigned **ptr = (unsigned **) malloc(sizeof(unsigned *) * r);
for (i = 0; i < r; i++)
ptr[i] = (unsigned *) malloc(sizeof(unsigned) * c);
return ptr;
}
>>
>>52372860
I already told you that it was shit last thread.
>>
>>52372860
like bags of memes
>>
>>52372806
You can think of the >> operator as a kind of semicolon: a >> b basically means "do a, then do b".
>>
MOOOOOOOOOODS

https://www.youtube.com/watch?v=SvKY8FJY0Qk
>>
>>52372888
a girl, you intolerant faggot
>>
File: IMG_20151209_230220.jpg (35 KB, 469x527) Image search: [Google]
IMG_20151209_230220.jpg
35 KB, 469x527
>Mainly a C++ guy
>love c++ and writing stuff in it
>fool around with functional programming, mainly Haskell
>the more I find out about it the more brilliant it is
>feel like shit whenever I'm writing toy programs in Haskell because I know I'll never use it in the real world
>go back to C++
>>
>>52372796
this

should easily be a 1-3 day ban minimum
>>
The anime degenerates are even bigger faggots than the trip fags
>>
>>52372940
It should be a perma-ban because it's practically child porn

Anyway, how hard is it to go from Java to C?
>>
>>52372928
>john carmack thinks haskell is much bigger than toy programs to the point where he's in the process of writing all of wolfenstein in it
You should try to be better at it. Declarative programming is a completely different beast, but it can be a powerful one if you know how to use it right
>>
File: 1407905937240.jpg (23 KB, 500x375) Image search: [Google]
1407905937240.jpg
23 KB, 500x375
>>52372964
>because it's practically child porn
>>
>>52372940
I've already reported it. Getting tired of it.
>You have already reported this post, or someone with your IP has already reported it.
>>
Does grid paper help for writing algorithms?
>>
>>52372928
You'll love this guy's blog.

http://bartoszmilewski.com/2009/10/21/what-does-haskell-have-to-do-with-c/
http://bartoszmilewski.com/2014/02/26/c17-i-see-a-monad-in-your-future/
>>
>>52372939
I'm gonna program :^) some programs
>>
>>52372992
No?
Why would you even think that?
>>
>>52372799
Thanks anon, I've been looking for this image.
>>
>>52372928
If it's any consolation your Haskell programs all have wildly unpredictable performance, the compiler is doing crazy shit behind your back to maintain the facade of functional elegance, and nothing you've been doing in it is really practical or usable in the long term.

>>52372949
>degenerates

retard spotted
>>
>>52372646
I think it's comedic.
>>
>>52372796
You're on an anime site, you can post anime.
>>
>>52372939
We shall see.

This is me with a new IP.
>>
What's the difference between functional and imperative?
>>
>>52373011
>your Haskell programs all have wildly unpredictable performance, the compiler is doing crazy shit behind your back to maintain the facade of functional elegance
This is true.

>nothing you've been doing in it is really practical or usable in the long term
I disagree.
>>
module Main where

main :: IO ()
fizz :: Integer -> String

fizz n | n `mod` 15 == 0 = "Fizzbuzz"
| n `mod` 5 == 0 = "Fizz"
| n `mod` 3 == 0 = "Buzz"
| otherwise = show n

main = mapM_ putStrLn $ map fizz [1..100]


My fizzbuzz may not be small, but jesus fuck it is beautiful.
>>
God bless animu children and C
>>
>>52372949
I like anime, but it gets annoying when you want to just visit a thread for the on-topic material,on a SFW board, yet people keep posting sexualized images of children that nearly crosses the line
>>
>>52373046
>children
are you ok?
they're just drawings
>>
>>52373037
Imperative languages start with something useful and add type theory.
Functional languages start with type theory and add useful things.
>>
>>52372981
in some jurisdictions it is
>>
>>52373040
>more fizz buzz scripts
>4chan thread downloader last thread

welp, im out.
>>
>>52373080
>he lives in the UK
my condolences

haha
>>
>>52373080
Australia is ahead of the game

http://www.abc.net.au/news/2015-08-12/anime-not-a-big-leap-to-child-pornography-sa-judge-says/6691372
>>
>>52373070
>they're just drawings
drawings that imitate children, yes.
pedophile either way.
>>
>>52373101
>unironically living in Australia
>>
>>52372964
They're not even doing anything sexual.

It's just you and your paedo brain thinking innocent images of girls are porn.
>>
>>52373101
This guy says "anime" and he means "loli".
>>
>>52372964
>Anyway, how hard is it to go from Java to C?
shouldn't be too hard. C is so simple with the syntax and such. the only thing that will really be new will be pointer syntax and pointer arithmetic but you'll get the hang of it in no time. and different library functions, mallocing and freeing memory, null-terminated char arrays as string, structs, function pointers, minor syntax differences. that's about it
>>
>>52373108
And.
>>
File: 1451091057444.png (253 KB, 620x620) Image search: [Google]
1451091057444.png
253 KB, 620x620
>>52373108
>imitate children
i don't remember children having gigantic heads, tiny mouths and eyes that take up 50% of their face

anime characters are more ayy lmao than human desu
>>
>>52373122
you have no business spending all day long watching nude drawings of little girls unless you're a pedophile
>>
>>52373122
>They're not even doing anything sexual.

>>52372736
>blushing
>pulling her panties down
>nips exposed
>not sexual

>>52372860
>holding a buttplug in their mouth
>cat pose
>blushing
>not sexual

>>52372888
>fondling boobs while blushing and half nude
>sticky substance dripping from hands
>not sexual

>innocent images
>>
>>52373155
>>holding a buttplug in their mouth

tbqh this one is ok because it's a guy
>>
>>52373037
Imperative languages use statements to change the state of something within the program.
For some examples of state-altering statements, you have variable declarations, variable alterations, or loops.

Functional languages use functions to get results from data.
For example, in Haskell there are no variables or (conventional) loops, and all data is 'immutable'.

The root difference between the two paradigms is that imperative languages were designed to simulate how CPUs actually work, while functional languages were designed to simulate how math works.
>>
>>52373037
>imperative
you describe how you modify the state
>functional
you describe what are the values, without modifying the state
>>
>>52373142
I don't spend all day watching nude drawings of little girls, I think drawing of little girls are cute, them being nude is irrelevant.

You're the paedo here for viewing those images in a sexual manner, anon.
>>
>>52373176
>>52373179
how are you supposed to make anything useful in functional languages then?
>>
 
template<typename F> auto future::then(F&& func) -> future<decltype(func(*this))>;


Why do we like C++ again?
>>
>>52372928
Now try D, I Dare you
>>
File: Bait.png (220 KB, 387x545) Image search: [Google]
Bait.png
220 KB, 387x545
@52373193
>>
File: char_41563.jpg (16 KB, 210x240) Image search: [Google]
char_41563.jpg
16 KB, 210x240
Are there really people here questionning the legitimacy of loli?
>>
>>52373155
>this post

Found the pedo.
>>
>>52373204
Why is it worth using over C++? Starting disadvantages: no libs, garbage collection
>>
>>52373193
if I say that
x = 2 + y
I modify no state, but x is equal to y + 2
>>
>>52373193
Functional doesn't mean "no side effects". It means "delimited side effects".
>>
>>52373199
It's the only non-GC'd language with RAII apart from Rust, and Rust's community is a gaggle of bedwetting faggots.
>>
>>52373193
The same way you do anything in a functional language: Completely differently from how you'd do it in any other type of language.
Functional programming has some really nice benefits, and the always-in-always-out nature of the functions themselves means that you can do some fun things with them.
See my fizzbuzz posted earlier for a very elementary example - I can't imagine any imperative language that would let you build a working fizzbuzz program without using any loops or recursion.
>>
File: 1451932034984.png (254 KB, 800x1132) Image search: [Google]
1451932034984.png
254 KB, 800x1132
The no fun allowed police have arrived.
>>
>>52373220
ok, so how do you tell your function what x is if no variables are allowed in functional programming?
>>
>>52373205
>@
Never fucking reply to me again unless you're contributing to the thread.
>>
>>52373244
>if no variables are allowed in functional programming
Where are you getting that idea?
>>
How good is scheme as a first language?
>>
>>52372860
#define create_2Darray(W, H) (malloc(sizeof (unsigned) * (W) * (H)))
#define index_2Darray(ARR, X, Y, W) ((ARR)[(X) + (W) * (Y)])
>>
>>52372919
dependent haskell, as well as haskell in general, lacks a lot of the elegance of idris. there's really no hope for the type system to adhere to any theory because it started out tied down to an existing type system that just got extended over and over again to make it more powerful without a real driving force/final goal behind it other than "make the language better". Idris has the advantage of being designed from the ground up as a new language with a goal already in place and a lot of other features that would break backwards compatibility with Haskell but are useful nonetheless.
>>
>>52373268
that's gross
I wrote it like that to AVOID ugly pointer arithmetic hacks.
>>
>>52373257
>he doesn't have his own extension that automatically wraps quote links around @ replies
>>
>>52373261
Bad.
Try C.
>>
>>52373285
Last time I asked about C, someone told me C was a terrible first language and I should start with Lisp and I found out about a dialect called scheme, which one should I start with?
>>
>>52373244
Variables are just constants. Like in mathematics.
If I say that
factorial (0) = 1
factorial (n) = n * factorial (n - 1)
I have modified no variables but I have fully define factorial functions.
>>
>>52373281
I deleted that image, I was ashamed of the quality if I'm honest.
>>
>>52373280
Why on earth are you using C?
>>
>>52373220
Same way you'd do it if this were math and you were graphing it: Parameters!
Here's some Haskell:
main :: IO ()
f :: Integer -> Integer

y = 3
z = y + 2

f x = x * 3
main = print $ f z


Running this will result in '15' being printed to stdout.
>>
>>52373218
It's as fast as C++ with identical code, and certain features can make it a lot faster (array slicing springs to mind)

it actively supports functional programming

no libs is wrong. You can use C and C++ code in it with no speed loss
There are D bindings for most noteworthy things

Garbage collection can be turned off (but if you're using the standard library you probably shouldn't)

it's generally prettier. Just a lot nicer to look at, and smoother to write, but this is hard to quantify
>>
>>52373261
if you want to learn how to think algorithmically, it's one of the best choices. if you care more about working with a computer at the lowest level you can listen to >>52373285 but 99% of the time it isn't a good place to start
>Lisp is no harder to understand than other languages. So if you have never learned to program, and you want to start, start with Lisp.
>>
>>52373306
>someone told me C was a terrible first language
That soeone trolled you.
You can learn C in a matter of days.
>>
>>52373193
They use functional constructs to "simulate" imperative code. Basically:

imperative code --> pointlessly abstract layer of theoretical bullshit to compensate for the natural burden of functional semantics (monads, arrows, functors, universes, uniqueness types, whatever) --> intrinsically imperative machine architecture

It's sort of a "the emperor has no clothes type of thing", and it's usually the part in learning Haskell where you have to pretend really hard you haven't been wasting your time learning for the past week or so learning all of it.
>>
>>52373280
>pointer arithmetic
There is no pointer arithmetic here, anon.
>>
>>52373335
>You can use C and C++ code in it with no speed loss
not a valid point, if you have to use inline C/C++ then why not just use it from the start? you chose the wrong language for the job.
>>
>>52373349
Good one, anon.
>>
What the fuck is wrong with you people? Stop posting nude lolis. This is blue board.
>>
How to make an array with malloc in C?
>>
>>52373372
You don't have to, that's a worst case scenario
>There are D bindings for most noteworthy things
>>
>>52373340
Does it really matter if I start with either scheme or lisp?

>>52373342
Why should I start with C over Scheme?
>>
>>52373383
>lolis
They told me they were over 18.
>>
>>52373383
>b-but 4chan is an anime imageboard because it was founded by a guy who used to be a massive weeb
>ergo we can post loli porn on blue boards!
this is their thought process, don't try to reason with it, just report it
>>
>>52373392
because C isn't a meme language and it's syntax has been very widely adopted
>>
>>52373392
((because )))))) lis(p)))) is (((((((((dum))b)))))))))))))))))))
>>
>>52373388

use [spoiler]calloc[/spoiler] instead.
>>
>>52373392
It's gonna be infinitely more useful for starters.
More support, more libraries...
Also it's a nice step toward learning C++ and Java.
Scheme/Lisp/whatever are only useful for educational purpose. Or if you're Lain.
>>
>>52373442
Never fucking reply to me again unless you're contributing to the thread.
>>
>>52373392
nah, i was just quoting Stallman there cause I like the way he puts it. if you read the whole quote he says that when he's talking about Lisp he means Lisp/Scheme. Personally, I prefer Scheme because it's a very minimalist approach to Lisp and defines a small language that's very easy to grasp and read. Some people prefer Common Lisp (or other dialects) because they give you more language features to work with right off the bat, but it's really up to personal choice here.
>>52373416
syntax and adoption don't mean that the language is better to learn. Lisps will be much easier early on because they let you focus on *doing things* with your code/solving problems. with C, there's a whole lot you need to learn to write your first real world program
>>
>>52373447
so C and then scheme after it be better?
>>
>>52373470
Yes.
Both are interesting, but C is more useful.
>>
>>52373470
Scheme then other stuff.
>>
Why haven't you patented your solution for averaging two ints in C, /dpt/?

http://www.google.com/patents/US6007232?dq=6007232
>>
>>52373519
i'm afraid even that solution doesn't work 100%
>>
>>52373464
>with C, there's a whole lot you need to learn to write your first real world program
Toppest kek. You don't get to write "first real world programs" with Lisp variants.
>>
>>52373581
why not?
>>
>>52373593
I mean, do you really wanna compare the achievements on both sides?
>>
>>52372994
>http://bartoszmilewski.com/2009/10/21/what-does-haskell-have-to-do-with-c/
>Just like in Haskell, there are two definitions of fact, except that their order is inverted.
He's wrong though. The C++ actually is two definitions, but Haskell "pattern matching" is just syntactic sugar for case. It's not like C++ template specialization at all. The closest things Haskell has would be typeclasses and type families.
>>
>>52373519
lmao does this mean if an american tries to write code using that algorithm, he's gonna get sued or some shit?
>>
>>52373659
case is pattern matching. You're right that there's only one definition, of course.

And how is template specialization not pattern matching?
>>
>>52373618
it's nothing to do with the achievements of a particular language. when C was first created obviously it had no achievements. the thing that matters _to a beginner_ is how easy it is to start writing code so that you can learn how to design the rest of your code later on. so in Scheme if you have a problem you want to solve, you're taught to write a function to do it and think about the issue at hand first and foremost, whereas in C, you need to already understand memory management and the likes to start writing those kinds of solutions. even though Scheme or Lisp may not be the best language for you to write real world software in once you're an expert, it's much easier for a new programmer to design a calculator or the kinds of things you'd find in the DPT roll chart. maybe it's not the optimal language for writing your high-performance web server or a GUI application, but it can still help you out to learn how programming works at the core and the thought process behind it
>>
My first attemp for averagin two ints in C.
#include <assert.h>

int sign (int a) {
if (a < 0) {
return -1;
} else if (a == 0) {
return 0;
} else {
return 1;
}
}

int avg (int a, int b) {
int c;
switch (sign (a) * sign (b)) {
case -1:
return (a + b) / 2;
case 0:
return a == 0 ? b / 2 : a / 2;
case 1:
c = a - b;
return b + c / 2;
}
assert (0 != 0);
}


Hey /g/, is it correct?
>>
>>52373519
Who needs C when I have Haskell?
module Main where
import Data.Fixed

main :: IO ()
a :: (Double, Double) -> Double

a(x, y) = x / 2 + y / 2 + ( x `mod'` 2.0 ) * ( y `mod'` 2.0 )

main = print $ a(3. 7)
>>
>>52373519
>Calculating the average of two integer numbers rounded towards zero in a single instruction cycle
>in a single instruction cycle
fucking christ who let this shit slide
>>
>>52373573
I do too
>>
>>52373519
>>52373663
>>52373734
>>52373771
Hey guys, you do realise that this patent is for hardware encoders/decoders, right?
>>
>>52372940
>https://www.4chan.org/bans

3 day ban get rekt shitposters
>>
>>52373827
kek
>>
so, compiling in emacs without a makefile for my shitty fizzbuzz, is it possible? cus I'm guessing it's just changing the compile command from
 make -d 
to something else
>>
>>52373827
They're gone so you can stop shitposting now.
>>
File: logo.gif (6 KB, 133x63) Image search: [Google]
logo.gif
6 KB, 133x63
By the way guys, have you heard about Free Pascal and Lazarus?
They're good.
>>
>>52373841
Yeah just do M-x `compile` and then type in whatever command you want.
>>
>>52373841
>emacs
>>
>>52373856
yeah, obviously, but what? ./configure doesn't work
>>
>Disabled images in Chrome's settings and everything went slower

//No images
/ic/ - 1489ms
/p/ - 2068ms
/g/ - 1413ms
/b/ - 859ms
/toy/ - 1000ms
/vp/ - 545ms
/a/ - 384ms
/pol/ - 684ms
/hc/ - 695ms
/wsg/ - 999ms

//Images
/ic/ - 510ms
/p/ - 422ms
/g/ - 847ms
/b/ - 234ms
/toy/ - 387ms
/vp/ - 358ms
/a/ - 1572ms ??
/pol/ - 529ms
/hc/ - 107ms
/wsg/ - 589ms


What's going on, /dpt/? I cleared cache to make sure the images weren't preloaded the second time.
>>
>>52373822
yes, but the fact is that nobody else will be allowed to create a single instruction for averaging ints in 1 cycle without being sued, which is an extremely general thing to want for an architecture. also, not sure how hardware patents apply to software but couldn't they technically sue someone who used the same pattern of logic operators to emulate what those gates are doing?
>>
>>52373868
...The command you'd run to compile it. You know how to use a compiler, right?
If you're in c that'd like be something like `gcc -o fizzbuzz fizzbuzz.c`.
It's just whatever you'd type into your terminal.
>>
>>52373888
nah, it's one line of code
not like no one would ever replicate that.
>>
>>52373881
Upload a younger looking loli and we'll answer.
>>
>>52373892
>...The command you'd run to compile it
which is exactly what is up for discussion
>You know how to use a compiler, right?
I think we both know that I do
and make isn't working, sutogen.sh isn't working, ./configure also isn't, so I'm lost for what it is I'm missing
>>
Enlighten me about Nim, /dpt/.
>>
>>52373918
...open up a terminal and run those commands. Post the results.
>>
>>52373923
It's the new meme.
>>
>>52373888
>but the fact is that nobody else will be allowed to create a single instruction for averaging ints in 1 cycle without being sued,
If you do it in another way, then yes you could.

Or you can pay royalties. Or you could wait until the patent expire. I didn't read it in detail, so I don't know what class it is. Usually those kind of patents aren't valid for more than 5 years, and since it was patented in 1999...

>not sure how hardware patents apply to software but couldn't they technically sue someone who used the same pattern of logic operators to emulate what those gates are doing?
Technically, but it would be extremely hard to prove (read: totally unfeasible that they are able to prove it)
>>
>>52373952
Or you can do it in software like virtually all non-mobile platform decoders/encoders do these days
>>
>>52373881
that's a hella nice image

infinitely better than last OP's crudely drawn pic
>>
>>52373923
just a meme
use D
>>
>>52373923
it's still obscure but it looks fucking good
>>
>>52374022
I think I'll be adopting it sometime in the future, fuck around in it, write a meme program, etc.
>>
Question for the graybeards of /dpt/: what was programming like in the 90s?
>>
>>52373937
>make
no target specified
>/autogen.sh
no such file
>./configure
no such file
>>
>>52374092

It was impossible because Stack Overflow didn't exist yet.
>>
Back end web dev languages for linux? I don't want to use PHP and javascript/node
>>
>>52374160
Malbolge
>>
Awfully slow in here tbqh.
>>
>>52372697
>chrome
subtle, but i got it.
>>
>>52374160
Piet
>>
>>52372624

All languages have flaws. Rust applications can get rather large if you statically link them (default on Windows) because the standard library is so huge, and not separated into logical modules. So your hello world actually contains some networking and threading code. The language also defaults all strings to UTF-8... which is good if you don't need O(1) random access to individual characters.

Really, it all depends on one's needs.
>>
>>52372624
The syntax for dealing with lifetimes is practically esoteric.
>>
>>52374227
People love to have a big thick whine about that, but it's not bad at all. A couple of days to get the basics down, and a couple of weeks to get good at it.
>>
Does Pascal have any flaw?
Is Pascal the perfect language?
>>
>>52374211
>which is good if you don't need O(1) random access to individual characters.
I was under the impression Rust had char, which is a 32-bit value that can hold all UTF-8 characters?
>>
Does NuPRL have any flaw?
Is NuPRL the perfect language?
>>
>>52373243
Adults*
>>
>>52373715
Or he could learn C instead of a meme language since the majority of software is built with a language that has syntax similar to C. Learning C would allow him to quickly learn other languages using the same syntax.
>>
Does Visual Basic have any flaw?
Is Visual Basic the perfect language?
>>
Does Ook?! have any flaw?
Is Ook?! the perfect language?
>>
>>52374092
Great because there weren't a bunch of codemonkey autists trying to develop games.
>>
>>52374350
it cant average two ints
>>
>>52374359
yes there were, just not as many
>>
['h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd'].forEach(process.stdout.write)
>>
>>52374389
that looks like an awful way to traverse over string literals desu
>>
>>52374283

Rust strings are encoded as UTF-8 naturally. Presumably, one can interpret this either as bytes or as 32 bit codepoints.
>>
>>52374320
>the majority of software is built with a language that has syntax similar to C
why is that a reason to learn C though? Java uses pretty much the same syntax. PHP uses a similar syntax. but obviously you aren't telling him to learn either of those.
>Learning C would allow him to quickly learn other languages using the same syntax
assuming the challenge of transitioning was not an issue with the underlying principles of the language, yes. however, writing OOP code for Java or C# is an entirely different task than writing procedural C code. likewise, every language with C-like syntax is, semantically and architecturally, a wholly different beast than C and the syntax ends up meaning very little in reality. OOP style is much easier in a Lisp than in C. Rust's declarative semantics are in some ways closer to Lisp's than C's.
>>
>>52374380
Who gives a fuck about averaging integers when you've got this slick syntax
Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook.
Ook! Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook?
Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook. Ook! Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook.
Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook! Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook!
Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook. Ook! Ook.
>>
You are fools.
The real, undisputed king of first languages is Pascal.
>>
>>52374320
you can easily learn the basic syntax in a C-like language such as java, it doesn't have to be C just to learn the syntax
>>
>>52374426
>Java uses pretty much the same syntax. PHP uses a similar syntax.
That's the reason why it's good learning C first.
It paves the way to a lot of programming languages.
On top of being useful all by itself.
>>
>>52374488
>That's the reason why it's good learning C first.
Not really. Go give a programmer who only knows Java the source to a C program and ask them to explain it to you. Do the same with a Java program to a C-only programmer. It will be completely foreign because the difference between the two is semantic and not syntactical. If you gave a Lisp programmer Java code they would probably be able to read it about as well as a C programmer because they would be more likely to get the semantics even though they don't fully understand the syntax. Similar syntax means nothing about mutual intelligence. It would be like having two spoken languages where the words are mostly the same but the grammar is completely unintelligible to speakers of the opposite language and a lot of the words means something different despite sounding the same.
>>
>>52374389

(L<char>('H', 'e', 'l', 'l', 'o')).ForEach(Console.Write);


Weweee
>>
>>52374160
Clojure
Lua
Common Lisp
C
>>
>>52374536
>() for creating arrays / lists
>not lisp
your doing it wrong whatever language that is(I assume its some sort of D).
>>
>>52374582
>>() for creating arrays / lists
>>not lisp

C#, and it's actually just a method.

L<type>(....) is shorter than (new List<type>{...})
>>
>>52374535
I disagree.
As someone who learned both C and Scheme, I fail to see why you wouldn't choose for the language that offers you the most.
I wouldn't have learned C, had I learn Scheme first, because that would have disgusted me.
It may be elegant, but the realm of use you have for it is extremely limited.
>>
>tfw realised my prime fizzbuzz repeated the 5, too
Fixed.
>>
>>52374160
Scala
Python
>>
>>52374632
>I wouldn't have learned C, had I learn Scheme first, because that would have disgusted me.
as you can probably tell from hanging around in these threads for a bit of time, most programmers who use languages with a C-like syntax are equally disgusted with Lisp-like syntax
>>
>>52374160
I've written a server PHP, Javascript, Python, Java, and Haskell. You probably don't want to hear my experiences with PHP or js so:
>Python was simple setup but dynamically typed, which I personally dislike.
>Java was the most productive but was the most painful to set up.
>Haskell was the most fun but also the most challenging.
>>
>>52374649
Both C-like syntax and lisp-like syntax is disgusting to us Wirthian syntax Master Race.
>>
>>52374678
>Wirthian syntax Master Race
that's ALGOL-like syntax to you, mister
>>
>>52374678
Miranda syntax master race
>>
Unix was written in C. LISP machines were written in LISP.
I wanna see the source code to these LISP machines and run one.
>>
>>52372796
why not both

I picture a thread
a magical thread
in which lewd anime and l33t codes live in peace
>>
>>52374782
Impossible, anime rots your brain, so animefags are not capable of programming more complex than script-kiddying and fizzbuzz.
>>
>nobody in this thread is working on anything remotely interesting

where do the cool programmers hang out
>>
>>52374695
actually ISWIM syntax :^)
>>52374757
the most recent Lisp machines used Genera and you can still install it in VMs. there's this https://www.reddit.com/r/programming/comments/2emke/lisp_machine_operating_system_with_complete (for the Genera machines; wouldn't be surprised if the torrent is no longer online~) and http://www.unlambda.com/index.php?n=Main.Mit (for even older MIT machines)
>>
>>52374851
i am but i won't show you it

also i think i'm going to bed now
>>
>>52374782
>chrome addon to pull from extensive library of lewd
>changes everyone's post to have a lewd picture

There, stop picturing it and program it
>>
File: 1451051382875.png (299 KB, 942x848) Image search: [Google]
1451051382875.png
299 KB, 942x848
r8 my super advanced selector engine, /dpt/

function get(selector) {
if(selector.indexOf(" ") === -1) {
if(selector[0] === "#") {
return document.getElementById(selector.substring(1));
} else if(selector[0] === ".") {
return document.getElementsByClassName(selector.substring(1));
} else {
return document.getElementsByTagName(selector);
}
} else {
return document.querySelectorAll(selector);
}
}


is it as good as jquery yet?
>>
>>52374851

We hang out in universities and large corporations.
>>
>>52374851
Google
Facebook
Amazon

What industry has the least cool programmers?
>>
>>52374452
>ook
>not alphuck
eeeeeeeepaeeeepaeeaeeeaeeeaeccccisaeaeaiaaepcscisaajaiiijeeeeeeejjeeejaajcijcjeeejiiiiiijiiiiiiiijaaejaeej
>>
>>52374851
I hang out on reddit.

/r/ProgrammerHumor is fun.
>>
>>52374921
>Google
>Facebook
>Amazon
normie af
>>
>>52374905
Is there any particular reason to use getElementsBy... over querySelectorAll?
>>
>>52374851
what's something interesting I could work on?
>>
I wish ainmefags would go back to reddit.
>>
>>52374905
function $(expr, container) {
return typeof expr === "string"? (container || document).querySelector(expr) : expr || null;
}
>>
>>52374851
I'm working on a programming language.
>>
>>52374994
What interesting features are you implementing for your programming language?
>>
>>52374994

>nobody in this thread is working on anything remotely interesting

where do the cool programmers hang out
>>
File: SemiTransparentConsoles.png (826 KB, 1352x769) Image search: [Google]
SemiTransparentConsoles.png
826 KB, 1352x769
Just rebuilding some databases that got fucked up in a transfer.

I shoulda built these using a PHP file. I'm dumb as fuck.

I'll make a PHP file for them after they're done.

It's for a website I'm working on.

What I'd really like to make, though, is a pressure-sensitive waifu AI.
Maybe after the website starts bringing in a bit of da monies.
>>
>>52374676
I'm amazed Python has been used to much for important production things when it seems so rickety.
>>
>>52375028
Don't you fucking reply to me again unless you're contributing to this thread.
>>
>>52374851
>>52375013
/prog/
oh wait
>>
>>52375024
more people use PHP everyday though
>>
>>52375008
- Dependent types and all the stuff that comes with that (totality, propositional equality, etc.)
- Linearity (full linearity, not uniqueness)
- Codata and corecursion (lazy data structures)
- Compiles to native code with no GC
- Custom mixfix operators
- Approximate types for optimization (e.g. approximate natural numbers to unsigned integers)
>>
>>52374989
What about getElementsBy? It's supposedly a lot faster than querySelector.
>>
>>52375062
PHP is okay.
Obviously a necessity for websites.

Kinda like C/C++ better, but I really can't give up dat switch(string) ability in a production environment.
>>
>>52375063
so you're saying it's not as good as nim
>>
>>52375113
How is Nim better?
>>
>>52375126
http://nim-lang.org/
>>
>>52375113
I didn't realize the compiler crashing constantly was what people thought made a good language.
>>
>>52375211
That's not an answer.
>>
>>52375062
yeah and more people likes justin beibers songs everyday
>>
File: 1452059203558.gif (2 MB, 356x292) Image search: [Google]
1452059203558.gif
2 MB, 356x292
Hey guise, I have a major problem

I.HATE.TESTING

any test, manual testing, unit testing, any kind of testing. I just like to test 3-5 times then I get bored. How do I deal with this
>>
>>52375216
>the compiler makes the language
>>
>>52375249
What language are you writing in?
>>
>>52372532
>>52372561
>>52372583
>>52372622
>>52372644

>weebshit
>>
>>52372532
are there any anime about programming?
>>
What license should I release my software under?
I don't care if people use it with proprietary software, but I want any modifications to be published.
>>
>>52375266
c# asp
>>
>>52375299
LGPL
>>
>>52375292
No because anime is for children
>>
>>52372624
sjw bullshit is its biggest flaw, which happens to be its death knell as well
>>
>>52375315
tell that to evangelion
>>
>>52375311
Can I put a G in front of my program's name if I use LGPL?
>>
>>52375299
Mozilla Public License
>>
>>52375330
Edgy, "mature" shit is aimed at children trying to look like adults.
>>
Who here programs on notepad++ in rust for github projects for google?
>>
>>52375367
lmao maybe you'd get a lot out of it then
>>
>>52375330
panders to homosexual elementary students
>>
>>52375081
Kek, I'm not sure if this is an accurate way to test it, but if it is, querySelectorAll is slow as shit.

var time = Date.now();

for(var i = 0; i <= 100000; i++) {
document.querySelectorAll("div");
}

console.log("querySelectorAll: " + (Date.now() - time) + "ms");

time = Date.now();

for(var i = 0; i <= 100000; i++) {
document.getElementsByTagName("div");
}

console.log("getElementsByTagName: " + (Date.now() - time) + "ms");
Thread replies: 255
Thread images: 19

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.