/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?
Previous thread:

Attached: flashingsmugmaid.jpg (795x1404, 183K)

delicious brown

i second this

I am a code.

Attached: 0790DC0A-AE5C-4EC9-A771-DB82CB4DF59F.jpg (400x400, 19K)

nth for everything seemingly working, but still not knowing what's wrong

>not white
to the trash it goes

I fucking love brown anime girls

Attached: 0be4cac2297f45d8fd34495445886423.png (1000x1350, 1.14M)

brown skin is ugly

man, i wish there were a financial incentive to write games and demo programs for old 8-bit micros, but, alas, there is not

Is it okay to give the same names to different variable across different functions?
Or should each function have variable with different names?

Attached: 1518994400.jpg (500x547, 43K)

give meaningful names

this

I just love huge anime tiddies

Attached: 1520634483983.jpg (248x203, 9K)

we all do lad

Attached: New Game!! - 10 (1280x720 HEVC2 AAC).mkv_snapshot_08.34_[2018.03.26_19.53.52].png (1280x720, 1.11M)

This.

who doesn't?

Attached: d9cd19a20cdad28847101f41be0374a8.jpg (546x960, 47K)

>brown
But not those kinds

Attached: 1526680971554.png (277x182, 69K)

When's the best time to start your transition, /dpt/?

I've been crossdressing for over a year, wearing programming socks for half a decade and watching anime since I was prepubescent, but I'm not sure if it's too soon to start on hormones.

I don't wanna jump the gun, but I also can't wait to be a cute little programming girl! Help!

Attached: welp.png (494x558, 295K)

you can't be cute little if you're above 160 cm.

faggot

the best time is t+1 where t is the current year

which direction do you prefer?

Attached: Capture.png (1010x653, 34K)

if you want to become a suicidal freak of medical science, go ahead
otherwise, seek therapy

Bouncing up and down ;3

Attached: is it just me or is it hot in here.png (592x377, 353K)

>wanting to be a cute little girl
this could be you.

Attached: Cuckline_Ada_Amgay.jpg (220x391, 19K)

Just added a simple file system watch mechanism to my operating system.
Now I can be notified when a new file is added to a directory, and stuff like that :)
This will be very handy for my file manager application.

Attached: Screenshot at 2019-07-22 21-38-49.png (1920x1080, 693K)

