HNHacker News
TopNewBestAskShowJobs

smlckz

445 karma · joined February 24, 2020

submissionscomments
smlckz··on Python's Type Checking Renaissance
Imagine ...

1. a -> b :: Function(a)[b]

   (a, k1=t1, k2=t2) -> b :: Function(a, k1=t1, k2=t2)[b]

2. JSON = RecTypeVar('JSON', lambda Self: Union[None, bool, int, float, str, List[Self], Dict[str, Self]])

huh!

smlckz··on Python's Type Checking Renaissance
There is Hindley-Milner type inference. Don't need to type types in most cases. See, for example, OCaml.
smlckz··on Extracting the list of O'Reilly Animals
* ''Women armament workers'' (Linux Cookbook)

* ''Woman Blacksmith'' (Linux Networking Cookbook)

* ''Woman on Circus Trapeze'' (Network Security Tools)

huh! not animals!!

smlckz··on All 104 amendments to the Constitution of India as Git commits
Only ''authoritative'' translation into Hindi but not for any other language from English. See 58th amendment of 1987. You may find unofficial translations though.
smlckz··on All 104 amendments to the Constitution of India as Git commits
If diff is not enough, you have wdiff. :)
smlckz··on All 104 amendments to the Constitution of India as Git commits
It should not be hard to do the same to this one, given that the constitution of india came into effect on 26th january 1950.
smlckz··on Ask HN: Anyone know any funny programming jokes?
I actually read all of them. Why they stopped adding new ones? Any similiar list of programming koans?
smlckz··on Ask HN: Anyone know any funny programming jokes?
I think the integral is

        4 * integrate sqrt(r^2 - x^2) w.r.t. x from x=0 to x=r
which is from the equation of circle with radius r centered at the origin:

        x^2 + y^2 = r^2
        => y = sqrt(r^2 - x^2)
