/dpt/ - Daily Programming Thread

Old thread: What are you working on Sup Forums?

Other urls found in this thread:

wiki.haskell.org/Tutorials
haskell.org/tutorial/
en.wikibooks.org/wiki/Haskell
u.teknik.io/WIepg.pdf
learnpythonthehardway.org/book/nopython3.html
twitter.com/SFWRedditVideos

First for fuck anime

Anime is amazing and so is Haskell

finishing little touches on book maker. im gona come back to doing the async stuff and forking out the final processes.

Also being a NEET too, right?

Those three always go together.

>dubs vs trips
I guess that settles it

I want to learn haskell. What are the best books/references?

probably LYAH (it's a bit outdated though) and the haskell wiki
feel free to ask questions here

how to become a magician?

here is a long list of tutorials
wiki.haskell.org/Tutorials

ideally you should install Haskell Platform

Thanks, I think I'll start through this one
haskell.org/tutorial/

looks good, but remember that's Haskell 98
the tutorial is from 2000

it's mostly the same, if you get any errors just ask

btw the API is good to go. i have done well i thinks.

this is also really good, but it's very in depth
en.wikibooks.org/wiki/Haskell

I prefer the Haskell Book (Haskell from first principles?) to LYAH... LYAH presents a lot of concepts in weird ways/weird orders IMO. although it's a hard language to get into so you should try balancing out different resources (example: don't get monads as explained in the Haskell Book? try the monad chapter of LYAH)

Is that one free though?

there's a PDF floating around somewhere. I think I have it on my phone somewhere but I'm about to go to sleep and don't feel like looking for it

oh damn I actually found it pretty fast u.teknik.io/WIepg.pdf

>Haskell From First Principles
>a paragraph dedicated to Scurvy

>make hello world in haskell
14 gigabytes

actually it's only 2 gigabytes

homework help
i had to make a coin counting thing in java, it works except I don't know how to make it so when someone enters something thats not a number, it tells them to try again.

Probably basic enough but googling this was difficult, its kind of specific and its probably not even part of the assignment i'd just like to cover all bases

import java.util.Scanner;
public class coins{
public static void main(String args[]) {

Scanner console=new Scanner(System.in);
boolean run = true;
while (run) {
System.out.println("How many cents do you have?");
String answer=console.nextLine();
Integer cents= Integer.parseInt(answer);

while (cents>=25) {
System.out.println("Quarter");
cents-=25;

} while (cents>=10) {
System.out.println("Dime");
cents-=10;

} while (cents>=5) {
System.out.println("Nickel");
cents-=5;

} while (cents>=1){
System.out.println("Penny");
cents-=1;

} if (cents==0) {
System.out.println("");

} else
System.out.println("Please enter a number between 1 and 100");


}
}
}

Integer cents = 0;
Boolean input = false;

while (!input) {
try {
cents = Integer.parseInt(answer);
input = true;
} catch (NumberFormatException nfe)
;
}

cool, thx

>make hello world in Java
>source code file is 50gb of boilerplate
oh yeah, there's also a website like "things I wish I knew before learning Haskell" and it's pretty helpful

whoops
you need to get a new line from the console in that while loop

...

how do i into makefiles

loop for input and catch the exception thrown by parseInt

Haskell is garbage collected. What went wrong?

import Control.Monad.Loops (untilJust)
import Text.Read (readMaybe)

readLn' = untilJust (readMaybe getLine)


reference cycles
though it's getting linear types back again soon, wonder if that'll help

it is worth pointing out Data.Foreign has pointers and malloc and free

or it was, at least
it would definitely be nice if you had more low level control in Haskell, and could e.g. guarantee a function doesn't allocate

I MAEK PORN MOAD
window.setInterval(() =>
Array.from(document.getElementsByClassName('post reply'))
.filter(domE => domE.getElementsByClassName('file').length == 0)
.forEach(reply => reply.style.display = "none")
, 1000 * 10)


Now what's the best way to make this into an extension - greasemonkey?

My pom.xml is bigger than most of my code.
Where did everything go so right?

create a demon summoning program

by the way holy shit Tk sucks in C

But since the language is purely functional wouldn't it be possible to plan memory management at compile time?

It collected itself

Whatever code you write, however simple, the haskell GC will be running

Look up an example and then just change stuff for your project. Then look up options on makefiles and fiddle around with the example

Yes.
But there's still tradeoffs between memory footprint and efficiency. Ideally for computation speed you'd allocate every piece of memory the program could ever need at once. Ideally for memory footprint you'd free every piece of memory as soon as it has been finished with it (or reuse the memory block if it's the same size).

