freenode/#lisp - IRC Chatlog
Search
6:09:14
beach
remby: Contrary to what mrios22 said, you can't implement first-class continuation in portable Common Lisp.
6:11:29
beach
But first-class continuations are problematic for Common Lisp in general. Stuff like files that close and exit points that might expire.
6:14:06
stargazesparkle
But I need an if in between bindings because I can't continue if I don't get an expected value
6:14:07
beach
stargazesparkle: There is no simple rule about nesting LETs, using LET*, and using SETQ/SETF. Each one has its use in particular situations.
6:16:05
beach
remby: Contrary to what mrios22 said, SBCL does not fulfill your requirement for small executables.
6:16:43
beach
remby: You may want to look into ECL instead for that. Then, I don't understand the obsession with small executables now that people stuff entire operating systems inside a "container".
6:19:03
fiddlerwoaroof
stargazesparkle: If the "else" side of your IF is just going to be NIL, you might consider using WHEN instead
6:23:32
fiddlerwoaroof
stargazesparkle: I'm not sure if I have enough information to answer the question, what are you trying to do in the gist :)
6:25:20
stargazesparkle
I am sending an http request that may or may not result in a token. If I get a token I need to send that token back in another http request. If when I do that it may or may not give me another token. If I do not get the first token then I need to return an error message because I cannot proceed further.
6:28:09
beach
remby: Don't get too excited. It is easy to think that a company is a homogeneous thing. In reality, companies consist of people, so the people who used to work for ITS probably got "bought up" with the company. That doesn't mean that Google as a whole has a policy of using SBCL.
6:28:54
fiddlerwoaroof
They ended up with like 10x as much code and only marginal speed improvements, IIRC
6:29:06
beach
fiddlerwoaroof: Why am I not surprised? It has happened before. Viaweb as I recall, but maybe it wasn't C++.
6:30:10
saturn2
google published some open source CL libraries and a style guide, so i guess they're using it internally at least a little bit
6:31:23
beach
saturn2: Again, companies consist of people. This style guide was not written by Google management.
6:32:27
saturn2
beach: but companies generally have rules too, most employees can't just start using any language they feel like
6:33:18
beach
saturn2: What most managers don't understand is the fundamental CS result of code/data equivalence.
6:33:47
fiddlerwoaroof
But, you can use it to make things work better for you and then sneakernet the resulting tools to your coworkers :)
6:33:58
beach
saturn2: So you can present your new language as an input format for a program written in a different language. They won't understand what happened to them.
6:34:00
White_Flame
fiddlerwoaroof: but you might use "just any language" for the test/dev deployment of the next version of the mission critical stuff
6:34:26
beach
saturn2: That's how I introduced Lisp in a Pascal-only shop, a long time ago mind you.
6:36:32
moon-child
fiddlerwoaroof: yeah, iirc they wrote a tool to automatically translate it to c++
6:36:42
beach
saturn2: Programmers are way too eager to follow rules established by people who have no clue of software development or computer science.
6:38:14
beach
saturn2: This is even more important because the people who establish those rules don't understand what is best for the company they manage.
6:39:14
fiddlerwoaroof
I first started using CL because it didn't have a GIL and it was relatively easy to get a noticeable performance boost from threads
6:40:20
fiddlerwoaroof
Haskell has a decent multithread story, but you have to buy into the whole Haskell thing
6:40:37
fiddlerwoaroof
The only system that's better on the concurrency front is the JVM/Clojure, IMO
6:43:47
beach
remby: Let me repeat this again: People go to a lot of trouble to avoid learning Common Lisp.
6:45:01
beach
remby: Oh it does, as in C syntax makes macros impossible, so boilerplate code becomes the norm.
6:45:33
fiddlerwoaroof
remby: I find CL encourages me to write programs as compositions of simple functions
6:45:33
moon-child
syntax does matter, but lisp syntax is excellent imo. (Not as good as apl, but still very good.)
6:46:10
beach
remby: I think you have no idea what Common Lisp macros can do. They rely on homoiconicity.
6:46:42
moon-child
rust has macros, but they're hygienic, which limits their power. And rust isn't homoiconic which makes them much less interesting
6:47:31
beach
remby: Macros are the reason we don't have to wait for CL21, CL24, CL27 etc, to get new features that we want.
6:48:26
remby
another example, having a let expression with mutple variable is hard to read if it's all on the same line
6:49:36
White_Flame
I've never seen (let ((a 1) (b 2)...) ...) on one line in real code. Only IRC one-liners
6:50:29
fiddlerwoaroof
Nothing is as hard to read as this: https://github.com/lkowalick/j-interpreter/blob/master/source.c
6:51:21
moon-child
fiddlerwoaroof: eh, it takes practice. Like anything, you have to learn it before you can understand it easily
6:52:22
moon-child
remby: I mean, you can declare variables all on the same line in pretty much any language. I struggle to think of one where you can't
6:52:34
beach
remby: So there is one great disadvantage with Common Lisp. It can't fix code produced by bad programmers.
6:53:23
moon-child
fiddlerwoaroof: I think that can mostly be attributed to arthur whitney. APL-related c codebases not influenced by him tend to look much more normal
6:55:52
aeth
the main thing CL forces you to do is put spaces between (most) tokens, which even Python doesn't force you to do.
7:00:52
saturn2
it's a nice touch that there's a comment explaining the simple wrapper around malloc
7:01:31
moon-child
I think that's somebody else who was annotating the original code and got stuck halfway through
7:01:58
moon-child
the original code is https://code.jsoftware.com/wiki/Essays/Incunabulum and has no comments
7:03:42
aeth
remby: that looks like the output of a debugger for someone who wrote an s-expression->C DSL and decided to make it minified instead of human readable
7:13:17
fiddlerwoaroof
aeth: someone on HN explained why the code looks like that. Basically, the more global a name is, the easier it is to remember because it's used more, so why waste characters on a descriptive name?
7:14:18
solideogloria[m]
and I use a script that automatically adds or removes parens depending on the selection
7:14:23
remby
kinda amusing we drag these environments around, but then again, the ones that support them are not always sufficient
7:15:24
solideogloria[m]
I have a script that simulates what emacs does when you add a closing paren
7:19:03
beach
remby: To most experienced Common Lisp programmers, parentheses are transparent. They just don't exist. Indentation is what gives the clue to the program structure.
7:21:16
solideogloria[m]
remby take a look at sbcli if you want something more featureful than rlwrap for sbcl
7:21:32
beach
remby: You would typically have a split Emacs frame with the REPL in one window and one or more buffers next to it.
7:28:17
stargazesparkle
I'm using spacemacs atm so I don't have to deal with stupid things like multi-key chords to move a line up or down
7:29:18
beach
stargazesparkle: It is much more efficient for Common Lisp code to move by program units than by lines/characters. Plus, if you DO want to move up a line, C-p and C-n work fine. Even the arrow keys.
7:30:58
beach
stargazesparkle: But please don't use words like "stupid" for the habits you don't understand.
7:32:41
stargazesparkle
C and M are so far out of the way which makes them really inconvenient because I have to remove one hand from a typing position to strike them
7:34:15
fiddlerwoaroof
If you're at the beginning of the second argument of a three-line if expression, C-M-u takes you to the opening parens of the if expression
7:35:11
stargazesparkle
You can criticize the usability of something without having to go and adopt it first
7:35:47
fiddlerwoaroof
Well, if you haven't learned to use something, you often don't understand the ergonomics
7:36:30
mrios22
I'm getting an error in the quicklisp fiveAM library. Can someone else replicate it to see if it's just me? I'm following the tutorial at http://turtleware.eu/posts/Tutorial-Working-with-FiveAM.html and I'm having trouble doing def-suite. Every time I try to run it, it raises an error saying that the name of the suite is undefined.
7:37:57
fiddlerwoaroof
solideogloria[m]: only if the expression is a list. C-M-k kills "a lisp expression"
7:46:44
minion
? I hope I didn't cause offense ): An error was encountered in lookup: Parse error:URI "https://www.cliki.net/?%20I%20hope%20I%20didn't%20cause%20offense%20)?source" contains illegal character #\? at position 69..
7:48:52
mrios22
fiddlerwoaroof: I can replicate the bug by doing (progn (ql:quickload :fiveam) (def-suite test-suite))
7:53:36
mrios22
saturn2: I discovered the problem in my file. I forgot the (in-package ...) command. Thanks.
8:42:56
solideogloria[m]
this might be a dumb question, but how do I check if the variable given to case is equal to multiple keys than just one for each form?
8:53:02
beach
solideogloria[m]: Look in the glossary for "list designator". Then you will see that NIL designates an empty list, and any other atom designates a singleton list containing that atom.
10:15:52
phoe
that's a special case of CAR and CDR though, rather than an effect of NIL hypothetically being a cons
10:16:32
frodef
phoe: yes, but it's sometimes useful to think of as a cons-cell that points to itself.
10:18:16
frodef
well, shouldn't be too confusing to anyone comfortable with pointers and linked lists, really.
10:18:18
phoe
so looking from the strict point of view, NIL isn't a cons - even if it kinda sorta behaves like one when put to CAR and CDR
10:18:40
phoe
Schemers will also heavily disagree because their CARs and CDRs signal errors with empty lists instead
10:19:42
phoe
I think that when someone goes for details and background info then it's important to know that CAR/CDR of NIL is NIL instead of an error purely for practical reasons
10:21:26
phoe
NIL being both a symbol and a list is actually a bit troublesome when it comes to optimizing list accesses
10:21:38
beach
stargazesparkle: Good. What you need to keep in mind is that a Common Lisp list is not an abstract data type. You constantly need to think about how it is represented.
10:22:10
phoe
the two common ways of representing NIL internally are representing it as a symbol and special-casing CAR/CDR, or representing it as a weird cons similar to (NIL . NIL) and special-casing tons of symbol operators
10:23:01
phoe
the former means that CAR/CDR are a bit slower now and they're heavily used in Lisp code; the latter means that things in the symbol world are gonna get messy because symbols also tend to be used a lot in some programs
10:26:37
phoe
it is a quote, and quoting is one of the most important mechanisms of Lisp dialects in general
10:26:49
stargazesparkle
I have read absolutely no books lol and am just brute forcing this shit so far
10:27:57
stargazesparkle
Idk what #'1+ really means either but I do know that I can do that to sort of pass 1+ to another function
10:28:08
minion
stargazesparkle: look at pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
10:28:40
beach
Now I keep forgetting where in the Common Lisp HyperSpec those different uses of NIL are discussed.
10:28:43
phoe
it'll tell you all you want to know about ' and #' and how they differ and how they're used.
10:28:51
specbot
Sharpsign Single-Quote: http://www.lispworks.com/reference/HyperSpec/Body/02_dhb.htm
10:32:16
ralt
you are actually dumb because you don't want to read a few chapters of a free online book that will give you all the names of things you need :)
10:32:37
stargazesparkle
This is going to be like that one time I tried learning C and wrote code like *********deck because I don't actually know what a pointer was
10:55:55
oni-on-ion
that reminds me of learning C (on wolfenstein3d source code). did not know pointers for a while
11:04:19
phoe
I don't imagine #lisp as a place where small amounts of greetings and small chat are considered offtopic
11:06:08
phoe
Internet transfers emotions really poorly; the smiley could be read as sarcasm when lacking context, and I kinda don'have context because I know you
11:09:11
phoe
no problem; it's just the issue of IRC being a poor fit for some things, like all protocols that perform human-to-text transformations
12:41:51
jmercouris
I have the unicode ID for a character, how can I convert that to the actual character?
12:44:04
jackdaniel
from the practical standpoint it will be usually unicode though (or at least ascii)
12:44:45
phoe
for all practical purposes code-char is good on all implementations that implement unicode
14:19:43
pfdietz
NIL punning is a bit of ancestral baggage in Common Lisp. Scheme got rid of it, but also had many other differences.
14:26:26
jmercouris
I'm using gtk_widget_get_size_request from this page: https://developer.gnome.org/gtk3/stable/GtkWidget.html
14:26:42
jmercouris
what I am trying to figure out is how to make a pointer to some memory address in CFFI
14:27:02
jmercouris
because gtk_widget_get_size_request is supposed to populate the addresses with the correct values of the calculations
14:31:15
jackdaniel
https://stackoverflow.com/questions/42398762/why-does-gtk-have-gint-gdouble-which-are-just-typedef
14:32:03
pfdietz
I think cffi could use some optimization. I made a change to it recently that sped up an application that uses it by about 10%.
14:38:18
pfdietz
EQL hash tables can be much faster than EQUAL hash tables. With the former, lookups on :uint32 were mostly hitting the hash table previous key cache.
14:39:47
pfdietz
I'm sure there are many other pieces of low hanging fruit. For example, it doesn't have to constantly be rechecking for typedef circularity.
14:41:20
_death
this kind of performance naiveté is not limited to cffi.. we're just Lisp programmers abiding by Perlis ;)
15:00:44
_death
there are a zillion testing libraries, but not a lot of benchmarking libraries.. asdf has a test-op but no benchmark-op..
15:16:23
jmercouris
when the system detects an errant transition, a guard not satisfied, etc, it signals an error
15:16:48
jmercouris
to elaborate, the slot called transitions will contain a list of transition objects
15:17:33
jmercouris
the really cool thing about this model is that it can be trained by observing a system under nominal conditions
15:17:52
jmercouris
therefore I do not have to program 'what' to look for, I only give it some signals, and these are modeled by the system and saved in the transition objects
15:18:19
jmercouris
it's not a terribly complex system, but my goal is not performance or anything, but adaptability/customizability
15:19:33
phoe
first you define a state machine that lists all transitions, so which states can go into which states
15:20:06
phoe
then you define what a given state does, and it has access to the info stored in a state machine information
15:20:36
phoe
and therefore a macroexpander for a given state can check if a transition is allowed in the state machine
15:20:49
phoe
if it's allowed, it can expand into proper code; if it's not, it can signal a macroexpansion-time error
15:23:07
phoe
no CLOS, no MOP, no method calls, no structs, no anything - just LET over BLOCK over TAGBODY that uses generated GO forms to jump across states
15:23:21
phoe
if I do it correctly, I'll also be able to test individual states rather than the whole state machine at once
15:28:55
phoe
and since each idempotent mostly-pure function is allowed to be a good macro function...
15:37:37
jmercouris
its the itch I had so often in other languages, I didn't even know what I was missing
15:38:10
jmercouris
sure there were mechanisms, kludges you could use, but sometimes a macro is invaluable
15:54:02
_death
the compiler provides a hook for ad hoc extensions.. you can write an extension which is a compiler itself
15:56:35
jmercouris
from Wikipedia "In computing, a compiler is a computer program that translates computer code written in one programming language (the source language) into another language (the target language)"
16:00:37
jackdaniel
Josh_2: if you serve a big file, then you should be vary, that hunchentoot first loads the file into memory and after that it sends it
16:01:47
Josh_2
the problem isn't just loading up videos and sending them jackdaniel, the problem is that safari has a very specific way you have to respond to certain headers
16:03:06
jmercouris
as you can see, /static will be handled by Nginx, anything else will proxy pass through
16:04:22
Josh_2
okay I can have a similar config however the way my site works right now is you have a html page and within it a single video, the video is chosed based on a get parameter
16:06:42
jmercouris
even IF the videos are dynamically generated, you could write the file stream to the static directory
16:07:23
Josh_2
how do I get nginx to select the correct file? because currently I am just doing (to-octets (random (length <my static dir))) and then serving that
16:10:30
jmercouris
I don't see what the problem is, your Lisp application just needs to know all of the content, which it can scan by itself using UIOP
16:11:01
Josh_2
I have a redirect button that randomizes a get parameter, the get parameter is a random position in a list of files (the content) then when the page is loaded the video in that position of the list is loaded
16:17:33
Josh_2
do I have to keep the extension on my files for nginx to determine the mime type? they are all mp4
16:32:01
Josh_2
I just need a neat way of adding new files and keeping them in line with the naming scheme and all should be hunky dory
17:09:23
Josh_2
is there a way I can move a file without having rewrite the file in a new directory?
17:26:08
contrapunctus
I happened to type `ecl` at a terminal and got this - http://paste.debian.net/1180220/ (typed and entered 1, but got the same prompt again and again; if I C-d all prompts, it segfaults.)
17:39:13
jeosol
Is anyone working on natural language processing with CL (open libs) and have recommendations. Looking at cliki, I see a few libraries langutils and elsewhere vseloved's cl-nlp. Haven't used any system in CL but family with python's spaCy
17:40:50
jeosol
Also, not an NLP expert, but my larger goal is to part some document, excel file and extract word tokens that my help me create rules (.e.g., crude decision tree)
17:42:37
fangyrn
jeosol: If you use ABCL you will be able to use Java NLP libraries really easily and those are quite well-renowned, like the stanford one
17:42:53
jeosol
I am just trying to get high-level recommendations from those who may have worked in this space.
17:44:04
jeosol
oh ok. Unfortunately, my base code is in SBCL and never used other implementations, but I guess if nothing, I can look at ABCL and I can try to investigate separately
17:54:09
ym
Hi. Trying to wrap CLX into CLOS, getting error "Asynchronous VALUE-ERROR in request 31 (last request was 38) Code 1.0 [CreateWindow] Value 0." Could somebody guess what the problem could be?
17:54:56
fangyrn
jeosol: yes. there is another one, openlp from googling right now. I just remember learning about
17:55:27
fangyrn
I just remember learning about corenlp. I thought it seemed like quite a good nlp library (it had a lot of cool papers, I don't know about documentation).
17:57:27
jackdaniel
while by default everything is a structure, you may easily change it with a flag, so instead of structure-class you have standard-class instances