how do i make a function return a String^ array in c++?
String^ * s() { and array^ s() {
doesn't work
how do i do it?

Attached: 1555805395367.jpg (852x1024, 123K)

>my file manager application
is it going to be just a standard file manager with maybe a few extra features or some fresh approach to managing files?

Don't get my hopes up, user!

wtf is a string^

Something pretty standard and boring, I think. I always felt that Windows 2000 explorer was peak file management.

>pip install -r requirements.txt
>fails with a clang compiler error
what the fuck

It's a ligma technology.

Looks like some Microsoft abomination

What morphism can I apply to a binary tree such that morphing it with insert into another tree (initially Empty) would cause the insertion of the parent node's value before the left child's and right child's?
data Tree a = Empty | Leaf a | Node a (Tree a) (Tree a)

insert :: Ord a => a -> Tree a -> Tree a
insert x Empty = Leaf x
insert x (Leaf v)
| x < v = Node v (Leaf x) Empty
| x > v = Node v Empty (Leaf x)
| otherwise = Leaf v
insert x (Node v l r)
| x < v = Node v (insert x l) r
| x > v = Node v l (insert x r)
| otherwise = Node v l r

instance Foldable Tree where
foldr _ i Empty = i
foldr f i (Leaf v) = f v i
foldr f i (Node v l r)
= foldr f (foldr f (f v i) r) l
-- = foldr f (foldr f (f v i) l) r
-- = foldr f (f v (foldr f i l)) r
-- = foldr f (f v (foldr f i r)) l

the last block of code shows catamorphism done in all ways I thought possible, but in all cases insertion of the parent is never done before the children.

Take a seat, Anone. The JavaScript lesson will begin shortly.

Attached: 16c0fd301b00e15b10b49a72583f0e6e.jpg (1365x2048, 329K)

i dunno, some gay bulshit microsoft thing
i want to create like just like a basic gui application and to change the text in a label, it has to be label1->Text = a String^ and not just a normal string

you mean string*

can you give more details, perhaps with an example?

>t.

Attached: DyALOGFW0AAaF3g.jpg:large.jpg (500x399, 63K)

I don't know what a morphism is but have you tried
f v (foldr f (foldr f i l) r)

I am VLC

Attached: 51206-full.png (348x477, 348K)

Made a zip archiver in golang.

Next, I'll most likely be making a script to automatically produce placeholder tests, including re-export of unexported functions (also in golang).

So lets say I have a tree, might be Empty, Leaf a, or Node v l r, doesn't matter
Similar to how I can fold a list using foldr or foldl (which are catamorphisms) I want to be able to "consume" a tree in pre Order, which requires the parent to be "consumed" first before the children

A specific case I want to use it for is a delete function, which would be something like this
delete :: Ord a => a -> Tree a -> Tree a
delete x = foldr (\k r -> if k==x then r else insert k r) Empty


Note this code works but the insertion order makes it such that children are inserted first.
So I'm looking for a morphism, similar to foldr, which will consume the parents first, and such the tree structure will be much similar.

>go

Attached: 6730824646880.png (258x195, 85K)

as long as functions don't call each other in a retarded way like
fun1( A, B*)
{
fun2(A=A+B,B,A);
*B = fun3(B=A) ;
}


you're good.

foldr will never work because foldr will always associate right
its like this
foldr (+) 0 [1..3] => (1+(2+(3+0)))

the 3+0 would be done first
just as in
delete x = foldr (\k r -> if x==k then r else insert k r) Empty

the insertion of the parent node's value will happen last

I need something like foldl, where association happens towards the left

Do I have to incorporate in order to publish apps to app store without revealing my name? Do I have to file corporate tax returns and file annual reports every year if I incorporate?

Attached: transit.png (379x221, 32K)

Thanks big bro

you are the code of my tarball.

FWIW I have been doing C++ for over 15 years and I have still not mastered it. I'm pretty good but by no means a master.

I don't understand how your current version doesn't do that
foldr insert Empty (Node x (Leaf y) (Leaf z)) =>
foldr insert (foldr insert (insert x Empty) (Leaf z)) (Leaf y) =>
foldr insert (insert z (insert x Empty)) (Leaf y) =>
insert y (insert z (insert x Empty))

seems to me like x is inserted first
maybe I'm misunderstanding what you mean

Oh pardon, it seems the fault was with a function I used which used foldr insert Empty to convert a list into a Tree
I just fixed it to be foldl (flip insert) Empty

I think the catamorphism would be something like this (the first param is like (() -> r))
foldTree :: r -> (a -> r) -> (a -> r -> r -> r) -> (Tree a -> r)
foldTree empty leaf node tree =
case tree of
Empty -> empty
Leaf x -> leaf x
Node a l r -> node a (recur l) (recur r)
where
recur = foldTree empty leaf node

this way you get to choose what to do with left and right branches

What's the reason for using C++? It's such a badly designed language. You should do it again in Rust or TempleOS HolyC.

What does CV in EU format mean?

europass

Given two strings s and t, determine if they are isomorphic.

Two strings are isomorphic if the characters in s can be replaced to get t.

All occurrences of a character must be replaced with another character while preserving the order of characters.
No two characters may map to the same character but a character may map to itself.


Example 1:
Input: s = "egg", t = "add"
Output: true


Example 2:
Input: s = "foo", t = "bar"
Output: false


Example 3:
Input: s = "paper", t = "title"
Output: true


p.s.:You may assume both s and t have the same length.

I first learned to program by writing C in the early 2000s, and I liked it precisely because of the low amount of abstraction. I loved the feeling of "what's really going on in there?" and telling the computer what to do. Then I graduated high school and a few years later found out that essentially the whole industry was very focused on trying to get as far away from all that as they could and raise the abstraction level as high as possible.

Like, remember that screencap of the Javascript guy who thought a for loop was ugly and difficult to understand and insisted on using map()? I thought I had it but I can't find it. The prevalence of people like that made me want no part of actually working in software development.

what the fuck does this mean

Attached: ddddddddddddddd.png (368x23, 1K)

Can I take a seat on her lap?

capitalism is treating the working class as numbered objects rather than people

unironically this
if you can't fullstack you won't get anywhere in life

For loops aren't difficult to understand but a map is better if possible

object of class is stored in memory at address
learn c

where's pOnOs?

Has anything relevant been made in Clojure? Anything in the game making department? Website making department? What can I do with Clojure, basically?

Ligma? Is that something like updog?

Masturbate

Babby mode.
import Data.Function
import Data.List
iso = (==) `on` (map length . group)
main = print [ iso "egg" "add", iso "foo" "bar" ]

I don't think that's correct. What is iso "aba" "abc"?

Maybe he actually wants to get some work done

I'm really struggling with Big O and understanding the costs of computing stuff in general. (I can't even use the right terminology!) I swear I'm not a brainlet, but math isn't my strong suit. I have a really hard time with abstract math concepts if they aren't explained in with very concrete examples.

I've read a few articles and a couple chapters out of books. Is there a literal ELI5 for this? Or should I just not worry to much about and hope for it to "click" one day?

C is only good for doing the wrong thing very fast.

I only came into this thread to look at the pics.

That would be Python

how am i supposed to concentrate on my work, OP?
she's way too sexy, you fool.

Attached: 1535022814104.png (451x677, 301K)

don't worry about it and hop it clicks is sometimes a good strategy, as long as you don't confuse not worrying with avoiding

Nonsensical post, python is memory safe and remarkably slow.

it's extremely fast at doing wrong things

s_ ≅ t_ := Equal @@ Values@*PositionIndex@*Characters /@ {s, t}

Doesn't dynamic typing lead to runtime errors because less of it is checked by the compiler?

retard coming through

how bad is this? at least works i guess
def search(l,i):
return [x for x in l if x[0] == i]

def map_letter(s):
lst,c = [],0
for i in range(len(s)):
val = ()
if not search(lst,s[i]):
val += (s[i],c)
else:
val += (s[i],lst[i-1][1])
lst.append(val)
c+=1
return [i[1] for i in lst]

def solve(s,t):
return map_letter(s) == map_letter(t)

if __name__ == '__main__':
print (solve("egg","add"))
print (solve("foo","bar"))
print (solve("paper","title"))

What language is this?

isomorphic :: String -> String -> Bool
isomorphic a b = isomorphic_go a b Map.empty Set.empty
where

isomorphic_go (a:as) (b:bs) map values = case (Map.lookup a map) of
Nothing -> if Set.member b values
then False
else isomorphic_go as bs (Map.insert a b map) (Set.insert b values)
Just val -> if val /= b
then False
else isomorphic_go as bs map values

isomorphic_go [] bs map values = True


pretty standard implementation, just keep a map of characters in a to b and return false if we try to use a character in a that's already mapped to a character in b. also keep a set of all the values in b we've used so to prevent us from using two different characters in a that map to the same character in b.

Wolfram!

Attached: Inubashiri.Momiji.full.1923047.jpg (585x646, 338K)

python looks so fucking horrible.

Cute and cute

nah its pretty straightforward

revised version because found a case where didn't work
search = lambda l,i: [x for x in l if x[0] == i]
get_value = lambda l,i: [x[1] for x in l if x[0] == i]
solve = lambda s,t: map_letter(s) == map_letter(t)

def map_letter(s):
lst,c = [],0
for i in range(len(s)):
val = ()
val += (s[i],c) if not search(lst,s[i]) else (s[i], get_value(lst,s[i])[0])
lst.append(val)
c+=1
return [i[1] for i in lst]


if __name__ == '__main__':
print (solve("egg","add"))
print (solve("foo","bar"))
print (solve("paper","title"))

>if __name__ == '__main__':
Don't know python but that just looks gross

that's just the entry point
you can omit that

search = lambda l,i: [x for x in l if x[0] == i]
get_value = lambda l,i: [x[1] for x in l if x[0] == i]
solve = lambda s,t: map_letter(s) == map_letter(t)

def map_letter(s):
lst,c = [],0
for i in range(len(s)):
lst.append((s[i],c) if not search(lst,s[i]) \
else (s[i], get_value(lst,s[i])[0]))
c+=1
return [i[1] for i in lst]

print (solve("egg","add"))
print (solve("foo","bar"))
print (solve("paper","title"))

Any recommended book for design patterns?

Let's restrict to the case of time for now. n is some measure of the input, typically the number of elements in a data structure, but could also be e.g. the absolute value or order of magnitude of a number. If an algorithm takes O(n) time, it means that doubling n no more than doubles the time taken. If an algorithm takes O(n^2) time, it means that doubling n no more than quadruples the time taken. if an algorithm takes O(1) time, it means that doubling n does not affect the time taken. If an algorithm takes O(log n) time, it means that squaring n no more than doubles the time taken. You can generalize this to other functions of n. For instance, no comparison-based sorting algorithm on n elements can do better than O(n log n) time in the general case. You can also use O to describe how much memory or how many logic gates (or some other quantity of resource) an algorithm requires.

There are two key aspects of O that are a little trickier to understand: that it describes a rate of growth (so that coefficients are inessential) and that it is defined as n grows arbitrarily large (so that only the highest degree term is essential). Basically, that means that O(n) = O(an + b), O(n^2) = O(an^2 + bn + c), and so on. You can see that even my informal wording above (Xing n no more than Ys the time taken) justifies this. Even if the algorithm takes e.g. n^2 + 2n + 1 steps, doubling n to get 4n^2 + 4n + 1 steps is no more than 4x greater for any (non-negative) value that you can plug in for n (and in fact the difference gets arbitrarily close to 4x). So you'd just say it's O(n^2) time. The actual definition of O, which you would use in a rigorous proof, ensures this.

def indices(l):
d = {}
for i, c in enumerate(l):
if c in d:
d[c].append(i)
else:
d[c] = [i]
return d

def iso(s, t):
return list(indices(s).values()) == list(indices(t).values())

Attached: 296511.jpg (500x500, 133K)

SELECT emp.First_name AS First, emp.Last_name AS Last, dep.Name AS Department
FROM Employee AS emp, Department AS dep
WHERE emp.Department_id = dep.ID AND dep.Name = 'Marketing'


I'm reading through what are basically notes on sql an I've come to this example where I've noticed some peculiar details.

Can I use 'Department' instead of 'dep.NAME' in the WHERE clause? That seems to be the point of the alias in the SELECT clause.

Can aliases be equivalent to table names? 'dep.Name' or 'Department.Name' is aliased to 'Department' but the table of the aliased attribute is itself called 'Department'. Would this not cause a conflict/bug? Is this acceptable practice?

Also can you recommend an sql or general db resource? I've looked through maybe a dozen resources online and they're riddled with mistakes and bad English.

any plan to get back to working on networking protocol for your OS user

Okay so slightly less babby than first anticipated.

import Data.Function(on)
import Data.List

iso = (==) `on` (map nextIx . tails)
nextIx [] = maxBound :: Int
nextIx (c:cs) = maybe maxBound id (elemIndex c cs)
main = print
[ iso "egg" "add"
, iso "foo" "bar"
, iso "paper" "title"
, iso "abc" "aba"
]