Haskell does GC.
Which is good at neither of these things. Because if you cared you wouldn't be using haskell.

If you can't google them yourself, then I question your future as a programmer.

the motivation is being able to write GC-less code
and if all of the code is GC-less, then being able to run without the GC

user he's clearly putting our opinions ahead of everyone elses. He should have searched the archive if anything.

But of course you can question the idea that /dpt/ is the best place to ask people how to learn haskell.

Not sure I get you user.

but user, I don't trust Google and I like posting in /dpt/

I think he meant you could write a GC on top of GC-less code?

How did you get that from what I said?

You should be allowed to write code in Haskell that is guaranteed to not use the GC.
If none of the code in your program uses GC, the compiled program shouldn't even have the GC.

For instance:

print' x = observe x >>= print
main = runIO $ do
x

so then you're advocating that everyone use destructors and that's all?

as far as my understanding about haskell goes, it works at a level that pretty much puts it alongside the wire, kind of like c, except it also offers that monad like structures be the basis and so expects you to write code as if you were working on the wire rather than from the data table. But I'm still only researching and haven't done much coding myself. That means that code that wasn't fitted for running off a wire will rely on several existing monads to complete process rather than pass through the one.

No, I'm saying it should be possible to write code in Haskell that does not make use of GC, and if the entire program is made of that code, there shouldn't be a GC

here again

I hope you understand that means that we would essentially be defining our own gc sequence in parts...

I don't understand how you're not getting this.
I've written it quite explicitly, multiple times.

Do you just not believe that languages without GC exist? That all languages use GC? That even the first GCs made us of GC to GC their GCing?

How stupid is it to unroll a linked list into a flat array every time you want to do searches on it from the very end of the the linked list?

int list_search(struct list *ls, struct point *pt)
{
unsigned i, found = 0;
if (ls->head != NULL)
{
struct point **arr = malloc(sizeof(struct point *) * ls->depth);
struct point *node = ls->head;
for (i = 0; i < ls->depth; i++) /* unroll */
arr[i] = node, node = node->next;
for (i = ls->depth - 1; i > 0 && !found; --i)
if (is_equal(*arr[i], *pt))
found = !found;
free(arr);
}
return found;
}

Yeah, so it should be possible because..
a) I hate that the gc takes up cycles
b) I hate writing my own gc from the basis of a neutral algorithmic strategy
c) I hate gc for my own reasons

???

gc is good for keeping current memory more relevant but in the purest theory doesn't prescribe a solution to the problem of data management beyond narrowing our attention on the matter. Like the prison, healthcare, environmental systems that plague our country.

If so, are you an advocate of the open source and freedom of thought movement?

What the fuck are you fucking talking about you insane maniac?
Have you never fucking touched a language without GC before?
They're real, I'm fucking telling you, they exist

Polska = Anime >>>>>>> nie anime

Should I dip into functional programing by learning lisp (sicp) or haskell?

Haskell

Can you stop writing like that? Not everyone on earth is a degenerate weed weeb faggot.

> "const in C does not mean something is constant. It just means a variable is read-only"

what's the difference

What is with this inconsistency?? Only the penny is fucking up

Float or double rounding.

floating point rounding errors.

I use C for the most part but I have used java, cpp, csharp and vbasic, and the issue of gc comes up in lieu of recognizing unused variables that have been exacted memory. This makes for a distinction in volatile and constant memory which reduces a buffer strategy into parts amd thus slows the execution of the program. And with the advent of the gui, splits the current strategy to even more parts since it's not possible to tell if any of the data is even pertinent and thus must be type checked and planned for.

So having said that gc issues arise from the fact that people don't know how it fits and that sometimes it's nice to have the freedom to go back and check the data for one's self as a constant and reliable location in memory. The issues largely reside in the avenue of thought that advocates we all take responsibility for our own actions and that there shouldn't be a prescribed notion that should deal with any data we have apparently released from the stream that is tied to iteration about the data table.

Gc is mostly bad because it treats you like a retard and throws an error at you when you decide to check for the memory you released from the structure it was tied to. It's a nag.

I brought up the freedom of information and open source movement because just like gc bothers people for reasons to do with volatile memory, standardizing protocol the way closed source programs do through interface data obfuscation allows the system creators and capitalists ( as in those that funded it and have no liability but profit margin loss in the matter ) to do with the particulars of human participation as simply a notion of viability by enabling them to "do" as they will and call it "established". Kind of how apple products have been selling you the 70s in a black box and call it new and cutting edge.

