freenode/#lisp - IRC Chatlog
Search
13:44:39
pjb
the fact is, if you have to go to Mars or farther, what programming language should you bring with you? stackoverflow will be at more than 1/2 hour away for Mars, days, or years away if you go farther!
13:45:44
pjb
Will you bring a language for which armies of programmers are needed to develop libraries or give you help to write each line, or will you bring a language in which YOU CAN write everything yourself.
13:52:20
devon
Aeons ago, a friend parodied Dijkstra "My graduate students vill profe a theorem und I vill publish a paper ... but we've no help for the poor slobs in the trenches who minimize head motion to optimize seek time."
13:56:18
pjb
Well, that's not a good parody, because Dijkstra would have had no problem designing an algorithm proven to be the best to optimize seek times.
18:30:08
akoana
Xach: Thank you very much for your work on quicklisp, I really appreciate it - it's especially helpful for a newbee like me.
18:32:50
Posterdati
cage_: no, I'm looking at it... Cazzilli = slang from the city of Cagliari means "not so useful stuffs"
18:39:17
Posterdati
I think would pass 2 or 3 millenia before english could acquire the richness of italian language! :) lol
18:54:54
drewc
(loop :with time = 0 :until (or (fall-of-p *roman-empire*) (>= time (get-universal-time))) :do (incf time) :finally (return time)) => 3758122365
18:59:13
drewc
There is a cl lib based on it that I use daily, and have started porting to another language :)
19:01:00
drewc
CL-USER> (local-time:universal-to-timestamp 3758122762) => @2019-02-02T10:59:22.000000-08:00
19:03:13
drewc
I have some links to related CL libs on the readme here: https://github.com/drewc/gerbil-local-time
19:06:23
drewc
Time is still a big issue for development. My clients have offices in Vancouver, Calgary, Toronto, Montreal, Halifax, and report to London, England. There are reports that want "days". Ok... days where exactly?
19:07:57
drewc
Postmodern has SIMPLE-DATE: http://marijnhaverbeke.nl/postmodern/ . I use that as well, along with local-time, and some other hacks, to try and give what they need.
20:23:56
verisimilitude
I prefer to separate it between what I call ``historical time'', which is measuring time based on regular occurences such as the rotation of the Earth, including leap seconds and all of that crap, and then have just ``time'' for what should be an objective measurement of seconds.
20:24:48
verisimilitude
Base sixty has some nice factors, though, so if we ever reach Star Trek levels of time management, I'd think just extending sixty seconds, sixty minutes, further would be best.
20:26:27
verisimilitude
If you get 60^3, that's just under three days; 60^4 is 150 days; 60^5 is 9,000 days; it works rather nicely, actually.
20:35:49
verisimilitude
That 60^5 unit splits a human life rather well; you'd only live three or four of them, if that.
20:40:02
verisimilitude
It disgusts me that figuring how many seconds old I am, to any reasonable accuracy, requires searching through historical records to see when the idiots decided to add leap seconds here and there and other nonsense.
20:41:16
verisimilitude
If you wanted to create a program that actually traverses the history of the world, as a knowledge base, you'd need to see when a week was subtracted there, and so on and so forth and it's hideously complicated.
20:48:46
pjb
verisimilitude: not counting the international flights you made, which means your proper time got desynchronized with that of Earth!
20:49:48
verisimilitude
I didn't even think of that, though, although probably because I didn't need to.
20:51:56
verisimilitude
See, hideously complicated. I'm usually against changing things just because programming in relation to them is difficult, but time is a mess every which way.
20:54:38
pjb
(let ((my-birth-date '(00 30 18 15 03 1964))) (- (get-universal-time) (apply (function encode-universal-time) my-birth-date))) #| --> 1732073075 |#
20:59:33
aeth
verisimilitude: Base 12 has most of the advantages. Base 60 is just 12*5 for some compatibility with our base 10 (2 * 5) world. The advantages of divisibility (12 items can be divided evenly many ways, while 10 can only be divided evenly into 2*5 or 5*2) are probably not that good now that we live in a digital world. Base 16 would be the way to go IMO.
21:00:36
jackdaniel
luckily for us software is made for real world issues, not for programmers convenience. I doubt computers would be so popular otherwise
21:00:38
aeth
If we had to have a from-scratch number system it would either be base 12 for better dividing, or base 16 (or base 8) for better digital compatibility, though.
21:03:21
verisimilitude
I took the first three primes, two, three, and five, and multiplied them; then you can easily work in halves or thirds or fifths.
21:03:36
verisimilitude
This is also reasonable for a person to learn, since it's still comparable to a normal alphabet.
21:04:21
aeth
30 = 2 * 3 * 5; 12 = 2 * 2 * 3; 8 = 2 * 2 * 2. If you just care about splitting things up, 8 or 12 are simpler because they're smaller. No one would care about fifths if we didn't have base 10
21:05:05
aeth
12 gives you 4ths which are arguably more important than 5ths. You get halves, thirds, and fourths with 12, you only get halves, thirds, and fifths with 30
21:05:36
aeth
60 gives you the most desirable splitting, but it's too large for humans to normally work with as digits
21:05:46
verisimilitude
Really, I'd say base sixty, but that seems unreasonable for a person to learn and may get cluttered with easily confused symbols.
21:07:33
aeth
Oh, and I said 60 doesn't give you 8 but half a minute is a nice, neat division so you can still divide your hour (or other time unit) up into 8
21:07:42
verisimilitude
A base that's a power of two isn't good for thirds, which I'd think is too much to give up.
21:08:44
aeth
The advantage of using octal or hexadecimal is that all of the counterintuitive properties of floating point go away, and the world is increasingly a binary floating point world, with no sign of mainstream decimal floating point support in sight.
21:08:50
verisimilitude
Ultimately, I think it should become a common skill for people to work in many number bases; people are mostly just accustomed to ten and only sixty for time.
21:09:16
aeth
Using a base 2 number system, floating point is (afaik) basically just scientific notation with truncation or rounding in places.
21:11:06
aeth
If my mind was ever uploaded into a computer, and I'm probably born too early for that, I suspect hexadecimal would be more natural to use, at least if my mind got augmented by the technology instead of merely being replicated.
21:11:14
verisimilitude
Let's segue into a Lisp topic; I'm disappointed with using BIT as a stream element type.
21:11:32
verisimilitude
SBCL just ignores every octet that isn't zero or one, which isn't the behavior I wanted.
21:11:41
aeth
verisimilitude: Technically speaking, we're just debating over which *print-base* and *read-base* to use so it's roughly on topic
21:13:32
verisimilitude
So, instead, I'm forced to use (UNSIGNED-BYTE 8) and manually pick it apart, which isn't fun because I'm implementing a format that isn't octet aligned.
21:14:14
verisimilitude
Then again, I could be lazy and wasteful and manually create the bit stream myself.
21:14:16
aeth
if it's not multiple-of-eight I'd expect pain points somewhere along the way no matter what
21:14:46
aeth
Might even be best just to be wasteful and pad it. If you're doing 12, just put 4 0s at the end.
21:16:39
pillton
versimilitude: According to the Handbook of Floating-Point Arithmetic, the Russian SETUN computer represented numbers in radix 3 which is good for floating point arithmetic.
21:17:51
pjb
Once again, only clisp is conforming here: integer 2 is out of range, cannot be output onto #<CLOSED OUTPUT BUFFERED FILE-STREAM (UNSIGNED-BYTE 1) #P"/tmp/bits">
21:19:19
aeth
verisimilitude: Space vs speed trade-off, it's probably worth it on modern machines to be faster. If you intend to save it to disk or send it over the network, you also can use those bits to ensure that the data is still valid.
21:23:04
pjb
(with-open-file (bits "/tmp/bits" :element-type (quote bit) :direction :output :if-does-not-exist :create :if-exists :supersede) (write-sequence #(1 0 2 0 1 0 1 0) bits))
21:23:48
aeth
Built in github/gitlab/etc. pastebins are underused, but they're probably the most reliable
21:24:01
pjb
(with-open-file (bits "/tmp/bits" :element-type (quote bit) :direction :input) (let ((v (make-array 8 :element-type 'bit))) (read-sequence v bits) v)) #| --> #*10101010 |#
21:25:01
pjb
I don't know at sbcl. I would expect bit by bit. which is what clisp does, apart from a header used to complement the octet file size.
21:26:14
verisimilitude
To repeat, SBCL has a nasty habit of simply ignoring any octects that aren't zero or one, in this case. I'm stuck working around (UNSIGNED-BYTE 8), unfortunately.
21:29:17
pjb
verisimilitude: yes, it's crazy, abcl, ccl ecl and sbcl write one byte per bit! I strongly advise you to use clisp.
21:29:54
verisimilitude
I have CLISP installed, but I'd prefer it work on most anything and (UNSIGNED-BYTE 8) is the LCD for this.
21:30:26
verisimilitude
If there were ever an update to the Common Lisp standard, this is just one of the things I'd like to see, proper bit writing and all of that.
21:31:25
pjb
verisimilitude: note that the difficulty here, is when the file size metadata is not specified in bits, but in bytes (which can be different from octet by the way).
21:32:03
pjb
verisimilitude: clisp has to add a header to store the actuall bit size differential, since it cannot count on being able to save an additional metadata.
21:32:17
aeth
pjb: In practice, a byte is an octet and a word is a nonnegative integer multiple of an octet. These are assumptions that essentially all future hardware will make (but some historical systems might not have made)
21:33:08
pjb
aeth: and also in practice permanent storage is not always done on hard disk using octets.
21:35:50
verisimilitude
Nevermind, I suppose. Anyway, what is that ninth bit usually used for, pjb? I'm not familiar with tape much.
21:36:31
pjb
verisimilitude: yes, probably parity. On the other hand, punched cards had 12-bit bytes.
21:37:01
pjb
verisimilitude: otherwise, you must learn about abstraction. This would restore your aesthetic sensibilities.
21:38:50
pjb
Yes, but you could have subfunctions, to decode the bytes into bits. and instead of collecting a list of them you could store them to a bit-vector.
21:43:21
verisimilitude
The most convenient way is to rewrite it in Common Lisp as much as is possible.
21:44:06
no-defun-allowed
I don't consider eating more memory than Emacs a good sign for a UI toolkit, nor does using JavaScript make it more palatable.
21:49:33
aeth
CLIM is high level. e.g. If I wrote a basic GUI system in OpenGL+SDL2, someone could write a CLIM backend for it.
21:50:23
jackdaniel
McCLIM works just fine. it is true that the only practical backend right now is clx.
21:51:05
jackdaniel
fact that it is under active development and has bugs doesn't mean it is wip, it is already usable as it is
21:51:37
ym
High level is when I write (circle 10 20 30) - some magic happens and I see a circle I asked for. I can't call new standard "more high level" just because it's brand new and more robust.
21:52:04
jackdaniel
as of: why use McCLIM over CLX: clx is just an event queue and drawing primitives, CLIM gives you object identity on the screen, display, application abstraction and much more
21:53:39
aeth
ym: CLIM is more high level in that someone could write a McCLIM backend or CLIM implementation on top of my GUI thing if I wrote a GUI thing. McCLIM-on-CLX, of course, being the only current example.
21:55:07
jackdaniel
not that they are acceptably fast, but mezzano is not a demon of speed itself (yet)
21:55:40
djeis[m]
In a sense the "context" is baked into the stream, so part of it is that you have to create a stream somehow. That's not difficult tho.
21:56:58
jackdaniel
no, I'm going to work on that *after* adding page support and alignment to clim-stream-panes
21:57:57
jackdaniel
but we have a good plan to make all that thread-safe, it is just matter of time and motivation
21:58:32
jackdaniel
ACTION hopes he did contribute to the discussion, now it is time to rest for him. \o
22:03:57
djeis[m]
As we mentioned, you don't in practice want to just be writing to some random window stream from any thread tho. It'll generally work, and eventually that'll all be safe, but with the current version of McClim sometimes that will break things. If you learn a little more clim you'll find it's fairly easy to make sure your code is running as part of the window's own rendering process, and even in current McClim that's always
22:06:50
djeis[m]
Could also spin up the clim-listener (repl) and do your drawing in a with-room-for-graphics block, which renders it right in the window of the repl.
22:07:38
djeis[m]
And afaik all code run at the actual listener can safely draw to the listener, that's part of its design.
22:25:48
ym
Ok, reading McCLIM documentation farther makes me understand why you all love it so much.
23:03:58
aeth
McCLIM had a legacy OpenGL backend a few years ago, but it was removed for being very legacy. Probably circa 2000 style OpenGL
23:04:57
aeth
Even then, it would probably be easier to work in layers, and have McCLIM target a layer on top of cl-opengl + cl-sdl2 that makes things look a bit more like what it would expect in a backend.