freenode/lisp - IRC Chatlog
Search
14:45:35
lisp_guest
how exactly is LAMBDA as a symbol vs. LAMBDA as a macro differentiated by the evaluator?
14:46:11
lisp_guest
are the possible cases where a lambda expression is acceptable just enumerated on a case-by-case basis?
14:46:42
lisp_guest
yes, indeed. so how does the evaluator know when it's a macro and when it's a symbol?
14:47:21
beach
lisp_guest: It depends on the occurrence. If it is in a position where the form is evaluated normally, it is a macro call.
14:47:43
lisp_guest
Bike: right, that's what i'm wondering about. so it's basically hardwired into FUNCTION itself?
14:47:46
beach
lisp_guest: Otherwise, it is just a lambda expression starting with the symbol LAMBDA.
14:48:43
Bike
there are a few functions that deal with lambda expressions, like COMPILE and COERCE, but they take expressions as quoted data
14:49:53
lisp_guest
mhm. so basically, there are few special places when a lambda form has special meaning (like FUNCTION and calling a function), and in all other cases it's treated as a macro
14:50:42
Bike
function and lambda forms (which is what you call what beach said) are not normal evaluation contexts
14:51:59
TMA
lisp_guest: it is the same as with other symbols designating a macro -- when in normal evaluation context, the list (A ...) is a macro call for any symbol A designating a macro (including the symbol LAMBDA)
14:53:36
TMA
lisp_guest: there are special contexts (such as inside (QUOTE ...) or (FUNCTION ...) or other special forms where the context dictates following other rules as specified by that special form.
14:54:46
lisp_guest
mhm. so there's really nothing *that* special and black magic about it. the interpretation of the expression depends on the context and that's it
14:55:14
TMA
lisp_guest: additonally the (LAMBDA (...) ...) expression can be used in the operator place in a compound form. this is the only special case for (LAMBDA (...) ...)
14:57:04
TMA
lisp_guest: so that you can use ((lambda (a) (+ a a)) 1) instead of (funcall (lambda (a) (+ a a)) 1)
14:59:28
lisp_guest
what was weird when i first learned about this is that it seemed like black magic because i couldn't tell when it had its special meaning
14:59:42
lisp_guest
fiding out and confirming that it's "hard coded" into the standard makes it very easy to understand
15:01:34
Bike
it's described on the page for function, and lambda forms are explained in the pages on evaluation semantics.
15:05:49
Bike
a lambda expression. a list beginning with LAMBDA. like (lambda (x) x). like we've been talking about.
15:08:55
lisp_guest
Bike: exactly, but when i read "expression" i didn't think of such a list. i guess it's because i got used to what the term meant in other languages
16:26:24
nyef`
Today I learned: The AMOP specification for MAKE-METHOD-LAMBDA includes an example which uses FLET to bind CALL-NEXT-METHOD, an action forbidden by CLHS.
16:28:35
beach
I am not sure that's the right interpretation of what the Common Lisp HyperSpec says.
16:35:16
nyef`
CLHS FLET says that it establishes a function binding. CLHS 11.1.2.1.2 forbids this for external symbols of package COMMON-LISP. CLHS 11.1.2.1.2.1 provides exceptions for symbols which don't name standardized functions, macros, or special operators. CLHS CALL-NEXT-METHOD says that the exceptions of CLHS 11.1.2.1.2.1 don't apply.
16:58:52
Bike
make-method-lambda also respecifies call-method and make-method without giving detail on new syntax. it's kind of extracurricular.
18:18:41
akkad
is there any trivial-repl sorts of packages to provide the consistent niceties some repls offer. e.g. :pwd :cd :ls
18:32:21
pjb
and there's also a com.informatimago.common-lisp.interactive.interactive:rep if you need to implement the loop yourself.
19:11:49
fourier
is where a more/less portable way to get posix file descriptor from open file stream or at least file name? I could get it (filename) relatively easy on LispWorks and apparently on ccl, but dont have sbcl to test...
20:26:52
rme
It's probably too late for this year, but I wonder if it would be good to look into having a Lisp room at FOSDEM (which I just learned about). https://fosdem.org/2018/
20:31:51
rme
I keep talking about moving to France. If I ever do that, FOSDEM will even be close by.
21:09:19
alandipert
i can't figure out how to use fixnum-only * in this function, anyone have advice on how to type hint? https://gist.github.com/alandipert/f2602716487f29701b94e0db3a628e14 (everything is always fixnum)
21:24:21
fourier
alandipert: try (optimize (speed 3) (safety 0))and (float 0) (not sure about last one, maybe its lispworks only)
21:41:42
jasom
ever have one of those moments where sbcl tells you some code is unreachable, and you just can't figure out why?
21:59:50
jasom
well changing the type of depth to (mod 16) doesn't change things. Plus it shouldn't be *unreachable* because clearly if depth is 0 (which it's allowed to be) everything works fine
22:01:29
aeth
rme: One idea would be to do something that can be visualized through computer graphics. There are 6 or so libraries in CL that can handle visualizations, e.g. https://github.com/vydd/sketch
22:03:36
jmercouris
I feel bad because I use a global var to store completion candidates temporarily, but the whole minibuffer/command system needs an overhaul/rethink anyway
22:03:49
jasom
Bike: derived type is just "function"; it returns the result of a map-into which ought always be a vector, but it might not have been able to infer that
22:04:24
Bike
have you tried macroexpanding the loop? it's ugly, but that tends to help me understand how the compiler is thinking
22:05:39
jasom
yeah. Also, removing the type declaration for result doesn't change the dead-code note
22:09:57
jasom
https://gist.github.com/jasom/c95e083e4ba7c42e8321ede0e3d12583 is now updated with the maxroexpansion
22:15:59
Bike
yeah, i hardly see any way the make-array could be dead other than prefix-buckets being weird somehow.
22:24:25
pierpa
doens't the LAMBDA in (map-into new-level (lambda () (ironclad:make-digest +hash+))) needs an (ignored) argument?
22:42:45
AeroNotix
I wrote a browser with CL/webkit a while back, then real life + job got in the way. I still longingly look at the repo on github sometimes and think what could've been
22:43:43
jmercouris
AeroNotix: I WAS using QT, but now I am working on a GTK port for Linux, better bindings and speed
22:44:49
AeroNotix
interesting. In my research (that I did a while ago) I found that Qt, at least at first, looked better
22:45:06
jmercouris
I've already completely implemented it in QT, so I'm very familiar with that path :D
22:46:09
jmercouris
AeroNotix: On OSX the rendering was absymal, not necessarily due to the web-engine, but due to QT limitations, their port of any web engine requires them to do rendering, and that was always too slow
22:47:35
jmercouris
for example, there are literally 0 side effects when loading the code until you hit base.lisp
22:49:02
AeroNotix
I used that parenscript highlighter for a while. Eventually it started crashing a lot on me.
22:49:52
AeroNotix
jmercouris: I would be interested but my day job is ridiculous (and has been for for 3 years plus)
22:50:15
jmercouris
If you simply complete the GTK port, nEXT is literally ready to use as your daily driver
22:51:00
jmercouris
This is it, all you have to implement: https://github.com/nEXT-Browser/nEXT/blob/master/next/source/package.lisp
22:52:04
AeroNotix
If you're full steam ahead though with next I really wish you luck in seeing that idea come to fruition.
22:52:07
jmercouris
Hmm, I would rather work together on one project and get farther than divide our efforts
22:52:58
AeroNotix
so having a proper, fully, extensible browser done in The Lisp Way will have been realised.
22:54:59
jmercouris
If you're interested in the project goals thery can be seen here: https://github.com/nEXT-Browser/nEXT/tree/master/next#release-timeline
22:55:44
jmercouris
I also hope to be able to one day monetize nEXT, make some contributions back to the Lisp community, develop some tools stuff like that
22:56:10
AeroNotix
jmercouris: actually one of the reasons I initially started developing lispkit was because I couldn't ever find a browser that I could regexp search within a page
22:56:48
jmercouris
AeroNotix: Hmm, I don't have that working yet, I only JUST added a really basic search
22:57:06
AeroNotix
I think actually I was using the webkit APIs for it. I think they genuinely let you use regexp searches on a webkit browser instancce
22:57:11
jmercouris
I'm only now really getting to grips with parenscript, but I can already do some cool things
22:57:40
jmercouris
I literally only need to be able to 1. make a webkit view, 2. set the url, 3. execute JS
22:58:29
jmercouris
bought heavily into QT webkit, and the port to QT Webengine took almost like a year or something insane
22:58:40
jmercouris
I was able to complete my port in like 3 weeks, and 2 of those weeks were spent learning cocoa
22:59:40
AeroNotix
The lisp community was generally quite excited about lispkit/similar things. As much as the lisp community can be. I mean you have 900 stars on github
23:00:01
AeroNotix
got to remember there really isn't a huge active community behind lisp these days
23:00:02
jmercouris
AeroNotix: I have a feeling those are mostly like emacs users/ random programmers
23:01:26
jmercouris
I'll probably pilfer a bunch of code from Lispkit for the GTK port, so in a way, it will live on :D
23:03:18
jmercouris
I have your License located here https://github.com/nEXT-Browser/nEXT/tree/master/documents/external
23:03:19
AeroNotix
Cool. I'll star next and see where it goes. When it gets to the point of `make && make install` I'll probably switch to it. As I said, day job is just too demanding at the minute for anything deep and dark with non-work related programming if you get me
23:08:02
jmercouris
Your last name also didn't seem Polish, but I figured maybe you had ancestors from another country or something
23:08:35
AeroNotix
I am not sure about my surname. My mum did some ancestry stuff a few years ago and couldn't figure it out
23:10:41
rme
I need a better profile picture. I was trying to be artistic, but now I think it looks dumb.
23:12:18
jmercouris
rme: You know, that's an interesting name, we have a U Bahn Station here in Berlin named "Bellevue" it's pronounced "Bell Voo"
23:12:57
AeroNotix
Where I grew up in the UK we have a pub at the bottom of my mum's road called The Bellevue
23:16:38
runejuhl
For numbers 21-99 we say the last digit first, so 21 would be twenty-one in English and en-og-tyve (lit. one and twenty) in Danish
23:18:07
runejuhl
jmercouris: the worst thing is that kids in Danish schools have a harder time learning numbers (and math) because of the language
23:18:41
jmercouris
In literally every other language I know, numbers are consistent, except for the germanic derivatives
23:18:46
runejuhl
I've heard about teachers using the "correct" way of pronuncing numbers even though it's not valid Danish
23:19:54
runejuhl
There are a bunch more oddities about numbers in Danish. The system used to be based on multiples of 20, so 60 is "tres" (3 x 20) and 50 is "halvtreds" (2 x 20 + one half 20)
23:23:05
runejuhl
I better get to bed and catch a few zzzzs before my fever-ridden offspring decides to wake up and terrorize me...
0:46:28
AeroNotix
jasom: you should really pare that down to a very small example, I can't run that code you've given me without libraries/etc
1:21:14
earl-ducaine
Lisponians! Re: style (and maybe functionality), is there ever a reason not to use iterate over loop if you're so disposed?
1:21:15
earl-ducaine
e.g., iterate no longer mainted, not as reliable, not as fast, some think it looks barbaric, ambigously defined, keeps you from learning loop, as God intended, etc.
1:23:10
nyef`
If you're willing to pay that price, plus the price of inconveniencing anyone who doesn't use/know/like iterate that might want to hack on your code, feel free.
1:24:18
earl-ducaine
nyef`: Which is not trivial issue, as I'm learning trying to get Garnet to work on a second, non-sbcl CL, so I can get it accepted into quicklisp. Total dependancy hell.
2:02:23
aeth
earl-ducaine: If you want idiomatic Lisp instead of that loop language, what tends to work is to just write macros on top of do, do-foo, etc. Even occasionally mapfoo, e.g. I wrote a do-hash-table on top of maphash.
2:03:10
aeth
What I find is that loop is usually only necessary (as in, a fast alternative will be a mess to write) for collect. There are also possibly a handful of other, very rare forms in loop that I've never encountered.
2:03:59
aeth
do isn't really that bad, it's basically let with two additions: an optional step clause (which is functional, so use 1+ instead of incf, etc.) and a terminating condition with an optional return clause after that.
2:04:23
aeth
Unfortunately, nearly everyone uses loop, so if you directly use do, people will complain, even though do is perfectly readable if you're used to it.
2:05:22
aeth
I suspect iterate will be even worse than do in terms of complaints because at least do's built into the language and is in related languages like Scheme, too.
2:07:12
basket
In Scheme it's implemented over lambda application, but the CL version is just a C-style for loop
2:07:42
aeth
Even though under the hood it is using tagbody with go and setting the step each iteration, it behaves nearly exactly equivalent to Scheme's do form (afaik, the only difference is the implicit tagbody for local gotos, which only exists in CL), which is implemented tail-recursively.
2:08:37
basket
aeth: It isn't any more 'functional' than a C-style for loop; it's functional to the extent that the C equivalent is
2:08:38
aeth
basket: but, anyway, I treat any do without a body (which can easily be half of them, except maybe some type declarations or temporary print statements) as purely functional.
2:09:03
nyef`
On the one hand, clearly I don't use it enough. On the other, clearly its syntax and semantics aren't memorable enough.
2:10:27
basket
It is 100% like C except it implicitly assigns a single variable for you whereas in C you have to do it explicitly
2:11:12
aeth
Imo, this is a pure functional (and inefficient) way to generate the number 43: (do ((i 0 (1+ i))) ((> i 42) i))
2:11:32
aeth
There is no explicit setting there, and even though do is implemented imperatively, it could easily be implemented other ways as well. The actual under-the-hood details of the macro don't matter.
2:12:45
basket
It is working with mutable variables in ways that are a part of its visible semantics