I dont know what you are talking about really. It sounds like opinion for the sake of keeping the conversation on haskell but away from the particulars.

Yeah makes sense.
Not sure why this simply isn't the case.

Actually, to store money you use Dollars*100, i.e. cents and integer values

Were colors a mistake?

Compile time vs runtime

That's like saying an emergency exit isn't a door, it's salvation.

>Only the penny is fucking up
better call leonard then

>Americans are so backwards they use a currency with floating points.

top kek

>zimbabwe XDDD
Get the fuck out of here, with that reddit-tier "joke".

Floating point is not exact in the mathematical sense.
It's deterministic so there's no strange rounding going on really. It's just that you can't store exactly 0.1 in floating point due to its representation.

If you aren't already using a double change your float to a double if you require specific accuracy.

In the case of dealing with money I'd probably just count the lowest unit in integers rather than dealing with floating point.
So have a variable called 'cents' for instance.

you sure know a lot about reddit

>Americans pay in exact change

Because you can cast it away. There's no decent uses for the word const. Compilers can't really optimize anything relevant based on it. (I've heard from google's LLVM guy there's only one or two situations where it's used).
So use an enum or #define if you want an actual constant.

>python 2 handles unicode like shit
>python 3 is incompatible with python 2
>people are lazy to switch to python 3 because it's not a turing-complete language and it will require rewriting a shitton of stuff
>i gotta work with python
I hate this garbage language, fuck it, I'll be learning Perl.
It's one of the languages where garbage collectors don't work.

God that's cute.

How do I program a cat?

>not a turing-complete language
I don't want to defend memesnek, but you're full of shit.

thanks

i make big
big work

I know WHY it works the way it does. It doesn't make it less stupid.

well im dumb and didnt really show it but i just multiplied the input by 100 and added zeroes\removed decimals

const is useful when other people need to read your code

also const functions

>Americans don't put taxes in prices
>Americans tip

But it makes perfect sense. You need a way to say 'don't modify this normally' and you need a way to have things that can't be modified.
const do catch bugs for careless programmers. You can cast to const. Which is probably one of the most useful uses of the keyword.
Yes ok. But it's not a valuable thing from within the language.

Potentially slow.
Why not just store your data in a array?

I think the difference then is that const is "created" "dynamically" upon use
at the processor/kernel level. As in, it is "redrawn" by the processor, by value, rather than handed over as a reference. And while enum might be similar in use but impractical for single values, it retains a position, for use, in a higher order than the value and reference one. Also, they are intended to override state and seek no approval, as a concept, where const will simply contend as a bit in an AND operation where enum would require a whole apparatus for creating a state change as an order of principle.
This means you'd have to train engineers rather than train coders. This implies much more than simply changing a value this way or that way.

I would guess this really doesn't matter to you or, probably, anyone in this thread, though, as language design or the basis for the syntaxed approach doesn't really pay out in dollars, just sense. You also can't insult people if there is no competition on the basis of trivial features and/or trivial knowledge. Trivial in the trivia sense rather than meaningless.

>he's not up with latest memes
learnpythonthehardway.org/book/nopython3.html

>learn X the hard way
I'm not going to open that link. Zed Shaw is a hack, and you shouldn't listen to anything he says.

>American systems involve more than just weapons and profit from skimming value off of immigrant workers and over charging for services to make up for wages offered in lieu of indentured servantry and slavery
>I don't have a big dick

I don't, it's just a meme

>Zed Shaw
The original SV drama queen .

What the fuck are you on about?

user and I were having fun until you came along. Go awat.

How do you differ scripting languages from real languages?

Scripting language is english, real language is japanese

scripting languages come pre-arranged and function mostly on the software level. "real" languages use hardware to come up with values and references from the ground up to create a software basisbfor computation, if necessary.

So with that said scripting languages might make several late passes over unimportant info where you could program a real language to create the info on the spot using hardware resources. scripting languages hide the back of the thing from you, hence pre arranged. real languages expect you to know when it's time to poop and when it's time to eat.

>american english

>enlgish and japanese are two different syntax approaches to the linguistic approach to knowledge and understanding

in spoken english wa sounds like a question, in japanese it acts as a participle for "in question". in english writing it looks like a phonic strip, a phoneme, for some word or concept. in japanese it is an acting particle delimeter or just another phoneme. The difference made clear by the establishment of a change in character for the japanese particle delimeter so that it is understood the character isn't part of the subject but rather denoting a fold in the prescribed notion.

What is meant by garbage collector?