HNHacker News
TopNewBestAskShowJobs

bakul

647 karma · joined July 29, 2013

submissionscomments
bakul··on Algol 68: A Retrospective
I believe the original Algol-68 didn't have full closures. For example, the following (taken from the revised report) wouldn't work:

  proc f = (real x) proc (real) real: (real y) real: x + y;
  proc (real) real g := f (3);
As by the time g is created, x of f has disappeared from the stack.
bakul··on 9cc: A Small C Compiler
With no freeing, memory used is the sum of all allocations. With freeing, it is max of the allocation for active objects at any given time. The former can ask for much more memory from the OS for some programs that generate a lot of temp garbage. Though this probably doesn’t matter for a C compiler - unless it is required to compile megabytes of generated code!
bakul··on 9cc: A Small C Compiler
How does this compare to Nils Holm’s subc compiler that has somewhat similar goals? There is a book describing the compiler as well (though the current version of the compiler supports a larger subset of the C language).

https://www.t3x.org/subc/index.html

bakul··on The History, Controversy, and Evolution of the Goto Statement [pdf]
In John Reynolds "The Discovery of Continuations" paper he cites an interesting observation by Doug McIlroy:

"So while van Wijngaarden said that goto's were unnecessary ... , Dijkstra stretched the point to say that goto's were inconvenient. The latter lesson stuck."

Essentially Van Wijngaarden was talking about a continuation passing style, where the remainder of a program is represented as a function, so at the end of a function you always call another function and no function ever returns! Read the paper: https://homepages.inf.ed.ac.uk/wadler/papers/papers-we-love/...

bakul··on The Remarkable Brain Waves of High Level Meditators [video]
Did your experiment show a measurable signal difference between stable vs wandering attention? Mindfulness supposedly helps with executive dysfunction (either due to frontal lobe brain injury or ADHD). It would be an interesting experiment to see if feedback via such a headband can help improve focus.
bakul··on The Remarkable Brain Waves of High Level Meditators [video]
http://web.mit.edu/6.111/www/f2017/handouts/FFTtutorial12110... shows an FFT implementation using a Cyclone EP2C20 FPGA. It can do 50ksps, 1K points, 12bit precision, 100 µsec/1K complex FFT @ 50Khz clock. May be a Zynq can be used to build a standalone device?

I wonder if the EEG signals can tell if your attention wanders. That may help improve meditation.

Have you looked at/played with the Muse or Muse2 EEG headband?

