HNHacker News
TopNewBestAskShowJobs

judicious

164 karma · joined September 4, 2023

submissionscomments
judicious··on Ask HN: What are you reading?
Blank Space: A Cultural History of the Twenty-First Century by W. David Marx. A fascinating and approachable read.
judicious··on The Weird Concept of Branchless Programming
I’m by no means an expert on this topic, but what about using predefined hash map of value to function call/closure unless that also yields branched programming underneath? Additionally, maybe you want to use macros of some kind to generate the “magic” function you’re looking for, where it constructs a single branchless statement up to N terms, whether it’s procedural macros in Rust or C macros.
judicious··on Turkish language has a gossip tense
Something like this occurs cross-linguistically: https://en.wikipedia.org/wiki/Evidentiality

Turkish has some evidentiality.

judicious··on Snapshot Testing for the Masses
Here's a link to their library in GitHub: https://github.com/tigerbeetle/tigerbeetle/blob/588123f219f1...
judicious··on Lesser known parts of Python standard library
That's incredibly clever, generators are underrated. I once challenged my friend to do leetcode problems with only expressions. Here's levenshtein distance, however it's incredibly clunky.

  levenshtein_distance = lambda s1, s2: [matrix := [[0] * (len(s2) + 1) for _ in 
  range(len(s1) + 1)], [
          [
              (matrix[i].__setitem__(j, min(matrix[i-1][j] + 1, matrix[i][j-1] + 
  1, matrix[i-1][j-1] + (0 if s1[i-1] == s2[j-1] else 1))), matrix[i][-1])[1]
              for j in range(1, len(s2) + 1)
         ]
         for i in range(1, len(s1) + 1)
     ], matrix[-1][-1]][-1]
judicious··on Lesser known parts of Python standard library
I guess for most purposes, OrderedDicts are then obsolete, but I believe there are some extra convenience methods that they have, but I've only really needed to preserve order.

Makes you think what other parts of Python have become obsolete.

judicious··on Lesser known parts of Python standard library
I find converting things from map objects or filter objects back to lists to be a bit clunky. Not to mention chaining operations makes it even more clunky. Some syntatic sugar would go a long way.
judicious··on Lesser known parts of Python standard library
Dictionary comprehensions can be very elegant. List and dictionary comprehensions are very powerful and expressive abstractions. In fact, while not good practice you can pretty much write all Python code inside comprehensions including stuff regarding mutation.

This is valid(as in it will run, but highly unidiomatic) code:

quicksort = lambda arr: [pivot:=arr[0], left:= [x for x in arr[1:] if x < pivot], right := [x for x in arr[1:] if x >= pivot], quicksort(left) + [pivot] + quicksort(right)][-1] if len(arr) > 1 else arr

print(quicksort([1, 33, -4, -2, 110, 5, 88]))

judicious··on Lesser known parts of Python standard library
There in lies another reason why OrderedDicts are still useful even in 3.12
judicious··on Lesser known parts of Python standard library
I work with different versions of Python3 (and 2 unfortunately) and some code is still in 3.6, hence I used OrderedDicts.
judicious··on Lesser known parts of Python standard library
I find defaultdict, OrderedDict, namedtuple among other data structures/classes in the collections module to be incredibly useful.

Another module that's packaged with the stdlib that's immensely useful is itertools. I especially find takewhile, cycle, and chain to be incredibly useful building blocks for list-related functions. I highly recommend a quick read.

EDIT: functools is also great! Fantastic module for higher-order functions on callable objects.

https://docs.python.org/3/library/itertools.html

judicious··on Show HN: Fructose – LLM calls as strongly typed functions
Definitely very excited to see this be a thing. Genuinely liked the approach to make function calls strongly typed and rely on functional programming principles.

During my senior year, I worked on a research project very similar to this and I’m glad to see this out there for everyone. I’d love to connect with the team if possible!

judicious··on Signals and Threads: Performance Engineering on Hard Mode
I’m always amazed by the level of the discussions on Signals and Threads. I especially enjoyed hearing about the challenges with performance engineering in OCaml versus C++. The work on unboxed types is very promising.
judicious··on Elixir at Ramp
This is unironically my plan/playbook with ideas I have for startups. Start with Python, node, or whatever. Then go to Rust once product-market fit has been established.

Rust really hits that sweet spot with memory-management, programming paradigm flexibility, and speed. It’s precisely great for what I need because it’s essentially an ML with good imperative constructs.

judicious··on Elixir at Ramp
I loved reading the “making of” post. I’m very interested in getting into technical writing and your post, really helped me understand your thought process behind “Elixir at Ramp”.
judicious··on Elixir at Ramp
Totally agree, when is everything is functions and data, it makes life a lot easier. I especially find it useful when refactoring code while trying to keep an existing function signature.
judicious··on Elixir at Ramp
Kotlin, definitely an interesting choice for backend development. But I love to see idiosyncratic language choices being made.
judicious··on Elixir at Ramp
Do you foresee a larger scale migration to Elixir in the future?

Or would you say that Elixir lends itself to some services and Python others?

judicious··on Elixir at Ramp
Yeah, I’m definitely curious too. From what I know Ramp is primarily a Python shop on the backend.

I just love to see functional programming being used in industry and seeing the thought process behind it.

Also, I agree. I’m a big fan of Pablo’s posts.