freenode/#lisp - IRC Chatlog
Search
1:08:28
pjb
LdBeth: not harmful, but using to<-from instead of from->to might be better in lisp: (c<-b (b<-a a)) instead of (b->c (a->b a))
1:09:17
ebrasca
pjb: I need to implement wait-for-input-internal for usocket Mezzano implementation.
1:10:37
pjb
ebrasca: well -internal probably means that it's an internal function, so it can do anything, depending on the implementation of your code. wait-for-input should be clear enough: it should wait until something is ready to be read.
1:12:15
pjb
ebrasca: it should be noted that you get no help from CL for this kind of features. There's a LISTEN function for character streams, but since it's always implementation and platform dependent if and how streams are buffered, LISTEN doesn't give much information. It does precisely what it's specified to do, indicate whether there's data ready to be processed for lisp. But more data could have been available if the things had bee
1:12:17
LdBeth
pjb: I mean thinking in coercion while asking for formatting is no good. There could have many functions have type number->string
1:14:41
pjb
LdBeth: scheme number->string doesn't have the type number -> string: it can signal errors…
1:17:32
pjb
Note how C++ or Java function signatures include the set of conditions that are signaled. int foo(int x) throws Y,Z;
1:21:06
LdBeth
pjb: partial in the sense that not all elements in the set of input type are covered. However you can still view conditions/errors/exceptions as objects of certain type
1:22:01
_death
C++ has exception specifications, but nobody uses them because they have issues.. except maybe to say that a function does not throw
1:22:09
LdBeth
A partial function in domain A could be a total on in domain B which is a subset of A
1:25:40
_death
dlowe: well, I wanted to say that I haven't used it for a while, but then I recalled that I used it today.. to add a bit of texture manipulation functions to my imgui+ecl thingy so that I can use vecto to draw stuff and see it appear immediately on screen :)
1:26:09
dlowe
"If an exception is thrown from a function that has not specified the thrown exception in its exception specification, the result is a call to the function unexpected()."
1:28:22
_death
I could've just used cl-opengl for that bit, but I didn't want to depend on it for such basic functionality so provided my own interface
1:29:50
Xach
_death: i am on the verge of making something that uses the vecto api but draws into a browser immediately instead. i need faster feedback.
1:30:38
Xach
dlowe: i was thinking a websocket where lisp pushes primitives to a little js kernel that draws to a canvas. but it's all thinking so far, no doing.
1:31:44
Xach
bidirectional, too, so i could send mouse events to lisp and react. again, mostly daydreaming without code so far.
1:33:35
Xach
this seems legit easier than porting my preferred way of messing around with graphic objects to javascript
1:34:11
smokeink
Xach: I think it's very doable; I've done it with trident mode but I want to switch to using websockets ;
1:45:42
_death
Xach: the color changes every time I C-M-x.. I didn't measure how much time it takes to render though
1:49:27
_death
you could do something like that with simple cl-opengl code.. likely easier than websockets+js :)
1:55:14
Xach
_death: i'd like to cut down the feedback loop of thinking about a tweak to a graphics hack and seeing what it looks like. i'd also like to add some interactivity.
1:59:25
Xach
https://i.imgur.com/mgXMaMY.png would be fun to make all the "rays" point at the cursor
2:10:05
Bike
those are escape characters. They mean that that all the characters in the name are exactly those characters, and not downcased or anything.
2:36:10
loke
Speaking of lispmemes... Where does this come from? https://www.reddit.com/r/LispMemes/comments/ciw99r/heres_a_better_way_to_macro/
2:37:01
loke
There must be some story to this, because no sane person would write code like that. Ever.
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?