bakul··on The Remarkable Brain Waves of High Level Meditators [video]
I bet there are people who have watched TV 6 hours a day for 29 years (over 62,000 hours). I guess you can call them "olympic level" couch potatoes. Their brainwaves should also be studied and compared with these "olympic level" meditators, right?!
bakul··on Why Sleep Apnea Patients Rely on a CPAP Machine Hacker
iamelgringo’s comment was pretty convincing. Thanks for referencing it.
bakul··on AMD’s Rome is indeed a monster
What would you do with such a system that is innovative and not just more of the same?!
bakul··on Fifty Fizzbuzzes
Neat!
bakul··on Fifty Fizzbuzzes
Are there any shorter programs than these two k3 ones?
bakul··on Fifty Fizzbuzzes

  {:[~x!15;"fizzbuzz";~x!3;"fizz";~x!5;"buzz";$x]}'1+!100
  {:[0<#w::[x!3;"";"fizz"],:[x!5;"";"buzz"];w;$x]}'1+!100
bakul··on A Plan 9 C compiler for RISC-V [pdf]
I compiled linux on the raspberry pi just for kicks! Most people don't recompile the kernel so it doesn't matter but this just goes to show how misguided our blind quest for micro-performance has been.
bakul··on A Plan 9 C compiler for RISC-V [pdf]
It took a minute to compile plan9 kernel from scratch on the original raspberry pi (running plan9). You can even cross compile a x86 kernel in similar time. 10 seconds in 9vx emulator running on FreeBSD/amd64. I don’t recall the details now but a from-scratch Linux kernel compile was 10 or 11 hours (under Linux on the same raspberry pi). Thank goodness it wasn’t written in C++; the compile time would’ve been so much worse!

C compiler optimizations seems like micro-optimizations when people should be looking at the bloat elsewhere. Missing the forest for the trees.

C is basically a low level language. A portable assembly language. A predictable compiler shouldn’t second guess the programmer’s intent. To put things in perspective, if all the man-years spent on gcc were spent on GNU Hurd... :-)

bakul··on Channels, Concurrency, Cores: A New Concurrent ML Implementation (2017) [video]
Indeed.

Meant to write "Go allows safe concurrent access but doesn't stop unsafe concurrent access to shared data structures"

Thanks & sorry for the confusion.

bakul··on Channels, Concurrency, Cores: A New Concurrent ML Implementation (2017) [video]
Concurrent pascal didn't allow unsafe concurrent access to shared data structures. Go allows safe concurrent access but doesn't stop such access. Its authors encourage people to use channels but this sharing is intrinsic -- one can start a nested function as a concurrent goroutine & it has full concurrent access to its environment. Go tools can check for race conditions but ideally such support should be in the language itself. So in a sense Go is worse than Concurrent Pascal for the main feature it touts!
bakul··on Why do things go right?
This article seemed inconclusive. They identified some differences of factors between things going right vs wrong but didn’t follow through with a scientific study.

Atul Gawande’s “The Checklist Manifesto” comes to mind, where he argues that even experts need checklists to walk them through the key steps in any complex procedure. These complexities are such that it is easy to forget a key step or two. Following such checklists or written procedures minimize errors. He then shows how using checklists improves successful outcomes significantly.

bakul··on Keeping a plaintext “did” file
In a way the whole point of making todo lists is mindfulness -- to pay attention to a task when needed. The point of automation is exactly opposite -- you don't want to pay attention to something!

A todo list is more effective if you do regular reviews (daily/weekly/month/yearly). Similarly mindfulness at the time of deleting a someday task may provide useful feedback.

bakul··on Keeping a plaintext “did” file
In my .zshrc I have

  todo() {vi '+$' ~/todo/$(date +Y/%m)}
  +() {echo + $* >> ~/todo/$(date +Y/%m)}
  -() {echo - - $* >> ~/todo/$(date +Y/%m)}
Each month's entries are in a separate ~/todo/YYYY/MM file. The + command is to record something done. The - command is to enter a new task. The todo command is for editing this month's file -- add month-days, update entries, cleanup etc.

Separately I have current and last 2 month files open in the leftmost column of acme (about half as wide as other columns). This is for moving entries between months etc. I have to remember to do a Get before editing and Put when done editing to sync with any updates done from command line.

In the same column I have a per year "projects" file (multiple indented lines per project) and a per year "future" file (things I may want to do someday).

This is far from perfect but has endured. A simple grep can tell me what was done or what needs to be done in a given month or year.

For taking notes in a meeting I have now switched over to using an ipad + apple pencil as I can scribble notes, draw pictures, doodle etc. without having a laptop screen between me and others or clicking keys annoying people.

bakul··on TerminalView – A terminal inside Sublime Text 3

  $ size /usr/local/plan9/bin/acme
      text    data     bss      dec       hex   filename
    356886   14680   52332   423898   0x677da   /usr/local/plan9/bin/acme
bakul··on Show HN: Fo: An experimental language which adds generics on top of Go
On the other hand writing such packages becomes easier as only two syntax extensions are needed (package header and import). You can easily abstract a package by replacing a concrete type with a package level parameter. More importantly, there is no other mechanism to tie together a bunch of objects, functions, methods etc. to the same parameter types.
bakul··on Show HN: Fo: An experimental language which adds generics on top of Go
Think of it as a package macro.
bakul··on Show HN: Fo: An experimental language which adds generics on top of Go
If you want a more motivating example, try implementing generic array operations such as reduce, scan, each, reverse etc. Ideally these should be as easy to use as this example:

  x := reduce(func(a, b int)int{return a*b}, []int[1,2,3])
  y := reduce(func(a, b string)string{return a+b}, []string{"a", "b", "c"})
Rob Pike implemented "ivy", an array programming language, in Go but producing something like an array programming package that can be used from Go (sort of like NumPy for Pyhton) can be very messy to use or implement (even with the use of reflect package).
bakul··on Show HN: Fo: An experimental language which adds generics on top of Go
Try implementing a shared map type where access is protected by a mutex and otherwise works just like Go's builtin map type (which is a generic map type).
bakul··on Show HN: Fo: An experimental language which adds generics on top of Go
Did you consider parameterized packages? The idea is you can declare a set of related objects/types/methods as well as have concrete type specific initialization. E.g.

  package stack[t]
  type Type []t
  func New() Type { return Type{} }
  ...
  
Then it can be used so:

  import s “stack”[int]
  var s1 = s.New()
bakul··on A History of APL in 50 Functions
Using a Scheme like syntax, */x is ((over +) x). That is, over is a higher order function, yielding a new fuction.
bakul··on A History of APL in 50 Functions
The original reason may have been that k3 was not open source and the free version was limited. But in general people write these things for all sorts of reasons. Just as there are dozens of Scheme interpreters.
bakul··on Sl: a mirror version of ls
I’ve used these aliases since I first started using csh (below syntax for zsh):

  alias   .=cd
  alias   ,=pushd
  alias   ,,=popd
  alias   ,.='dirs -v'
No need to alias .. as in zsh you can use a dir name as a command to cd to it. Setting cdpath can further cut down on typing. For example

  cdpath=(. .. ~/go/src ~/src ~)
bakul··on Drawing an elephant with four complex parameters (2008)
Most anyone can "do" origami given instructions. But no one came up with a single fold design until David Mitchell did -- minimalist designs are only easy in hindsight. At the other extreme we have Robert Lang's amazing creations (which may require many more than four complex parameters!).

http://www.langorigami.com/artworks/mammals

bakul··on Drawing an elephant with four complex parameters (2008)
http://www.origamiheaven.com/ & http://www.origami-instructions.com/ have many examples with instructions for single sheet designs.
← PreviousPage 10 of 12Next →