HackerTrans
TopNewTrendsCommentsPastAskShowJobs

bslatkin

no profile record

Submissions

Mitchell Hashimoto uses a simple code editor

youtube.com
2 points·by bslatkin·hace 3 años·0 comments

comments

bslatkin
·hace 3 años·discuss
Contact form here: https://quil.la/FVZ3PMZC Thanks!
bslatkin
·hace 3 años·discuss
Great! Please send it my way so I don't miss it. Thank you
bslatkin
·hace 3 años·discuss
Scala has a lot of interesting concepts in it for sure! The problem is that the JVM is a deal-breaker, either because of its complexity or because of the associated licensing risk. Clojure has the same problem, for what it's worth.
bslatkin
·hace 3 años·discuss
For a very simple, single-expression lambda function I agree you don't need an explicit return. Even Python skips the "return" for lambdas. But for anything more complex, I find explicit returns, especially early returns, makes the code much more readable for people who are used to imperative languages.

For example, which of these is more clear to people who don't know Lisp? I'd argue the second one because of the early return if guard.

    ---- THIS ----

    (defun sum-helper (items total)
        (cond
            (items
                (sum-helper
                    (cdr items)
                    (+ total (car items))))
            (t total)))

    (defun sum (&rest items)
        (sum-helper items 0))

    (print (sum 1 2 3 4))

    ----- OR -----

    (defun sum-helper2 (items total)
        (if (not items)
            (return-from sum-helper2 total))

        (sum-helper2
            (cdr items)
            (+ total (car items))))

    (defun sum2 (&rest items)
        (sum-helper2 items 0))

    (print (sum2 5 6 7 8))
bslatkin
·hace 3 años·discuss
Let me know if you'd like to give it a shot to see how gunky it is!
bslatkin
·hace 3 años·discuss
Thank you. I think you've basically summarized the approach! If you have any specific guidance to that end please send me an email or DM with details :)
bslatkin
·hace 3 años·discuss
Let's keep going with the building analogy. You're running a cabinet making company. You've got all kinds of hand tools and power tools. You build jigs to make certain repetitive tasks faster. Then a ridiculously difficult design comes in for you to build. You and your crew are flummoxed by its complexity. Suddenly, someone offers you a CNC machine that you've never used before. What seemed hard is now easy. The nature of solving problems with a CNC is different. Using a CNC presents other challenges. But you have entered a new realm of what's possible. Analogies are a lot of BS but hopefully that gets across the flavor of what I'm talking about.
bslatkin
·hace 3 años·discuss
I understand what you mean. But I expect most potential users want explicit returns because they're familiar and more approachable for beginners.
bslatkin
·hace 3 años·discuss
I think Spark is a good example of where the functional paradigm has done well in a niche.
bslatkin
·hace 3 años·discuss
It's SSA. If you use (define) in Racket is it no longer functional?
bslatkin
·hace 3 años·discuss
I'm not an Elixir expert at all, but one important feature I believe is missing: explicit returns.
bslatkin
·hace 3 años·discuss
How should an early return if statement work instead?
bslatkin
·hace 3 años·discuss
Agreed that seeing structure is important. I mean operating on it at a higher level like https://calva.io/paredit/
bslatkin
·hace 3 años·discuss
I love to swing a hammer as much as the next programmer. But if you offer me a nail gun, even with slightly lower precision, I will happily use it the majority of the time and revert to my hand tools when it's most appropriate. This is about developing force multipliers and producing leverage, not avoiding the craft.
bslatkin
·hace 3 años·discuss
I've got a working interpreter and compiler for the initial language. I've had a few people take it for a spin and they were able to rapidly learn it and start contributing, despite having expressed frustration in trying FP languages in the past. All anecdotes for now!
bslatkin
·hace 3 años·discuss
Some parentheses languages are much easier to use if you're familiar with a structural editor, for example.
bslatkin
·hace 3 años·discuss
The conversation happened in ~2008.

Julia has a lot of great ideas in it for sure. Why hasn't it gotten more popular?
bslatkin
·hace 3 años·discuss
It's true and that is one of the largest challenges. Producing something that feels familiar (but not error prone) has been the way I've solved such conflicts so far.
bslatkin
·hace 3 años·discuss
I'm sorry to make you wait.
bslatkin
·hace 3 años·discuss
Great examples. Another question that leads to frustration is "can I use my existing code editor for this"? People are turned off when the answer is "no"