freenode/#lisp - IRC Chatlog
Search
11:17:29
Shinmera
His argument is that he would need to conditionalise the existence of the struct or type for each implementation if they provide their own native semaphore object type.
11:17:40
loke
Isn't his point that you shouldn't be able to do CHECK-TYPE (or whatever) on the object, becasue in specialised implementations the type of the object can be unpredictable?
11:18:26
Zhivago
It's rather then class can differ -- but CL has that leak back into the type for array, which sucks.
11:19:06
loke
That said, I'd like to see a custom type that is defined to be whatever the underlying impleemntation uses. That way I cal always use (CHECK-TYPE BT:SEMAPHORE) and it'll word regardless of implemnetation. Then a struct would be fine.
11:19:18
Shinmera
the solution is (defstruct %semaphore ..) (deftype semaphore #+sbcl 'sb-whatnot:whatever #-... '%semaphore)
11:20:04
jackdaniel
Shinmera: and where should I put this deftype, if implementation doesn't have native semaphore on %semaphore?
11:29:55
beach
lisp_guest: It is considered bad style to use WHEN in a situation where the value matters. It is better to use an IF and return NIL in the "else" branch.
11:30:30
lisp_guest
beach: so making explicit the fact that i want "nil" to be returned if sym is not a symbol?
11:36:41
Shinmera
beach: Sure. In this case one could argue that returning NIL on failure is an explicit property of WHEN so the return value of NIL is already explicit too.
12:20:41
basket
I started trying to write an Emacs mode knowing vaguely about EIEIO as a CLOS-like but discovered that it's single-dispatch and doesn't support around methods, very disappointing
12:24:30
scymtym_
basket: i think this is no longer true in recent emacs versions. the object system is much closer to CLOS now
12:46:33
pjb
lisp_guest: I use sprunge which is barebone and cool: #!/bin/sh  exec curl --silent -F 'sprunge=<-' http://sprunge.us  # cf. https://clbin.com/ 
14:49:25
beach
drmeister: He mentions simulations of molecules (as I recall) as one great application for quantum computing.
15:29:36
Devon
Anyone know how to (read-byte *standard-input*) and (write-byte * *standard-output*) portably?
15:40:50
beach
Devon: As far as I know, those are character streams, so you have to write characters to them.
15:42:00
pjb
Devon: implementation dependent, you may be able to use flexi-stream to change the kind of stream, or you may be able to create binary streams on the same file descriptors.
15:42:48
pjb
Devon: for command line tools, just pass paths to the binary files as command line arguments, and open them.
15:43:36
pjb
You can then bind them to *standard-input* and *standard-output*, but I would advise against it (just use parameter named input and output). Keep *standard-input* and *standard-output* for textual I/O, you may want to issue messages, etc.
15:49:49
pjb
Devon: there's also another consideration: this is a big no-no to touch *terminal-io* and the object bound to it. (it's the stream used to report errors and by the debugger by default). But by default *standard-input* and *standard-output* may be synonym-streams to *terminal-io*; so mutating the streams bound to those variables would mutate the stream bound to *terminal-io* and this would break the implementation!
15:50:25
pjb
So, rebinding *standard-input* and *standard-output* is allowed, but not mutating (eg. changing the element-type) of those streams.
15:52:12
Devon
Since it cannot be done portably, any implementation-specific solution could carefully mutate all the standard streams without breaking anything.
15:53:01
pjb
First try flexi-stream, as I answered above. (Despite your erroneous affirmation that no solution was proposed).
15:57:05
scymtym_
jackdaniel: in https://plaster.tymoon.eu/view/686#686 in WAIT-ON-SEMAPHORE: when going back to sleep via CONDITION-WAIT, timeout should be decreased by already elapsed time
16:00:22
jackdaniel
scymtym_: good point, thanks. current version is here: github.com/dkochmanski/bordeaux-threads/ , I will incorporate your remark later today
16:01:23
jackdaniel
I've switched to internal-real-time, generic implementation had small problems when tested on CCL with timeouts like 0.1
16:08:54
jackdaniel
alright, added fix: https://github.com/dkochmanski/bordeaux-threads/blob/master/src/default-implementations.lisp#L310
18:22:59
earl-ducaine
Devon: It depends a bit on what you're trying to do. But one approach would be to create custom streams along the lines of string output stream and string input string, i.e. create a byte stream that converts and writes characters to the output stream.
18:28:48
Devon
earl-ducaine: (ccl::make-fd-stream 0 :character-p t :element-type '(unsigned-byte 8)) doc claims "bivalent" but (read-byte *) complains (typep * '(and input-stream ccl::binary-stream)) => nil
18:34:56
beach
earl-ducaine: And in one example, you have two consecutive lines with (let (rest) on them.
18:36:14
beach
earl-ducaine: Plus, when you write (let (result) ...) the reader expects RESULT to be assigned to before being used. If you want to initialize it to the empty list, it is best to write (let ((result '())) ...)
18:38:18
earl-ducaine
Devon: I think that approach would require you to create your own stream subclass. So, the flexi stream library would be a good place to see how that's down.
19:27:31
fiddlerwoaroof
Devon: I think 90% of those problems are solved by using slime and making sure that emacs is configured to indent lisp in cl-style
19:42:07
Devon
(mapcar #'fdefinition-lambda-list (apropos-list "with-" "CL")) ; oops, no obvious way to extract the lambda-list
20:00:52
fiddlerwoaroof
Then, in my emacs config, I just do (load (expand-file-name "~/quicklisp/slime-helper.el"))
20:01:18
fiddlerwoaroof
I load these contribs: slime-fancy slime-company slime-macrostep slime-trace-dialog slime-mdot-fu
20:01:23
pjb
So basically , you followed the instructions in http://cliki.net/Getting+Started Congratulations!
20:03:04
fiddlerwoaroof
I think, sometimes people have indentation issues because lisp-mode is using the emacs-lisp indentation function
20:05:16
fiddlerwoaroof
If you do M-: lisp-indent-function<RET>, you should see common-lisp-input-function in the message arez
21:54:45
drmeister
Are there any lispers who use docker-compose and know how to get 'volumes:' to work? I am building a Common Lisp docker image and I'm banging my head against a wall for the past hour trying to get volumes to work.
21:55:47
drmeister
Off topic - I know - but my cries in more appropriate wildernesses bringing no succor.
21:59:03
earl-ducaine
parjanya: I'm planning on totally revising my approach. Each post will be an org document, I'll use tangle tags to extract all the lisp code into an ASDF project and export as HTML to generate the HTML, which I'll publish to word press as files.
22:00:04
earl-ducaine
Previously my technique was just copy-and-paste from emacs to wordpress editor, which is problematic.
22:07:42
earl-ducaine
the big trick that I've run into is the to use them you need to 'run' them first, and that specifying *where* they're located no the host, i.e. host path and where they're mounted in the container is tricky.
22:08:39
drmeister
earl-ducaine: Thanks for responding! I want to mount a directory from the host that contains a .tgz file and then untar it into the docker container.
22:11:21
drmeister
I can ADD the .tgz file to the docker container but then it adds a lot of useless space to resulting image
22:13:07
earl-ducaine
drmeister: I'm not a docker expert.... so this is probably not the 'best' way. But it should work... give me a couple minututes and i'll post the example to pastebin.
22:14:57
earl-ducaine
drmeister: while your waiting.... (the code is on another machine) the command I'm using is: docker creat -v /some/directory blah blah
22:20:03
drmeister
Oh - I'm familiar with mounting directories using: docker -v ... that works very reliably.
22:21:15
drmeister
I use docker-compose kind of like a 'makefile' for docker - I was trying to get the 'volumes:' keyword of a docker-compose.yml file to work. I _thought_ it played the role of 'docker -v ...' mounting a host directory within the docker container that docker-compose starts up.
22:22:53
drmeister
I can _not_ use docker-compose and drop down to just using docker, I suppose. It just irks me when a feature that appears to be the appropriate one (volume:) fails and especially when it fails silently.
22:25:14
drmeister
Unless I misunderstand your meaning. In any event - I look forward to your advice.
22:33:53
earl-ducaine
ok. I was being an idiot (i.e. giving you the long way round) all you need to do is something like this:
22:33:58
earl-ducaine
drmeister: docker run -d -p 8090:8080 --volume $(pwd)/holt/dir:/opt/container/dir --name lisp-container my-docker-image /bin/bash
22:34:48
earl-ducaine
/holt/dir being a directory on your host. /opt/cointainer being the directory on the container where it's mapped.
22:35:57
earl-ducaine
What I was describing previously was a way to take an existing docker image and mount it as a volume in another runing instance. very powerful but not at all what you need.
22:40:46
earl-ducaine
For a moment I got exited that I could help out someone nearly as docker inept as myself! ....until you gently pointed out that I misunderstood the question.
22:49:52
drmeister
No worries - I've subsequently learned that what I want (mount a directory during docker build) is not possible!
22:50:46
drmeister
https://stackoverflow.com/questions/26050899/how-to-mount-host-volumes-into-docker-containers-in-dockerfile-during-build