freenode/#lisp - IRC Chatlog
Search
15:56:09
Xach
trafaret1: the following form is evaluated at read time and the return value is used as the result from the reader.
15:57:59
Xach
many read macros start with #, are optionally followed by a numeric argument, and concluded with a single character that is associated with the behavior. #+, #-, #=, #., #< are a few examples.
16:13:35
moldybits
trafaret1: (loop :repeat 5 :collect (random 10)) => (7 9 8 0 5) (loop :repeat 5 :collect #.(random 10)) => (6 6 6 6 6)
16:15:32
trafaret1
If I get your right it's just like evaluate the expression and that results send into another expression to evaluate
16:18:14
trafaret1
(loop :repeat 5 :collect #.(random 10)) => (6 6 6 6 6) for me it's strange behaviour
16:19:15
fivo
I am using slime with company. I installed the following plugin https://github.com/anwyn/slime-company
16:19:33
moldybits
trafaret1: (loop :repeat 5 :collect #.(random 10)) becomes (loop :repeat 5 :collect 6) after it's been read.
16:19:38
fivo
Before I used the plugin company also completed local varaibles which it doesn't anymore.
16:21:38
moldybits
most things are evaluated only once, but this exampled used a loop so it is more pronounced
16:22:47
_death
the first thing that happens when you load a file or enter text at the repl is that the reader gets called with the stream of characters.. the reader operates according to a readtable.. by default, this readtable contains an entry for the '#' character that dispatches further according to the following character(s).. if the character '.' is encountered, the reader gets called recursively to read the next object.. after the object is
16:22:48
_death
read, the reader will evaluate it, and return with the value, and the next step will commence
16:24:48
moldybits
(let ((x 42)) (+ 1 x)) => 43 (let ((x 42)) #.(+ 1 x)) => error: variable X unbound
16:29:56
_death
for example entering #.#.(list 'list ''list '''list) will have the reader call itself twice, the final result being (list 'list), which in turn will be passed to the evaluator, resulting in (list)
16:32:28
moldybits
(lol ((x 42)) (+ 1 x)) => Compile-time error: illegal function call ((x 42)) (lol ((x 42)) #.(+ 1 x)) error: variable X unbound
16:33:24
moldybits
the problem is not with the let, but that #.(+ 1 x) is evaluated before the let (or nonexistant lol) is evaluated
16:37:11
moldybits
(defparameter x 42) (let ((x 5)) (print #.x)) <- this prints 42 even when `sbcl --load file.lisp'. that surprises me.
16:38:57
_death
the defparameter form gets read and evaluated, then the let form gets read and evaluated
17:10:41
flip768
I know that I can have (AND whitespace ... whitespace) in the rule, but then I need to explicitly do something to not return them
17:41:53
pfdietz
The top level forms are processed before the following forms are read. Things like (in-package ...) would not work if that weren't the case.
17:43:12
specbot
Processing of Top Level Forms: http://www.lispworks.com/reference/HyperSpec/Body/03_bca.htm
17:46:51
pfdietz
trafaret1: a common idiom for sharp-dot is putting constant variable values into CASE forms.
17:48:20
_death
pfdietz: I wrote about it a long time ago.. "One minor thing" paragraph @ https://github.com/death/consix/wiki/Postmortem---a-bit-of-postmortem-never-hurt-anyone!
17:50:56
pfdietz
I think that would be fine, as long as the defconstant appears in another file. That way, the form will have been evaluated by the time its value is needed.
17:54:28
pfdietz
Macro definition is fine. "If a defmacro form appears as a top level form, the compiler must store the macro definition at compile time, so that occurrences of the macro later on in the file can be expanded correctly. "
18:58:43
ark
fivo: I have slime-company working with completion in the repl lisp files. Here's my config: https://gitlab.com/_ark_/dotfiles/blob/5967f8c68ea7fbe4b5c852b134fb14404b4564ff/emacs.d/init.el#L997-1002
19:20:50
fiddlerwoaroof
fivo, ark: I use slime-company too, but in my experience, it can be a pain getting it to work
19:47:06
scymtym
i guess a feature request here https://github.com/wallyqs/org-ruby would be appropriate, but getting off topic
22:18:55
alexanderbarbosa
what mainstream language is the most lispy? thinking of changing careers and taking programming seriously... :D
22:45:51
no-defun-allowed
alexanderbarbosa: none, wouldn't be mainstream according to your dichotomy then
22:46:37
no-defun-allowed
not every day you hear someone call a language ALGOL-y or APL-y for example
22:46:39
alexanderbarbosa
no-defun-allowed: some @ emacs said golang and javascript es6, whatever it is
22:47:51
no-defun-allowed
since neither is homoiconic, has macros, the scoping system of Lisp we all know and love, dynamic strong typing, CLOS, etc
22:48:29
alexanderbarbosa
please, dont make my end of day bad... i want a light in end of the tunnel :D
22:49:43
no-defun-allowed
why do you need a language that superficially is derived from lisp that isn't lisp?
22:51:57
aeth
Go is basically a better-C, and is basically the opposite of Lisp. Like with C, you have a plain style without a lot of abstraction. micro-readability, basically. If you see a random 10 LoC, you should know what's going on. On the other hand, with Lisps you tend to aim for macro-readability, with a lot of abstractions.
22:52:20
aeth
(* of course Go has GC, so it will fail to attract anyone who is still on C and didn't switch to Java in the 90s)
22:52:54
aeth
Also, notably, Go has no generics, whereas in Lisp, you have to try pretty hard to get specifics.
22:53:03
alexanderbarbosa
p_l: because after some, lazy I might add, there no seems to have that much of Lisp jobs
22:53:12
p_l
aeth: ehh, it seems to attract a lot of people due to not being associated with certain issues of early java
22:53:42
p_l
alexanderbarbosa: there's a saying in Poland: "Let's eat shit, billions of flies can't be wrong"
22:54:03
p_l
But for all practical purposes, I'd say it's easier than ever to end up using lisp in any random job
22:54:51
p_l
for JVM environments, you have clojure and ABCL (and a bunch of Schemes, some with AOT compilation). We now have "age of containers" and people are less picky about deps. Microservices actually help too, because you can write your bit in CL
22:55:19
p_l
but in reality, the number one case for using CL in a job? Have your own company and do projects for clients as a whole
22:55:38
p_l
because believe me, a non-IT company probably won't care about what language the project is in
22:56:18
p_l
drew crampsie used to talk about doing lots of intranet sites for various companies, none of which cared they were in Common Lisp
22:56:32
aeth
CL's #1 modern strength is probably in generation of other languages. e.g. https://edicl.github.io/cl-who/ for HTML
22:58:33
p_l
30 minutes ago, it was for Ada2012 (with SPARK where possible) to generate code for hard realtime systems on ARINC 653 platforms
23:01:22
p_l
might want to build a library for source maps, but it's a bit more annoying when your language technically doesn't use text for source code
23:10:00
alexanderbarbosa
weird, why would someone use a language to translate to yet another one...
23:15:27
no-defun-allowed
Clojure is also weird and exposes gory JVM semantics, so DON'T USE IT for the love of jmc.
23:18:06
alexanderbarbosa
no-defun-allowed: so its either CL/Scheme or forget about Lisp... it seems
23:18:17
no-defun-allowed
But basically if you want Lisp semantics, you want Lisp. I can't really advise you on any close-enough solutions.
23:22:12
p_l
as for compiling to another language... that's the effect of web browsers having only JS available
23:24:21
p_l
no-defun-allowed: and it's a bit less important than people think other than for purity
23:28:05
no-defun-allowed
i don't usually post r/lispmemes content here but this summarises all the other problems: https://www.reddit.com/r/LispMemes/comments/bp6pbm/psst_hey_clojure_fans/eunol2o/
23:29:28
aeth
alexanderbarbosa: Even if all of the languages are well designed, what you don't get unless you use code generation is a uniform syntax, and your brain context switching between 5-10 different syntaxes in a few minutes is how you make simple typos.
23:30:00
aeth
But once you put something in s-expression form, what you can start doing is using macros on top of the generated language as if you were writing macros for Lisp itself.