freenode/#lisp - IRC Chatlog
Search
5:22:07
fe[nl]ix
Eitaro Fukamachi is now accepting sponsorship: https://github.com/sponsors/fukamachi
6:57:17
pyc
is there a way to check if string "foo" is in string x? equivalent to `"foo" in x` construct of Python?
6:59:56
Nilby
Don't forget to check the sequences section when looking for functions useful for strings.
7:09:29
louis771
I'm just getting starting with CL and want to do some web backend stuff with it... there is no way around his libraries.
7:10:30
pyc
i see that in some code examples, people write list and in some places people write '(). how do you decide which one to use where? For example, yesterday, Xach provided this example: (make-pathname :directory (list :relative "baz")). But I could write it as (make-pathname :directory '(:relative "baz")) too. so what should be my guiding principle to decide if I should use the list function or quoted
7:10:46
louis771
And I totally agree that quickdocs.org must be revived if CL wants to attract newbies
7:12:45
louis771
pyc AFAIK use ' for lists you won't change, use list for lists you will add/remove stuff from
7:13:18
louis771
if you use ' then the compiler is permitted to allocate l1 and l2 in a way that they share their common tail in the read-only memory
7:15:07
beach
pyc: Though you can always (and should always) use '() for the empty list if it is a form, so intended to be evaluated.
7:15:31
pyc
how do you use SLIME REPL and code buffer together? if you want to test out the usage of some CLHS functions before using them in your app code, do you go to the REPL and type trial code there, or do you type it in the source code file buffer itself and evaluate there?
7:17:47
susam
I use the file buffer itself. I almost never enter anything into the REPL directly. That way I am always editing a file. The main reason why I adopted this style of working is so that I don't have to type M-p to bring up old inputs in the REPL buffer.
7:20:43
beach
moon-child: Let me find the relevant section in the Common Lisp HyperSpec. It is very hard to find usually.
7:21:04
susam
beach: I use the same file code buffer that I am currently working on. Say there is a (defun foo () ...) and there is a (defun bar () ...) in my buffer and I am working on foo. I just use the space between foo and bar as my scratch pad. I let that area become a mess. When I complete foo, I delete all the lines in the scratch pad area.
7:22:49
pyc
interesting. let me see if I can adopt editing a file only workflow. I go to REPL often by habit. it will be nice if I don't have to switch context between REPL and file buffer so often
7:25:13
susam
Truth be told, I don't know if my style of working is more efficient than others'. I just shared what I do and it works for me. But always eager to learn better ways. I care a lot of coding ergonomics. I often wonder it would have been nice to have some sort of live coding community for CL so that I can see how others navigate their workspace, write code, manipulate code, etc. so that I can learn something from them.
7:26:41
beach
moon-child: So () is used only for things like empty parameter lists or empty lists of superclasses.
7:49:23
ldbeth
susam: maybe we can find a place to do streaming or helding regular meetings remotely.
8:01:09
Nilby
suam, ldbeth: I think it's quite useful to see how other Lispers work. e.g. check out Baggers or Shinmera's livestreams. It'd be cool to see people share their coding setup.
8:08:59
pyc
(first '(1 2 3)) returns the integer 1. But (last '(1 2 3)) returns a list containing an integer: (3). Why this inconsistency?
8:10:14
edgar-rft
first returns a pointer to the first cons cell, last returns a pointer to the last cons cell, no inconsistency
8:10:50
beach
ldbeth: You use (cons a nil) if you want to create a CONS cell where the CAR is the value of A and the CDR is the Boolean value false. You use (cons a '() if you want to create a singleton list with the element in it that is the value of A.
8:13:24
beach
ldbeth: And the fact that you see things in code (old or new) is no guarantee, because it depends on who wrote the code. As you have probably noticed, many people here don't give a damn about conventions.
8:14:40
ldbeth
beach: quite right, many people wrote these code probably learned lisp before ANSI CL
8:15:37
pyc
Nilby: I am not sure I understand the consistency. I know that '(1 2 3) is (1 . (2 . (3 . nil))). Here the first cons cell contains 1 and a pointer to (2 . (3 . nil)). The last cons cell contains 3 and a pointer to nil.
8:16:00
pyc
Yet first returns only 1, no pointer to anything. But last returns 3 and a pointer to nil: (3 . nil) which is equivalent to (3).
8:17:41
beach
pyc: It is just that LAST is more useful the way it is defined, because you can then use (SETF CDR) to add elements to the end.
8:18:54
beach
ldbeth: While you are at it, check your code for confusion between false and the default value NIL.
8:20:50
Nilby
pyc: I guess you're right. Maybe that's why I like Lisp. It seems to value programming practicality over total abstract consistency.
8:25:49
beach
I may have written something in http://metamodular.com/SICL/representing-method-combinations.pdf
8:32:22
ldbeth
beach: do you use any specific schema for implementing multiple return values in SICL? I don't find it in the current specification.
8:34:56
beach
What do you mean by "schema". The idea on the x86 is to use the unused space immediately beyond the stack pointer, plus a few registers. That turns out to be enough for the minimum limit.
8:39:19
beach
If a function that returns multiple values is inlined, then, depending on what is known about that function at compile time, some optimization can take place. Is that what you are asking?
8:43:29
ldbeth
Ah, I think mv return is a feature been overlooked, especially in functional programming languages that having nice optimization to reduce consing for currying, but still return an vector/tuple for multiple results.
9:39:48
beach
pyc: You use CAR when you are manipulating CONS cells and FIRST when you are manipulating lists.
9:40:28
beach
Like for instance in an alist, the elements are not lists, they are CONS cells with key and value.
9:41:37
susam
pyc: Check this: http://www.lispworks.com/documentation/HyperSpec/Body/f_rest.htm - "rest is often preferred stylistically over cdr when the argument is to being subjectively viewed as a list rather than as a cons."
10:01:58
pve
It's good that the NIL-rule was brought up. I wasn't aware that it (or that hyperspec page) existed. I knew people sometimes used '(), but always assumed it was for reasons related to personal taste.
11:11:05
warweasle
For some reason (or ... Will return all the values of the first argument, but only the first value of the rest. Is that expected behavior?
11:16:33
scymtym
it is the other way around: only the first value of all forms but the final one and all values of the final one. it is specified like that in http://www.lispworks.com/documentation/HyperSpec/Body/m_or.htm
13:05:35
flip214
ebrasca: well, perhaps it would be easiest to just pass an RTP socket on to ffmpeg or so...
14:02:56
jackdaniel
hunchentoot serves files, it is a web server. you may either serve a static file (i.e webm like here http://turtleware.eu/static/paste/9736edb5-eduardo.webm), embed the link ink html, or write some fancy javascript program that performs actual streaming
14:03:40
jackdaniel
in other words hunchentoot does not concern itself with anything beyond http(s) protocol, hunchensocket adds websockets to the mix - you could use that if you had wanted to implement streaming
14:24:18
warweasle
I made one of the classic blunders: I forgot to define my problem before I started coding.
14:26:05
Josh_2
warweasle: It's okay to not define your problem because I bet you run into lots of them when you start xD
14:58:20
Josh_2
when using the sha256 digest in ironclad it returns a byte array, then this byte array is converted to a string using ironclad:byte-array-to-hex-string
14:58:57
Josh_2
I tried using babel:octets-to-string but it signals an condition about illegal characters
15:00:34
Josh_2
right, however I'm trying to compare the output of the ironclad implementation to the implementation I am calling with FFI
15:07:07
pyc
I know we discussed 'first' vs. 'car' usage today. One is used when we are thinking of lists and the other when we are thinking of cons cells even though they are equivalent. But I am confuesd about this. To select the last item in a list, should I use (first (last '(1 2 3))) or (car (last '(1 2 3)))?
15:08:13
pyc
even though I think I am working with lists here, I get the feeling that 'car' is more appropriate than 'first' because 'last' works on a list and returns a cons cell, so now that we are thinking "cons cell", 'car' becomes more appropriate than 'first'.
15:08:30
Josh_2
Bike: yes It's the library called 'base64' https://github.com/massung/base64 I'm using s-base64 now
15:10:18
Bike
you can encode text into other text? i thought the point of base64 was for transmitting arbitrary data over text over channels