freenode/#lisp - IRC Chatlog
Search
3:33:14
smokeink
(let () (defvar x0 2) x0) ; why does it give a Warning: this undefined variable: X0 ? (when evaling it the 1st time) and this one doesn't?: (progn (defvar x6 2) x6)
3:34:57
pjb
smokeink: The second form could also give a warning when evaluating it the first time. If it doesn't, it may show that you evalulate it in a REPL that uses an optimization for progn forms.
3:35:38
pjb
smokeink: in both cases, defvar doesn't do anything until the form is evaluated: it has no compilation-time effect. Therefore when both forms are compiled, at compilation time, there is no variable known by x0 or x6.
3:36:57
pjb
smokeink: once you evaluate them, the symbol x0 (or x6) is marked as being special, a dynamic binding is established between the symbol and the initial value, and all the code that was compiled using lexical binding of variables named x0 (or x6) are still lexical bindings. So basically, your defvar forms are useless.
3:37:55
pjb
smokeink: in which case, since you have a different environment between the old code already compiled, and the new code, you can get semantic discrepancies, and strange bugs.
3:39:12
pjb
Therefore 1- never use defvar or defparameter other than as toplevel form (note progn keeps it a toplevel form, so what I called optimization above must actually be the specified semantic).
3:41:36
pjb
smokeink: (defvar *x0* 2) (let () *x0*) #| --> 2 |# (progn (defvar *x6* 2) *x6*) #| --> 2 |#
3:43:58
pjb
China releases its own programming language Mulan <https://cntechpost.com/2020/01/17/china-releases-its-own-programming-language-mulan/>
3:48:37
smokeink
if they don't use Chinese characters, I wouldn't call it very Chinese https://img2018.cnblogs.com/i-beta/989505/202001/989505-20200117111140494-1123911009.png
3:48:44
no-defun-allowed
pjb: I cannot find any information on the language other than news, and how is it related to Lisp?
3:50:40
no-defun-allowed
"elastic actor execution model" sounds interesting, but it sounds difficult to put with "C" and embedded devices.
3:53:38
LdBeth
no-defun-allowed: according to some Chinese user, it’s currently like a cut down version of Python
4:03:37
smokeink
pjb: here's some Common Lisp https://paste.ofcode.org/Wnu3ffzKvnwf3ZM3M8cibA in Classical Chinese . the advantage is having short identifiers - if you're used to the logograms -
4:04:45
pjb
smokeink: and the advantage, is that since it's lisp code, ie. lisp data, we can easily write a little function to substitute the chinese ideogram with words using the latin alphabet. :-)
4:07:49
smokeink
you could, but that would be at the end when you want to share the code with others ; during development you can keep it short
5:38:40
HiRE
so I am trying to summarize a bunch of booleans... I figured I could do something like `(reduce #'or '(t t t t nil))` and expect it to be false.
5:42:58
White_Flame
also, if you use REDUCE, it will always traverse the entire list. SOME/EVERY/etc will early exit if the condition is met/breached
5:44:17
no-defun-allowed
You would have to use SOME; and I would advise against using APPLY where you want to REDUCE because some implementations may have small argument limits.
6:26:34
Nilby
And when you're familiar with those, then you can move on to the more vague temporally mutable versions: past-identity possible-position sometime once whenever and whatever.
6:30:20
HiRE
thats on the same level of using #define in C to make your entire program read like a telegraph
8:33:27
jackdaniel
could you elaborate what do you mean by a colormap? and what representation is that you are expecting?
8:34:51
shka_
colormap as those found in software like matlab, that is: way to visualize value from 0.0 to 1.0 as a color from the range
8:35:18
shka_
https://www.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/35242/versions/3/previews/html/Colormap_Chart_01.png
8:36:48
no-defun-allowed
Some of those look like a gradient that just changes the hue, saturation or brightness.
8:39:08
no-defun-allowed
A first approximation could be to set up a HSV tuple for the minimum and another for the maximum, then lerp between those in a loop to generate the colours.
8:39:23
jackdaniel
clim could provide you with some primitives (it has functions for ihs and rgb color manipulation)
8:56:18
scymtym
i found that for rasterizing gradient-like things in mcclim, patterns work pretty well: https://techfak.de/~jmoringe/mcclim-color-picker.png
8:59:36
Shinmera
shka_: You can just use something like this https://github.com/Shinmera/colored/blob/master/ops.lisp#L239-L253
10:14:13
KD35
I'm trying to make multiple :where clause using Mito but I'm in struggle. Would somebody be able to help?
10:16:04
KD35
What I've tried is like this, (mito:select-dao 'post (mapcan (lambda (k) `(sxql:where (:like :title (concatenate 'string "%%" ,k "%%")))) keywords))
10:20:11
KD35
(mito:select-dao 'post (sxql:where (:like :title "%lisp%" )) (sxql:where (:like :title "%sbcl%" )))
10:22:38
jdz
KD35: So how do you expect mito to figure that out on its own? You have not specified that.
10:22:41
KD35
#<SXQL-STATEMENT: SELECT * FROM post WHERE ((title LIKE '%lisp%') AND (title LIKE '%sbcl%'))>
10:23:47
jdz
I'd expect something like (sxql:where (:or (:like :title "...") (:like :title "..."))).
10:27:25
KD35
I thought Mito will provide such a functionality but I couldn't find. So I tried to solve using macro and didn't work.
10:27:56
jdz
If all that did not work was the default of AND instead of OR, then you have your answer.
10:44:56
no-defun-allowed
minion: memo for another-user: I came up with another trick for the brainfuck compiler; replacing the TAPE structure with two local variables drops the execution to 3 seconds on Clozure with the Mandelbrot program (and somehow it makes the SBCL compiler hang) which is 1/3 of the time the last compiler took.
10:48:49
no-defun-allowed
I wonder what makes the SBCL compiler hang on the generated code. It's a lot of code, sure, but it takes more than 30 seconds to compile and the only change was replacing the structure with local variables.
10:52:08
scymtym
if the compiler is self-contained, the compiler. and the problematic input program, probably. if it isn't too much trouble
10:52:33
no-defun-allowed
The compiler is https://plaster.tymoon.eu/view/1642#1642 and it compiles https://raw.githubusercontent.com/kostya/benchmarks/master/brainfuck2/mandel.b to about 10,000 pretty printed lines of CL.
10:53:05
no-defun-allowed
jdz: One for the data, and one for the head address. I slack off like most implementations and use a finite-but-pretty-large tape.
10:53:52
jdz
I once wanted something similar, so I used two lists; moving through the "tape" would be popping elements from one list and pushing them to the other. Inserting at current position would be pushing to one of them, depending on whether it has to be inserted left or right of the "cursor".
10:54:39
no-defun-allowed
Yeah, I saw an implementation in Lisp do that. Specialised arrays are usually faster though, and we're playing a benchmark which is a very stupid game.
10:55:28
beach
I know very little about this thing, but do you need insert/delete at arbitrary positions of the "tape"?
10:56:12
jdz
no-defun-allowed: It's also funny that your implementation starts at the middle of the tape, and what I saw in other language entries is that they start at the beginning.
10:57:12
no-defun-allowed
beach: As in taking the "tape" (A B) and inserting C to get (A B C)? The target language only could write to get (A C) or (C B), depending on the head's position.
10:58:04
boeg
What type does slot-values like `(:documentation "a docstring")` have? Like what are they? They don't appear to be like a cons or a list as far as I can see
10:58:25
no-defun-allowed
(The six instructions are to move the head either way, increment or decrement the value on the tape at the head, print the value at the head and loop.)
11:31:23
galdor
if you want to test if you can access a specific internet service, just try and see what happens
11:31:38
no-defun-allowed
(usocket:socket-connect "1.1.1.1" 80) ;; provided you don't mind giving CloudFlare (or substitute for your own big company) a TCP connection
11:31:41
galdor
if you want to check for packet loss, it's a tricky subject, you may want to read about ICMP
11:32:09
jmercouris
basically I want to check in Next if the user has a suitable internet connection, and if not, show the help page
11:32:25
jmercouris
I'm thinking probably I should try to use usocket as no-defun-allowed said and check their home page
11:32:50
galdor
yeah, and then the browser will tell you internet is down because an admin blocked 1.1.1.1 on the network
11:33:26
galdor
the right way is to try to access the page normally, and handle socket errors to infer the possible causes of the errors
11:33:35
no-defun-allowed
jmercouris did then say "their home page", which I imagine is somewhat less likely to be blocked.
11:34:07
galdor
it's a bit like trying to check if a file is readable by various mechanisms before, you know, trying to read it
11:35:39
jmercouris
there is per-buffer VPN, Proxy, download, sometimes the web renderer port stack will load an asset, sometimes lisp directly
11:43:15
scymtym
no-defun-allowed: Python tracks more properties for lexical variables than for structure slots. in this case it creates a million (quite literally) integer range types for the various variables (mainly POSITION, i think) and performs operations, mostly TYPE= in this case, on them
11:48:02
scymtym
i think (let ((position …)) <POSITION has a constant initial value or a declared type> (incf position) (incf position) …) leads to a fresh integer range type being associated with each program point, but i haven't looked that closely
11:52:44
no-defun-allowed
One idea I'll test tomorrow (heading off to bed now) is putting each instruction in a FLET and inlining those functions. Would that avoid that inference (if you know off the top of your head)?
11:56:03
no-defun-allowed
Sure. That probably is pathological stuff though, I don't think it's a problem that SBCL can't compile it quickly.
12:04:13
flip214
luis: how about an option to increase slime hex message length indicator to 8 digits?
13:41:25
boeg
beach: yes but isnt is saved as a slot value anyways? Anyways, its just a list i found out
13:43:00
beach
Yes, it is stored as a slot when it is a class or a generic function for instance, or a slot too as I recall.
13:55:03
_death
no-defun-allowed: still it might just be low-hanging fruit to get it to compile faster.. e.g., during compilation I C-c C-c'd and it was at some pushnew form to component-reanalyze-functionals, which is a set represented as a list.. it was used in few places so I replaced it with a hash table (sbcl likely has a better representation for sets) .. this shaved a few seconds from compilation
14:00:04
kenu
I've got a problem with postmodern's insert-dao, I've got (setq s-sql:*escape-sql-names-p* :literal), but then there is following error on inserting a record Database error 42703: column "updatedat" of relation "actions" does not exist
14:00:04
kenu
QUERY: INSERT INTO "actions" ("updatedat", "createdat", "actiontype", "referer", "visitorip", "productid", "visitorid", "shopuserid", "userid") VALUES ("$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9") RETURNING "shoptransactionid", "actionid"
14:01:48
kenu
it doesn't but the actual question is how do I ahndle cammelCase column names with dao
14:18:09
kenu
QUERY: INSERT INTO "actions" ("updatedAt", "createdAt", "actionType", "referer", "visitorIp", "productId", "visitorId", "shopUserId", "userId") VALUES ("$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9") RETURNING "shopTransactionId", "actionId"
14:43:25
dlowe
and also if you want to store input code to be executed later, you're much better off wrapping it in a function and storing the result of CL:COMPILE to call later
14:43:26
jackdaniel
if you put (+ 2 3) in your source code it will be evaluated unless explicitly quoted
14:43:55
beach
chimneys: This is the place where we typically ask "What is it that you *really* want to do?"
14:44:55
chimneys
jupyter notebooks %%writefile file.cl \n code.. shift+enter to get new cell then !clisp file.cl
14:45:03
pfdietz
(and I say that as someone who does use it on occasion, but only when it's appropriate)
14:51:16
jackdaniel
I feel bad about it, otoh he didn't lose anything, just like with priate copies of software ,)