/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: rust_is_inevitable.png (900x430, 58K)

Other urls found in this thread:

github.com/xxxboomerxxx/ayy/blob/master/scuffed_booru.pl
en.cppreference.com/w/c/header
en.wikipedia.org/wiki/Fold_(higher-order_function)
github.com/Karasiq/nanoboard
forum.dlang.org/post/[email protected]
twitter.com/AnonBabble

If you don't wish to suck on big soft cute anime boobies, you're gay and will never make it in programming.

Threadly reminder:
1. You can't spell trust without Rust.
2. Lisp IS NOT the most powerful programming language.
3. Every cute anime girl posted itt has cute soft anime dick, and wanting to suck it isn't gay.

Kernel in Haskell sans I/O

Repostan.

#
Signals can nest arbitrarily deeply, like you say. So the simplest solution that I can think of is the following.
>When a signal occurs, the kernel copies the process's previous register state to the process's stack. The kernel updates the process's register state so it will execute the dispatcher, then does so.
>A new syscall is implemented that yields then overwrites the process's register state with the contents of an array passed as a parameter before resuming ordinary process scheduling. The signal dispatcher returns to the kernel using this SWI and the array which the kernel set up just before calling the dispatcher.
Then signals can nest as deeply as the process has stack space for.

thoughts on this program i just wrote?

run it from a directory with pictures in it

github.com/xxxboomerxxx/ayy/blob/master/scuffed_booru.pl

Anime girls by definition don't have dicks.

Every anime girl has a soft feminine dick unless proved otherwise.

>unless proved otherwise
Therefore, every anime girl posted ITT does not have a dick.

I want a signal to nest deeply inside of me, if you get what I mean

If you want to make a scrapper library, make a scrapper library. A repo with a bunch of scripts is utterly useless.

>he doesn't understand basic logic
It's almost like you're a bigot who thinks girls can't have dicks.

It's a bold choice to name a language after something that's associated with decay.

post anime tiddies

data Tree a = Leaf | Branch (Tree a) a (Tree a)

cata :: r -> (r -> a -> r -> r) -> Tree a -> r
cata leaf branch = h
where
h Leaf = leaf
h (Branch l x r) = branch (h l) x (h r)

data Zipper a r = Root | Left (Zipper a r) a (Tree a) | Right r a (Zipper a r)

cataTailRec :: r -> (r -> a -> r -> r) -> Tree a -> r
cataTailRec leaf branch = down Root
where
down z Leaf = up z leaf
down z (Branch l x r) = down (Left z x r) l
up Root s = s
up (Left z x r) s = down (Right s x z) r
up (Right s x z) t = up z (branch s x t)

do not want

what programming-related expression does this image convey???

Attached: 1541568250816.jpg (900x1399, 436K)

This girl has no dick.

>he uses lambdas, map, and reduce in python

Attached: 1517786548791.jpg (418x396, 28K)

This one has tho.

python is a perfectly acceptable haskell

I've always wondered. Do you guys actually code like this in projects you work on or do you just do it this way to share online? This would be an F at my Uni. They're so keen on students learning uniformity and following style guide standards.

Since every programming language sucks, I'm making my own.
- It's a scheme-family lisp
- It compiles to C
- It will probably use VCGC for GC until I come up with a better scheme, and assuming it has good properties
- It will implement the chicken primitives so I can leverage chicken's eggs
- It will have shared memory parallelism
- It will have good control knobs for the gc (including being able to disable it globally and manually call (gc)).

There's a reason for that. In production code, you want to maintain readability so your team of 50+ engineers isn't constantly tripping over its own ego. Code like that would be rejected in an instant by anyone reviewing that PR.

When your code is affecting the bottom line of the business, everyone suffers. No one programs like that except people who don't actually have jobs.

t. Own a software consulting firm, was a CTO before this at a fortune 500 company

JavaScript rocks!

Attached: js-rocks.png (1000x494, 369K)

>It's a scheme-family lisp
Instantly dropped, didn't even read any further.

ur wrong

t. ur boss

Good. We don't want you pajeets here.

wtf? based

>- It compiles to C
>- It will have shared memory parallelism

Attached: 1524739763641.jpg (512x345, 30K)

This girl clearly has a soft tanned dick.

I'll ask at least once, who's the artist:

>We
Speak for yourself, good for nothing NEET. lmao

Lambdas are essential for many of the builtin functions, for example:
>>> from random import randint
>>> d = {i: randint(0, 100) for i in range(10)}
>>> d
{0: 67, 1: 26, 2: 83, 3: 32, 4: 79, 5: 42, 6: 66, 7: 38, 8: 81, 9: 68}
>>> sorted(d, key = lambda x: d[x])
[1, 3, 7, 5, 6, 0, 9, 4, 8, 2]

