freenode/lisp - IRC Chatlog
Search
6:00:28
aeth
Just remember that '(a b c) is really just syntactic sugar for '(a . (b . (c . ()))) or '(a . (b . (c . nil)))
6:12:37
aeth
tsizz: null isn't a number, it's the empty list. It's tested with null? in Racket and null or endp in Common Lisp
6:15:52
aeth
tsizz: When you iterate through a list, you start with '(a b c) then work on '(b c) then work on '(c) then work on '() updating with the cdr each time
6:16:15
verisimilitude
The end of a list being NIL is just a sentinel value, tsizz. There are some nice qualities that come about when the empty list is also the ending of a list.
6:16:28
verisimilitude
In Common Lisp, it's also the only false value; this is very convenient for manipulating lists.
6:18:05
aeth
tsizz: similarly you don't have '(1 2 3 4 '()) you have '(1 2 3 4) but iterating through it gives you '(1 2 3 4) then '(2 3 4) and eventually '() when no elements are left
6:19:47
aeth
tsizz: you're essentially moving through sublists because every list has a list as its cdr (which wouldn't be the case if lists didn't end in nil, btw)
6:23:06
aeth
tsizz: when you're iterating through a list, you normally care about the car and the cdr
6:23:29
aeth
tsizz: you're not iterating through values (unless you use something like map) you're iterating through sublists, so you have to take the car
6:25:21
aeth
I think that that will work but it's not tail recursive because the tail call is + not the function itself.
6:25:47
aeth
If you wanted it to be tail recursive you would have to build the value in another argument to make sure that the function's tail call is the function itself.
6:26:20
aeth
If you do recursion and can do tail recursion, yes, you should try to do tail recursion. In Common Lisp, it's rarer than Scheme because the optimization is not guaranteed.
6:31:49
Jachy
tsizz: You might want to go through the first chapter of this book https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book-Z-H-4.html#%_toc_start It's for scheme, but most of the lessons will carry back to common lisp.
6:31:55
aeth
tsizz: you have to pass it through and build it up through each iteration just like you're doing with the sublist. Except your answer is growing as the sublist is shrinking
6:32:33
aeth
tsizz: so (f (cdr list) (+ (car list) result)) and then at the end return result instead of 0
6:35:35
aeth
If you don't want the recursion, the do macro is equivalent to (a subset) of this sort of iteration in Scheme and near-equivalent (the edge case involves making closures) in Common Lisp.
8:00:14
splittist
I love the way search engines correct my searches for 'plump lisp'. Now I want to start a project called Botox.
8:05:05
aeth
They're better at being Ask Jeeves than Ask Jeeves ever was, but I don't want to ask natural language questions. I want to query specific terms that might be very niche.
8:11:48
aeth
If CL wasn't so niche it'd probably be very searchable because of its anti-symbolic naming conventions (except for arithmetic).
8:37:11
flip214
aeth: well, if you _know_ you're looking at standard CL stuff just bookmark http://www.lispworks.com/documentation/HyperSpec/Front/X_Mast_9.htm and be done ...
12:13:57
schweers
talx: in case you mean https://en.wikipedia.org/wiki/Cadence_SKILL, it is /a/ lisp dialect. This channel is dedicated to Common Lisp.
12:16:41
schweers
talx: no need to be sad. Common Lisp is around today and is a very good language with good, free implementations available.
12:17:26
runejuhl
I've only worked with it for a bit of debugging, and I'm happy for that.. just the idea of a `]` operator that closes all open braces gives me pain
12:20:23
schweers
In case someone wants to accuse me of arrogance: I’m sure I’ve uttered my fair share of bad ideas.
12:21:57
runejuhl
schweers: "In the second example, the "super right bracket." This simple device automatically enters enough right parentheses to correctly complete the current expression (in this case the procedure definition)."
12:22:19
runejuhl
schweers: from SKILL: A CAD System Extension Language, 1990, https://www.cs.york.ac.uk/rts/docs/DAC-1964-2005/PAPERS/1990/DAC90_266.PDF
12:24:35
runejuhl
here's a real example: https://github.com/cdsgit/cdsgit/blob/master/cdsgit-build/cdsgit.il
12:56:21
jsjolen
phoe: Not as far as I know. But I also don't know how to check. I installed slime through ql's slime helper
12:57:04
heisig
jsjolen: Have you already evaluated the macro definition, and are you in a package where this definition is visible?
12:58:13
phoe
jsjolen: (slime-company slime-asdf slime-fancy slime-indentation slime-sbcl-exts slime-scratch)
13:00:45
jsjolen
Well, still got the issue. IT works with other macros though, it's just adt:match tha tfails.
13:03:52
heisig
jsjolen: Odd. My last, desperate guess: Is there a compiler macro of the same name present?
13:50:09
jackdaniel
if anyone have some spare time in their hands I'd appreciate critical remarks on this mailbox implementation: https://gist.github.com/dkochmanski/4de37d4e7432d8d59afa7d2a64a4bb41
14:06:11
gilberth
As a matter of taste: I do not like the business on lines 81 and 82. Why not (min (mailbox-%count mailbox) (or n (mailbox-%count mailbox)))?
14:06:57
gilberth
And then the ZEROP test could be skipped. When 'n' is zero the LOOP would return NIL as well.
14:07:28
phoe
I'd also abstain from modifying the function argument and introduce a new binding instead - again, matter of taste and a little bit of debuggability
14:17:51
hjudt_
what is the best way to concatenate pathnames, or better a pathname and a string? e.g. i want to concat "~/my/path/" "to/this/file"?
15:03:44
verisimilitude
You can also use MAKE-PATHNAME with the :DEFAULTS argument being set as necessary.
15:45:21
catchme
They require that I know the function symol, but I want to pass the pointer and args type without the symbol name
15:47:01
_death
https://common-lisp.net/project/cffi/manual/cffi-manual.html#foreign_002dfuncall_002dpointer
15:48:55
catchme
As I understood from the example `(foreign-funcall-pointer (foreign-symbol-pointer "abs") () :int -42 :int)` the pointer doesn't mean the function pointer!
17:21:50
verisimilitude
Perhaps they wanted to fix this bug, but couldn't, because some programs have grown to depend on this useful behavior?
17:30:30
grewal
At my last job, csh (or rather tcsh) was still the "official" shell according to all the documentation. Of course, all actual shell scripts started with #!/usr/bin/bash
17:55:29
lionrouge
what is the fastest LISP dialect now? I mean suitable to write a scientific calculation program
17:56:13
lionrouge
maybe there are libraries to do the task like NumPy/SciPy/etc. in Python which itself is pretty slow
17:56:15
phoe
but, if you want Common Lisp, SBCL is pretty damn fast when it comes to optimizing numeric computation
17:57:42
verisimilitude
Unlike Python, it's common to write Common Lisp libraries in Common Lisp, or at least that's the ideal.
17:58:15
lionrouge
When I heard it's name for the first time I thought there was some Steel Bank and it created a LISP dialect for it's own internal purposes and only recently I discovered true history of the name :)
17:59:13
phoe
at that university, Carnegie was a professor of steelworking and Mellon was a professor of banking