Hacker Newsnew | past | comments | ask | show | jobs | submit | kpgiskpg's commentslogin

I think a recent update (March 3rd, version 2.5.3) to SBCL added this sorta breakpoint debugging functionality. Hopefully we'll see it integrated with SLIME soon.

> enhancement: breakpoint debugger commands have been added. Included is a stepper based on breakpoints requiring no extra instrumentation. However, it still has less functionality than the existing single stepper. See the new debugger manual section titled "Breakpoint Commands" for more information on the new commands.


That's a question of interface design. You can also create ugly, ambiguous interfaces with functions (10 arguments, it mutates some of them, etc), or any other language feature. If a library designer uses operator overloading well, then it should be obvious what "a+b" is doing if you know the types involved.

On one hand it's a question of philosophy -- do you provide the user with tools to better express themselves, if they might possibly shoot themselves in the foot and create a crappy interface?

On the other hand, it could be an engineering issue. Maybe it's not worth the technical challenge or the increase in complexity for the language designers. I'd be more sympathetic to this reason. Then again, Python and C++ manage it.


(Author here).

Here's a not-so-mathy application that I had recently. I was implementing a units system in Python. Operator overloading allowed me to define joules like so: `J = KG * M**-1 * S**-2`. Then I could define grays (a radiation-related unit) like `Gy = J/KG`. Repeat for hundreds of units. If I had to do it in Java, I'd be frustrated by the verbosity and it would be easier to make mistakes.

My point -- Guy's point, actually -- is that if you don't give people the ability to grow a language, then their expressive power will be limited. And you can't anticipate ahead of time all the ways they'll want to express themselves.

Admittedly, my application is kinda mathy under the hood, because the units exist in a vector space. I guess that's to be expected when the operators come from maths.


> Operator overloading allowed me to define joules like so: `J = KG * M*-1 * S*-2`. Then I could define grays (a radiation-related unit) like `Gy = J/KG`. Repeat for hundreds of units.

Presumably exponentiation rather than multiplication by a constant, right?

This is cool and reminds me of how the Python Z3 binding uses operator overloading to let you express arithmetic and logical constraints

  >>> import z3
  >>> s = z3.Solver()
  >>> a, b, c, d = (z3.Int(x) for x in "abcd")
  >>> s.add(a*b == c+d)
  >>> s.add(a+b == c+d)
  >>> s.add(a!=0,b!=0,c!=0,d!=0)
  >>> s.check()
  sat
  >>> s.model()
  [d = 6, c = -2, b = 2, a = 2]
  >>> s.reset()
  >>> s.add(a>1, b>1, c>1)
  >>> s.add(a*a + b*b == c*c)
  >>> s.check()
  sat
  >>> s.model()
  [c = 17, b = 8, a = 15]
(It's limited in some ways for some reasons, like for some types and relations you may have to use a Z3 function to express a relation even though Python has syntax for it -- the example that I know of is that you have to use z3.Or(), z3.And(), etc., with boolean variables instead of Python's builtin boolean operators. Not sure why.)*


Oh wait, Hackernews seems to have removed one of the astericks symbols. It should be Python's exponentiation operator (2 astericks symbols), ya. (edit: fixed now).

That's cool too! How do you define the variables?


Oh wait, I left that part out! I'll edit my post.

... there we go.

You use Z3 objects that represent unknowns of particular types, like Z3.Int, Z3.Bool, etc. Each one returns an object representing a variable of that type, which can then be used in (Python-formatted!) expressions that you give to a solver.


My favourite illustration of this is in The Wire. The city wants to crack down on crime and increases the target number of arrests. The police chief sends out the word and police officers begin making a bunch of spurious arrests. Do you blame the politicians for picking crappy metrics and for their poor understanding of human nature? Or do you blame the individuals who choose to exploit the metric out of self-interest? Plenty of blame to go around.


The Reply All episodes on the real life version of this are a really good listen if you haven't heard them already: https://gimletmedia.com/shows/reply-all/o2hx34/

