Steve Dekorte
01/16/2020, 10:12 PMDuncan Cragg
01/16/2020, 10:16 PMIvan Reese
shalabh
01/16/2020, 10:17 PMshalabh
01/16/2020, 10:18 PMDoug Moen
01/17/2020, 12:45 AM@shalabh "Unlike zero, which was invented very early in maths, how come we never needed the empty string until we started working with computers?"?? The empty string was invented by mathematicians long before the first programmable computer was built. Axel Thue invented string rewriting systems in 1914, so the idea is at least that old.
shalabh
01/17/2020, 12:55 AMDoug Moen
01/17/2020, 12:56 AMMaybe
type (or Either
type) is the best solution, if you are using Haskell, because then your code is compatible with all of the Haskell infrastructure that supports the use of Maybe
types, and you don't want to force other Haskell programmers to have to write glue code to interface with your non-idiomatic API.
If you are programming in Clojure, then Maybe types are not the best way to represent this concept. Clojure isn't Haskell. If you are using a Clojure map, then omitting a field from the map is a better way to indicate missing data. I think that Rich Hickey's talk is directed at Clojure programmers, not at Haskell programmers, in order to explain why you shouldn't blindly import Haskell idioms into Clojure, when Clojure has its own idioms.Steve Dekorte
01/17/2020, 1:03 AMIvan Reese
Steve Dekorte
01/17/2020, 1:33 AMwestoncb
01/17/2020, 3:34 AMStefan
01/17/2020, 6:24 AMwestoncb
01/17/2020, 8:09 AMwestoncb
01/17/2020, 8:14 AMshalabh
01/17/2020, 7:37 PMSteve Dekorte
01/17/2020, 9:47 PMwestoncb
01/18/2020, 12:41 AMwestoncb
01/18/2020, 12:54 AMwestoncb
01/18/2020, 12:58 AMStefan
01/18/2020, 1:11 PMshalabh
01/18/2020, 11:12 PMDoug Moen
01/18/2020, 11:27 PM@Stefan "I see a huge opportunity in hiding this kind of complexity. It will likely not have any performance benefits, but putting these computation cycles to work to no longer make people distinguish between Int32 or Int64 or Int and Float, ... seems like a path to massively simplify programming for people trying to learn it."I agree with this, and I'm doing it in my project for that reason. Curv has a single numeric type, the "number", which is represented internally as a float64. No need to explain why 1 and 1.0 are different objects, or why (in Ruby) 7/2 is 3 but 7.0/2.0 is 3.5. Javascript works this way. It's an old idea. Dartmouth BASIC worked this way, in the mid 1970's. APL worked this way in the mid 1960's. Where I encounter a problem with having a single Number type is when I want to work with huge, multi-dimensional arrays, which blow up memory if all numbers are 64 bits. In this case, I need to exert precise control over how array elements are laid out in memory. I need representation types like UInt32, Float32, and UNorm8 (a number between 0 and 1, represented using 8 bits, so that 0x00 is 0, 0xFF is 1, 0x55 is 1/3, and so on. This last one is used for representing RGB values in a pixel array. So now I can create a "typed array", where I use a representation type to specify how abstract values are mapped onto bit patterns in memory. This is a low level programming interface, and is only needed by developers who are developing libraries that use efficient internal representations for data. This interface shouldn't be needed by typical end users, who only need to understand about abstract values like "numbers". So there is a way to do low level programming without inflicting all of the concerns of low level programmers onto end users who are just using high level library interfaces.
Niko Autio
01/19/2020, 7:52 PMDoug Moen
01/19/2020, 9:22 PMSteve Dekorte
01/19/2020, 9:32 PMNiko Autio
01/19/2020, 9:44 PMhttps://www.beslogic.com/wp-content/uploads/2018/05/type-inference.png▾