any other way achieve the same using integration?
smlckz··on Parler Tricks: Making Software Disappear
Now that governments are trying to catch up with the latest happenings, they might be able to stop Big Tech to achieve ''sovereignty''. But, as more people move towards free software, the governments in lust of power would like to restrict the freedom of the people in dealings with software. Also, oppressive goverments may use ''free'' software in oppression. How can we take away their ''freedom'' in such circumstances? (Can we? I don't think that is possible.)
smlckz··on That XOR Trick (2020)
My bad. Thanks for pointing it out.
smlckz··on That XOR Trick (2020)
Correction: It is not ~(n & 1), but !(n & 1)

Or ((~n) & 1) as ChrisLomont pointed out

smlckz··on That XOR Trick (2020)
What is O(0)? Computation that takes 0 time? Does that make any sense?
smlckz··on That XOR Trick (2020)
(n+1)%2 = if (n+1) is divisible by 2 then 0 else 1 = (n+1) & 1 = ~(n & 1)

((n + (n % 2)) // 2) % 2 = ((n + (n & 1)) >> 1) & 1 = ((n & 2) >> 1) ^ (n & 1) = (n ^ (n >> 1)) & 1

In human terms, that means XOR of 1, 2, ..., n is: (if (n is divisible by 2) then n else 0) + (if ((if (n is divisible by 2) then n else n + 1) is divisible by 4) then 1 else 0)

Or, as code: n * ~(n & 1) + (n ^ (n >> 1)) & 1

Phew! Can this be made any simpler or smaller?

1 ^ 10 = 11, 11 ^ 11 = 0, 0 ^ 100 = 100, 100 ^ 101 = 001, 1 ^ 110 = 111, 111 ^ 111 = 0, 0 ^ 1000 = 1000, ...

----

If you have some time, take a pen and a paper and think it through, you'll really like it...

smlckz··on Kinx: A scripting language for people who want C-like syntax
It is like Perl minus $@%*&'s

It is like PHP, but without namespace pollution (like C has)

It is like JavaScript: the good parts

It is like C : as advertised, only in syntax

== End of free advertising, yeah ==

It is like Wren or Squirrel, but not as lightweight. Why the source code tgz'd is more that 100MB?

smlckz··on Kinx: A scripting language for people who want C-like syntax
The Makefile of this project starts with

    .POSIX
and then you have an ifeq .. endif block? and then after a few lines:

    %.o: src/%.c
Why?
smlckz··on Kinx: A scripting language for people who want C-like syntax
This is going to be ''the next big thing'', I'd like to predict.

But one request, please: make 'break' implicit at the end of each case in switch statements, introduce fallthrough (fallthru?) as a keyword instead.

(How many times did you need to NOT use break in switch-case?)

smlckz··on The State of FOSS in India
muft = gratis, ''free as in beer'', mukt = open, ''free as in freedom''
smlckz··on The State of FOSS in India
> ''Think of free as in free speech, not as in free beer''

< ''Muft nehi, Mukt''

smlckz··on The State of FOSS in India
>> Inception of FOSS [1886-1978]

What happened in 1886?

smlckz··on A Brief Introduction to Forth (1993)
And after forth, there's Tcl. And lisp. These three are the most easily implementable, for which we have so many dialects of them. What other languages are so small, simple and easy to implement?
smlckz··on Blërg, a microblogging platform
I thought, great! I now am curious about how it was implemented. So I did:

        $ git clone http://git.bytex64.net/blerg.git
        Cloning blerg...
        error: Empty reply from server (curl_result = 52, http_code = 0, sha1 = 95d56e6cc [...])
        [...]
Sigh! How can we look at the C code?

[EDIT: now looked at other comments about how this is a joke... is this error intentional?]

smlckz··on Next Gen Static Blogging
I do not have much experience in awk, but after reading Solene's and your code, I am curious about why < > are escaped with \ ?

In your m.awk, I also noticed that the markdown formattings (bold, inline and links) are not turned off in code blocks.

smlckz··on Next Gen Static Blogging
Here's some crazyness: https://dataswamp.org/~solene/2019-08-26-minimal-markdown.ht...

I suppose it is not much hard to translate this into PHP...

smlckz··on Haskell is a Bad Programming Language (2020)
Here is a very good argument on why types are needed, by Bartosz Milewski: https://bartoszmilewski.com/2014/11/24/types-and-functions/
smlckz··on Haskell is a Bad Programming Language (2020)
Maybe Haskell is bad from practical perspective, but not from theoritical. So it has a strong appeal towards academics and purists.
smlckz··on Ask HN: Predictions for 2021?
* Many more droughts, floods, cyclones, typhoons, hurricanes, earthquakes, forest fires, and other kinds of natural calamities.

* More pollution, global warming, rise of sea level, more health threats etc.

* Political and socio-economical instability, crisis and maybe a third world war?

smlckz··on From Trotsky to Gödel: The Life of Jean van Heijenoort
Mathematics and politics. Whom else can I remember? Ah! Galois. Do you remember more mathematicians who were also very involved in politics and other subjects which are (mostly) unrelated with maths?
smlckz··on C Template Library
You're welcome. And you might like to see ''sys/queue.h'': https://github.com/openbsd/src/blob/master/sys/sys/queue.h
smlckz··on C Template Library
You do not need variadic macros!

        #define foreach(container, variable, iterator) \
        for (JOIN(container, it) iterator = JOIN(JOIN(container, it), each) (variable); \
        !iterator.done; iterator.step(&iterator))
Is this less nice? I personally do not like dangling )'s [I did not have to write DOS batch scripts :D]
smlckz··on Announcing LAMBDA: Turn Excel formulas into custom functions
With Turing-completeness, the obvious problem is infinite recursion.

Say, you defined a function OMEGA as:

        =LAMBDA(F, F(F))
and then call

        =OMEGA(OMEGA)

hmm.

Well, it is not clear if Excel's LAMBDAs are first-class or not. If not, the above wouldn't work.

← PreviousPage 3 of 6Next →