Why do you think they are useless?

No statements lmao

I really need to get this straight
int arr[size][size];
arr[x][y] //how I'd like to write intuitively.
arr[0][0] //first element of array *(arr+x*size+y) (effectively dereferencing pointer directly)
arr[1][0] //What I would want to be *(arr+1)
arr[0][1] //Reality: (arr+1)

//Supposing there's no inherent order the ints in the array need to be processed
void foo(int arr[size][size]){
for(int y=0;yxmax first and indexing [x][y] is highest there.

Need your advice.
My project say that I need to use C functions. If something is form is it still a C function or system specific function? Would it classify as C function?

I'm fully funded for the next few years, so I think it will be OK. If not, it will have been a good experiment anyway.
As for C as the intermediary language, it turns out there's no good option beyond that if portability and good C interop are concerns. LLVM, for example, breaks with every single minor version - both the generator library and the actual IR. {N,Y,*}ASM is dead and there doesn't seem to be other contenders at all.

I'm starting CS this Spring. I go to a pretty shitty college and was wondering if real Uni students could tell me if this is worth it or not. It's taught in Python.

These are subjects mentioned in the syllabus that I will be learning in the introductory course next semester. In order.

Week 1: Introduction to Operating Systems (Command Prompt, File System, etc.)
Week 2: Variables & Simple Functions
Week 3: Using Conditions & Iterations
Week 4: Recursion
Week 5: Expanding on Strings, Tuples, Lists, Dictionaries, and Sets.
Week 6: Reading, Writing, and Appending to Text Files, File Encoding, and Exception Handling.
Week 7: Looks like same as Week 6 but with binary files.
Week 8: Object Oriented Programming & Class Inheritance.
Week 9: Operator Overloading.
Week 10: Iterators & Generators.
Week 11: Command Line Processing.
Week 12: Regular Expressions
Week 13: Looks like week 6-7 again but with CSV, JSON, HTML, and XML.
Week 14: Manipulating Bits with Bitwise Operations

>C function
I classify this as a function written in C. By you or anyone else.
I would need more context. Are they covering for the fact that you might write system("python script.py")?

do the inner loop first, so the second example
if it's causing you confusion just use a 1D array

>taught in Python

That schedule looks like a mess too. But I don't know how your country's education system works anyway.

>is it worth it
If you like CS it obviously is. Don't waste your life on something you don't like

Attached: 137593505136.jpg (600x800, 61K)

it's fucking implied you can't do that
god i hate seeing students thinking they're clever by deliberately avoiding the rules
>draw a circle without drawing the letter O
>hehehehhhhhehheh ill just draw a 0 it doesnt say not to
>wtf why'd i get an F?

ooh yeah it teaches students to think outside of the box blah blah fuck off the course is to teach programming not how well you can manipulate the rules

Looks about right for an intro course

No, just need to measure time and I used for that. And I went deep with it. Now wondering if I should re-do it with some standard C library

It would be a very poor way to attempt to say "C standard library" if you said "C functions".
Ask the TA/prof.

>need to use C functions
I'd imagine they want you to split your code into standalone functions.

If the assignment mentioned nothing about system calls or C library features, then I don't think you'd have to worry about adding those.

But as a rule of thumb, anything in this list is available in all C implementations: en.cppreference.com/w/c/header

Thank you. Maybe I shall finally have inner peace.

The sys headers are POSIX functions and are technically not part of the standard. I would ask if you are allowed, I'm sure it would not be a problem.

Don't be an autist, it's quite clear what he meant.

>it's fucking implied you can't do that
Yeah but a rule might be there to help the less attentive students. Someone might think it's just cute if it's an intro course. Maybe they don't see any meaningful reason to pick a certain language and consider it fine to wrap a call to python in C code. It's done all the time in different context. But usually not from C to something else.

>People literally recording programming lectures
But why?

Attached: poppers.jpg (750x287, 35K)

that looks fine for an intro course, but I wouldn't expect much from it

>people taking photos of power point that is accessible to everyone on college website

Attached: 1a7.jpg (291x173, 9K)

>Week 14: Manipulating Bits with Bitwise Operations
DEPRECATED

A python script to do my homework

>guy opening up a word doc and typing out (on uni computer) the shit the professor is putting on the board for the first 15 minutes, giving up, and leaving the document open without saving it or emailing it to himself
>every single lecture
he surprisingly missed every test except for the second one and the final and didn't withdraw or drop the course

en.wikipedia.org/wiki/Fold_(higher-order_function)

Attached: lambda.png (1024x1024, 19K)

>Week 2: Variables & Simple Functions
>Week 3: Using Conditions & Iterations
>Week 4: Recursion

The fuck? That should say Lesson 2, 3, 4 now week

I think it looks like a reasonable introductory course. It's a shame you are forced to start with python, I think it's a bad first language because of dynamic types, but it's fine. Just never forget that
- Python is bad
- Object oriented programming is bad

You should learn both, so no harm done, just pay attention when you get started in functional programming

alright alright mr. my uni taught us all of x86 assembly in week 8 of an intro class

more like lamdon't

Attached: 1453651274892.jpg (263x217, 27K)

>What is Nanoboard: it is steganographic imageboard without centralized server or p2p: users share nanoposts by posting png-containers (with nanoposts hidden inside) on real imageboards (users negotiate which imageboard threads to use for posting containers in special Nanoboard thread).
And it has proof-of-work, too. Not sure if cool or stupid.
github.com/Karasiq/nanoboard

My uni unironically has 10 week courses and my intro was C in parallel with with discrete math so 2 lessons per week and they covered entire basics of the C in less than 20 lessons. I attended only 2 lessons anyway.

>also termed reduce, accumulate, aggregate, compress, or inject
>compress, or inject
>if you know what I mean...

Attached: ohmy.jpg (550x420, 41K)

>there are Russians secretly posting ITT
Jesus Christ how horrifying.

Attached: shocking truth.png (892x502, 307K)

test

He мoжeт быть.

fuck off, lurk moar

im trying to make an update statement in sql where it either substracts or adds to a field depending on what the user chooses, but im literally a brainlet when it comes to sql. Any help?

This sounds like the same text book my University uses for their introductory option for students with no prior experience. But they don't teach in that order.

It doesn't teach you Python. It teaches you programming fundamentals using Python examples because it's an easy language to learn. You'll learn about variables, functions, loops, io functions of programming languages, object oriented concepts, etc.

You're next course will probably be some actual introduction to Java and discrete math. Most schools now start with Python then Java then C/C++ and then an optional assembly course. This is the typical CS path. There's branches you can specialize in. My Uni has 3 different paths you can take after passing introductory CS and discrete math. The web route leads towards web development, JavaScript, Ruby on Rails, mySQL, PHP, etc. The standard Python -> Java -> C/C++ route, and they have classes that specialize in embedded programming where you jump straight into C/C++ and work with Arduinos and do robotics and other stuff. But it requires a ton of math courses so not as popular as the other two.

This is just a shitty public Uni that offers guaranteed acceptance to in state high school students who graduated in top 10% though. It's affordable and better than nothing.

Is it bad that I solved an exercise using chain of bitwise operators instead of using bit field?

no fuck you
Ive haven't been able to post for the past day.
All i got is connection error at random

How many lines of code should a project have before you can upload it to github? I'm new to programming, so I'm just learning Java and objects atm. I was considering hangman, but I'm not sure if that's too small or not.

Attached: 1541887351421.jpg (627x470, 42K)

1000 is the minimum set by GitHub, it'll deny it otherwise

Making passive aggressive post on Dlang forum
forum.dlang.org/post/[email protected]

Attached: 2k48t0.jpg (500x607, 19K)

Oh no!
Wait a minute...

Attached: 1541773037151.png (153x307, 92K)

It would be nice if that was true. left-pad is on github unfortunately.

>1000 lines of code is the minimum
no wonder there are so few Haskell programs on github

Attached: 1482346087159.jpg (436x428, 34K)

Кaкoй yжac

Yeah, that's the reason.

Attached: smug_anime_girl.gif (1280x720, 386K)

>no wonder there are so few Haskell programs on github
That's just because haskell is useless for non trivial projects

I thought you were switching to Rust?

>This immediately struck me a very weak syntax to me so I decided to explore my concerns.
make the eyebrows 10 degrees steeper

Yes, but I have to master Rust first.

In what world did you expect lines 12 and 13 to work, and why aren't you using a foreach

Why not? I'm simply asking how you make writeln distinguish between an arg meant for writeln from an arg meant for &total?
Either I am ignorant or this is just a shitty fucking syntax

Mostly you don't seem to know the basics of programming at all, in any language.

Explain

To add, I usually use delegates and closures.
It's very rare for me to use function pointers, I'm using it because I'm forced to do so.

I love Lisp is truly the most powerful programming language.

Because writeln doesn't do that? I don't know what you're looking for

>spawn(&worker, arg)
"Oh, the arg is meant for worker"
>writeln(&total, arg)
"Oh the arg is meant for writeln, so is &total lmao"

>Rust

Imagine learning a language that will not last even a century

anons, what's the diff between "calling" a method and "invoking" a method?

same shit

one rigs your phone other rings your anus

same thing next question

thx. also double doubles checked

Why aren't you on /pr/, isn't it much better? They have a general of different languages. I can only read russian, if I could type I'd probably move there