(Short interview with one of the hosts on the episode: https://www.fastcompany.com/90249924/reply-all-podcast-nypd-...)


The textbook example is when they wanted to reduce the rat population somewhere and paid people for (catching and) bringing in dead rats. Instead, people started to breed them and "sell" the dead specimens to the city.


This looks awesome! I wonder why I haven't heard about it before.


The previous user said that you can do "literally anything" in VSCode that you can do in Emacs, I think these examples were chosen to prove that statement wrong. It doesn't mean that Emacs is better for everyone.


I would also think that no one even cares to write an email client or a window manager inside an IDE even if that is possible (it probably is).


I didn't realise that popes getting poisoned was a common occurrence at any time in history.


From about 756AD to 1870, the Holy See was its own country occupying much of central Italy. Popes during this time were subject to any and all risks that contemporaneous rulers would face in similar circumstances. Not only that, but many times during this era the Throne of St. Peter would be held by a man who might be the scion of a powerful and ruthless family (Borgia, Medici, Barberini)that had much experience with assassins...


The pope was the king of an aggressive military power for much of the church’s history.


You don't have to go far for this stuff [0].

[0] https://en.wikipedia.org/wiki/Pope_John_Paul_I


I don't see anything about poison?


Before you write it off as tinfoilhatter speculations [0], please consider this was the time in Italy when an acting Prime Minister (Giulio Andreotti) took active part in a hit job on a former Prime Minister (Aldo Moro) [1].

[0] https://en.wikipedia.org/wiki/Pope_John_Paul_I_conspiracy_th...

[1] https://en.wikipedia.org/wiki/Kidnapping_of_Aldo_Moro


I actually started working on a CLI calculator a few days ago that sounds exactly like what you're looking for: https://github.com/Kevinpgalligan/ka

So far it just has variables and basic arithmetic. Other features on my roadmap: rational numbers, a type hierarchy, units, and lazy/smart combinatorics.

What do you imagine the timezone DB would look like? I'd love to hear your ideas!


I've always hated matplotlib, even though it gets the job done. The graphs are ugly by default, and the API would be unusable if it weren't for StackOverflow. Maybe I just need to sit down and learn it really well.

Anyway, this seems cool.


> even though it gets the job done

How is this an addendum, rather than the main point? I will always take a flexible library that allows me to "get the job done" over a declarative framework that will do something similar to—but not exactly—what I need.


Getting the job done is the main point, of course, but I think a visualisation library should also handle common cases gracefully and have defaults that don't make me want to gouge my eyes out.

Every time I use matplotlib, I have to look up how to remove the border on my graph, make things slightly transparent, etc. The default colour palette isn't colourblind friendly, so the other day I spent half an hour trying to set up a more accessible one. I had to create / fetch 3 objects, their names being something like ScalarMap, Normalize and cmap. Why do I need to understand the relationship between these 3 objects when all I want to do is switch from one palette to another?

Meanwhile, it's so flexible as to be annoying for a non-expert. I often encounter matplotlib answers on StackOverflow about things that I would expect to "just work", but that actually require 20 lines of code to solve, written by someone who appears to be deeply familiar with the internals of the library.

Note: I'm not saying that a declarative approach solves these things.


I've come to the same conclusion.

GGplot2 is _very_ nice to use and an incredible library...as long as you want to do something the package author approves of. Want to change some behavior about how bins are generated because the default behavior lies? Too bad.

Matplotlib is ugly, but it doesn't make decisions for you, and once you understand it, you can do anything with it.


A library should make the common things easy and complex things possible.

Matplotlib makes everything complex.


While writing my thesis I found matplotlib to be quite beautiful with adjustments only on the text (use LaTeX rendering to fit in with the thesis doc itself) and colour schemes; that is literally three lines of code at most. It's not ugly by default either, it produces very crisp graphics easily.


Beauty is in the eye of the beholder, I guess. I wouldn't put matplotlib graphs in a paper without tweaking the style, and it gets frustrating when you have to do this for every single plotting script you write. And the defaults certainly aren't colourblind-friendly.


eh, you know, you can put your styles in a rc-file? and yeah, you have to load your defaults every single script (though you have to do that with every tool?!)


Isn't it amazing how truly bad matplotlib is?

And it gets worse because it gets new APIs with almost identical names to the previous ones, without a proper guide for when to chose which API.

And yes it's just so ugly by default.


Calculus Made Easy has a heap of exercises at the end of each chapter, it's not bad in that respect.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: