Haha nice. Honestly, I'm just so used to copy/pasting emojis from slack and discord. Fun fact, when you do that, it copies the colon emoji syntax, not the unicode glyph 😅🙃
Oh, I know almost nothing about Go. I'm specifically using these exercises to learn the syntax. No clue if and how what I'm doing can be optimized. Go is famously, weirdly restrictive and intentionally verbose.
Without lifetime
We return a new Vec free from any list provided, by cloning the data. The generic data type only allows the data type that implements Clone trait to be passed.
Wednesday
Array.diff (6 KYU):
Your goal in this kata is to implement a difference function, which subtracts one list from another and returns the result.
CodeWars
PowerShell
Expanding the ? alias:
Here's one in Dart:
PHP
Ruby
Similar effort when done in APL! :)
That's amazing!
On the other hand, Ruby probably allocated about 10,000 object references under the hood and used 1gb of memory to make that happen. 😄
Honestly, I just came out here to have a good time and I'm feeling so attacked right now 😅😅😅
github.com/thepracticaldev/dev.to/... 🙃
Haha nice. Honestly, I'm just so used to copy/pasting emojis from slack and discord. Fun fact, when you do that, it copies the colon emoji syntax, not the unicode glyph 😅🙃
@bendhalpern some numbers (using /usr/bin/time -l on OSX):
Disclaimer: I'm inexperienced with Go; using the example from below 😅
Oh, I know almost nothing about Go. I'm specifically using these exercises to learn the syntax. No clue if and how what I'm doing can be optimized. Go is famously, weirdly restrictive and intentionally verbose.
kkkkk it's very simple dude :D
Ah, cannot
unsee
this answer... 😆Same in Kotlin :)
Python!
List comprehensions are truly a gift.
YES -- they are so elegant.
Or with sets!
It wasn't as easy as doing a set difference as the
a
needed to keep the duplicate values.Below is the answer in C#.
Where
is the same asfilter
in JavaScript.F#
also sequence expression syntax
Or (although it will also remove duplicates from a):
Yes, this was my first thought, but I was trying to retain dupes.
Just define the subtraction operator and done.
Hey all, Why I don't see any java code here?
Common Lisp
I'll use lists because... well, it's Lisp, right?
Can't beat a good standard library ;)
APL
Replied to the post instead of the comment! My bad!
Another Haskell solution:
Haskell
Go
Rust
Tried in Javascript
Nice!!
Wow, great! So clean!