freenode/#lisp - IRC Chatlog
Search
23:44:03
aeth
alexanderbarbosa: no, I mean exactly the opposite... CL's (or Lisp's in general) strongest case is in the web because there are a ridiculous number of syntaxes. In most languages, you'd use something like https://mustache.github.io/ to do {{ foo }} templates on top of the native syntax, e.g. in .html files.
23:44:29
aeth
alexanderbarbosa: In CL, you will have a uniform syntax and a well-designed framework will make the web look like it's not a mix of 6+ syntaxes.
23:44:40
p_l
alexanderbarbosa: to support aeth's point, that's kinda how a bunch of clojure webapps got made :)
23:45:02
p_l
including one that, when it still was available, was all-lisp from web browser to backend
23:47:42
aeth
What's particularly fun is that if you write a trivial macro on top of a well-written function to e.g. generate GLSL, you can then generate GLSL strings at compile time.
23:49:41
p_l
alexanderbarbosa: as for lisp jobs - some lesser known places do still CL, and some switched to Clojure
23:51:10
aeth
Generating a compile time string of another language, once you've written the generation, is probably no harder than (defun foo (s-expression) (with-output-to-string (output) (generate-foo s-expression output))) (defmacro foobar (&body body) (foo body))
23:52:16
aeth
It's a harder if you want the macro to be able to change some output based on the input, like a webpage that says "Hello, ~A~%"
23:53:04
aeth
You can generate JavaScript, HTML, XML, CSS, SQL, JSON, GLSL, etc. Varying quality, though. Mostly hobby, incomplete projects. It's so easy to do that there's a lot of one-off 90% implementations that people have written.
23:53:40
aeth
It's harder if you want to try to get the generated programming language (JS or GLSL) to match CL semantics, though.
23:55:58
alexanderbarbosa
aeth: I dont think someone would hire me if I only generate code from CL :D
23:56:07
aeth
The basic principle is incredibly simple. Parse a list based on the first element, then write to a character stream (many functions that do this), and recursively call if there's another list in there, e.g. (:+ 1 (:* 2 3)) could generate "1 + (" and then "2 * 3" and then go back to the original to add the ")"
0:00:17
alexanderbarbosa
r/lispmemes is more informative than I foresaw... I know that Rust is crap, whatever it is! :D
0:02:58
alexanderbarbosa
aeth: is there any real use of that in web development... if so, I might really take is serious!
0:04:38
aeth
alexanderbarbosa: The use for the web is that you get a uniform syntax for JS or WASM (frontend), (X)HTML, CSS, SQL, CL (backend), GLSL, JSON, etc., and can template using the same macro/function abstractions without having to worry about the differing syntaxes, since that's handled at a different layer of the program.
0:05:09
aeth
The disadvantage is afaik no one did the Rails of this, so it's a bit DIY to glue it all together.
0:07:54
alexanderbarbosa
https://www.reddit.com/r/LispMemes/comments/bidfzc/car_commandments/?utm_source=share&utm_medium=web2x
0:08:29
aeth
alexanderbarbosa: Essentially, what Lisp gives you is a free intermediate format instead of having to directly work with string manipulation. You have (at least) two stages, the s-expression stage and the write-to-stream (usually string generation) stage.
0:17:29
aeth
alexanderbarbosa: I would personally ignore Lisp Memes, Paul Graham, and anyone else who acts like Lisp is the perfect solution for everything. (Although the memes might be joking.)
0:21:40
aeth
I don't really think much about Ada or Rust because what I do isn't really where those languages are used.
0:22:13
aeth
You're much more likely to encounter C++ or Java on the higher performance end or Python or Ruby or JavaScript on the scripting/abstract end.
0:24:06
aeth
Oh, and with gaming in particular, you can add C# to the first list and Lua to the second.
0:28:54
aeth
I can understand (but personally don't really join in on) the hate for Clojure because at least to outsiders it looks like it competes with CL's roles.
0:29:37
alexanderbarbosa
well, after reading some post on r/lispmemes, now I get why no-defun-allowed says that there is no lisp-like languages...
2:11:44
LdBeth
Unfortunately when a language is referred as xxx for children, nobody really thinks it can be used in production
2:16:11
loke
LdBeth: if you that was true. Unfortuantely people use Python in production all the time.
6:07:17
no-defun-allowed
I wouldn't be sure they're ready. Don't you know how many lines you have to read?
6:07:24
seok
Previous code I had hanged when it reached the end of output, waiting for the next output
6:08:37
no-defun-allowed
If it closes the output when it's done, (loop for line = (read-line output nil) until (null line) do (write-line line))
6:09:25
no-defun-allowed
Is there really no indication of when the output will be done? No line count or anything?
6:10:36
no-defun-allowed
Great. Maybe then you could try to wait a short time (eg 0.1 second) for a result in that case.
6:11:57
no-defun-allowed
(loop named read-loop do (loop for i = 0 to 10 do (if (listen output) (return) (sleep 0.1) finally (return-from read-loop)) do (write-line (read-line output))) is the best I can think of immediately
6:15:19
no-defun-allowed
The inner sleep loop is so that it doesn't burn CPU cycles waiting for LISTEN.
6:18:25
no-defun-allowed
Not in a tight loop like that. If you have a SLEEP form, the CL system gives up its CPU time so it's more likely the subprocess gets to be run, and in the millions of LISTEN calls the CL process will do, only a few will result in T in your case.
6:38:46
pjb
seok: listen only guarantees one character on the stream. So you can use only read-char, unless you accept to be blocked again.
6:40:35
pjb
seok: and when reading from a file or frmo a terminal, you will probably have buffering from the system or the drivers (eg. line buffering on terminals), listening on a character will stop at the end of the line, so you cannot listen to characters until you type RET in the terminal.
6:41:54
pjb
seok: if the terminal is in raw mode (no buffering), then something like (loop while (listen *terminal-io*) collect (read-char *terminal-io*)) will probably return only one character, since the user cannot type fast enough for listen to return true the second time.
6:42:49
pjb
seok: some timing may also depend on the program and its options. See for example grep --line-buffered
6:44:57
pjb
If you look at the source of slurp-stream-lines, you will see it just loops on read-line.
8:20:37
no-defun-allowed
Would anyone know if Sussman's HACKER program (from his thesis) is available to look at anywhere?