freenode/#lisp - IRC Chatlog
Search
14:13:49
pjb
Exercice for a lazy week end: write a CL reader macro to read expressions from such ascii-art representations.
14:14:44
pjb
If you've finished by this evening, follow up tomorrow (assuming it'll be a raining Sunday) with a reader macro to interpret ascii-art graph diagrams into state machine functions.
14:16:41
pjb
Bonus points for combining it with https://github.com/dhobsd/asciitosvg to generate nice documentations.
14:23:51
mo`
is there a way to prevent emacs from blocking stumpwm when I call emacsclient for the mode-line, is there a way to do a timeout for the stumpwm:run-shell-command function ?
14:24:31
mo`
I have (:eval (string-trim '(#\Newline #\") (stumpwm:run-shell-command "emacsclient -e \"(emms-track-description (emms-playlist-current-selected-track))\"" t))) for my mode-line
14:40:17
tazjin
is there a built-in macro for using `(in-package)` in a limited scope? Something like `(with-package ...)`? Failing to google for it.
14:44:20
Shinmera
Because the reader needs to read a full expression, long before things are evaluated.
14:45:34
Shinmera
So a "with-package" cannot possibly work, unless the package change should only influence package and read operations at run time.
15:17:31
Bike
you could have a reader macro that does something similar. a couple implementations allow package::(form...) syntax which i think basically just binds *package*
15:17:54
puchacz
hi, is it a good idea, guys? (setf (symbol-function 'alphanumericp) (symbol-function 'lispworks:unicode-alphanumericp))
15:18:15
puchacz
it works, for example now I can query (alphanumericp (code-char 322)) and it returns T
15:19:40
Bike
kind of unfortunate that lispworks doesn't just use unicode alphanumericp as regular alphanumericp
15:19:42
phoe
"alphabetic n., adj. 1. adj. (of a character) being one of the standard characters A through Z or a through z, or being any implementation-defined character that has case, or being some other graphic character defined by the implementation to be alphabetic[1]. "
15:21:26
Shinmera
Never rely on CL's character set tests if you're working against any kind of specification.
15:21:41
phoe
I'd rather go for #+lispworks unicode-alphanumericp #-lispworks alphanumericp if anything
15:22:11
puchacz
yeah. but cl-ppcre fails to recognise some letters because of this (it uses alphanumeric-p), and hell knows what else does not work with unicode
15:23:02
puchacz
(setf (symbol-function 'alphanumericp) ...) may be undefined but it works under current LW
15:25:01
puchacz
if I put it into .lispworks and remove my .cache/common-lisp, it should recompile cl-ppcre with new function
15:25:04
phoe
puchacz: either ask lispworks for a workaround or file a bug on CL-PPCRE asking for special-casing LispWorks.
15:25:34
Bike
i kind of thought ppcre already special cased lispworks by using some regex engine lispworks provides
15:26:02
puchacz
I already asked them and they told me they have very close equivalents for the functions I need: http://www.lispworks.com/documentation/lw70/LW/html/lw-198.htm
15:27:01
Bike
okay. just be aware that this reassignment is undefined behavior and lispworks could change it without warning (though they're probably not that mean)
15:27:27
puchacz
of course. if they do, I will kindly ask them to restore or merge these functions :-)
15:28:56
phoe
and possibly write a LispWorks-specific test case in CL-PPCRE's unit test suite to make sure it works and keeps on working later.
15:30:30
puchacz
ok - I will have a look. test case is simple, anything like this (scan "\\w" (format nil "~a" (code-char 322)))
15:31:21
Bike
the ppcre docs already include a note that \w has different behavior by implementation on superascii characters, so they might not care
15:32:26
|3b|
they defined their implementation characters to not have CL case, so consistent with not being alphabetic
15:34:35
puchacz
for what I understand, CL should be able to support almost all unicode, except for cases where a small letter has more than one capital equivalents, or a capital letter more than one small equivalents
15:34:35
|3b|
yeah, both seem like reasonable choices to me... sbcl gives you something that probably works well enough to trick you into filling over some edge case, while lw makes you do the extra work to start with (assuming the other API would actually handle the edge cases better)
15:35:28
Bike
there's stuff like unicode characters that don't round trip through case conversions, i think
15:35:52
|3b|
puchacz: ok, maybe just trick me (and other people who don't use those characters with odd up/downcase rules) :)
15:35:53
puchacz
I thought SBCL philosophy is to treat unicode incompatibilities as bugs, except for these roundtrips myself and Bike mentioned
15:36:55
Bike
"case mapping can change the number of code points and/or code units of a string," "is context-sensitive (a character in the input string may map differently depending on surrounding characters)" jesus
15:44:41
porky11
when I use hunchentoot, can I get the uri as variable instead of automatically dispatching?
15:46:01
Shinmera
porky11: You can add a function to hunchentoot:*dispatch-table*. It should get the request object as an argument, from which you can get the URI.
15:48:23
puchacz
FYI: this is working hands-off: (let ((lispworks:*handle-warn-on-redefinition* :quiet)) (setf (symbol-function 'alphanumericp) (symbol-function 'lispworks:unicode-alphanumericp)))
15:52:58
Shinmera
Some internal machinery could depend on the previous behaviour of the function and then do very bad and hard to debug things if you change it
15:55:30
puchacz
Shinmera: yes, but I still need to do it myself first (i.e. #+lispworks replacements)
15:57:47
puchacz
slime who-calls shows functions usage - unless somebody passes it as 'alphanumericp instead of #'alphanumericp, so again it is not reliable way to find
15:59:11
pjb
puchacz: there are also the case where one lower case letter is upcased to two uppercase letters.
15:59:41
puchacz
pjb: yes, but I can't do anything about that. exactly - the German example I mentioned
16:00:19
puchacz
pjb: I want as good multilingual support as I can get, but if I can't, well, I skip this case
16:01:25
puchacz
pjb: I can use them :) it is the rest of quicklisp and lisp itself that might not play well
16:02:37
pjb
And we have to deal with objects that have been created or defined in the past, that still exist and need to be processed now (and in the future).
16:03:22
pjb
So either the program remains neutral (don't try to process the data fields), or it has to include a lot of complexity.
17:18:00
phoe
Yep. You may want to use one of the frameworks on top of Hunchentoot that parse URLs for you.
20:13:12
flip214
re puri: http://www.cliki.net/Puri says http://puri.b9.com/, but this doesn't exist any more.
20:31:33
flip214
fiddlerwoaroof_: well, I can argue that the northbridge-southbridge connection connects the "thinking" parts with the "change the environment" parts, so there's not that much difference
20:48:59
yomanwazap
It had a green alien with multiple eyes in it that was holding a sign calling "Lern Lisp" with his trunk.
21:15:40
tetrachlorides
"I'd like to learn Russian but I have no time to memorize this funny alphabet." - Someone wrote a blog post complaining about that remark. :/
21:18:55
tazjin
Bike: there was some very brief talk about eastern european languages yesterday, maybe tetrachlorides is referring to that.
21:19:22
Bike
i think learning the alphabet is probably not the longest time investment of learning any language?
21:20:11
tazjin
tetrachlorides: do you have a link to that post? I'm not sure if you're referring to my remark about learning Russian (which wasn't about the alphabet) but it sounds interesting anyways
21:21:28
tetrachlorides
i thought some of you guys were oversensitive, but people really do complain http://blog.roberthahn.ca/articles/2006/02/09/lisp-first-impressions/
21:23:40
phoe
the lack of a complete and featureful Lisp editor that isn't emacs or vi has been a topic of many debates on #lisp so far
21:24:54
phoe
plugin for atom is incomplete and buggy, plugins for other editors don't exist afaik. I remember that jasom has been working on a geany plugin AFAIR
21:29:15
Shinmera
tetrachlorides: I don't know if I want to take someone to heart that unironically calls themselves "a darn good web developer" on their website.
21:59:44
mo`
is there a way to prevent emacs from blocking stumpwm when I call emacsclient for the mode-line, is there a way to do a timeout for the stumpwm:run-shell-command function ?
22:10:37
tetrachlorides
i'm not sure, does this help? https://stumpwm.github.io/git/stumpwm-git_7.html search: *mode-line-timeout*
22:12:09
mo`
tetrachlorides: thank you. someone replied to me on #stumpwm (which is not very active)
22:12:56
mo`
tetrachlorides: as he said the mode-line code is synchronous so I have to spawn a new thread to solve this I think
22:14:34
dmiles
Well I switched from Lisp500 do to problems with it's definitions of things liek incf/rotatef and it was not fully Common Lisp
22:14:44
tetrachlorides
dmiles: as far as i can tell lisp500 used integer tags on "iref" boxed objects, but init500.lisp extends that with bit twiddling! that seems like cheating
22:16:40
tetrachlorides
i saw wam-cl had a full object model and everything and was impressed! but there was some other prolog/lisp something in there... *shrug*
22:16:54
dmiles
in the asserta database (normal to prolog) but for allow modification of Conses and other objects i use the Prolog blackboard
22:18:13
tetrachlorides
i keep daydreaming of replacing iref integer tags with a pointer to a slot-descriptor table of some sort lol
22:19:38
tetrachlorides
that way if you invent a new builtin type, the garbage collector instantly knows how to find internal references ;)
22:20:31
dmiles
well one modification i been making is that for every "place" i am making a base-porter with is a refernce to a prolog compound .. then also an offset that i can use getarg/3 , b_starg/3 or nb_setarg/3
22:22:47
dmiles
though the compound+offset sometimes adds an extra indirection when i use it for immediate values
22:24:55
dmiles
right now i take the rought if one adds an interpreted function i compile it .. but i might keep the original source with it and let the user pretend its interpreted until they compile
22:25:41
borei
ADD (2)> takes 2 required arguments; was asked to find a method with specializers (MATRIX-R)
22:26:03
tetrachlorides
i hate how you can iref a symbol and crash the boot interpreter because the function pointer segfaults
22:27:09
tetrachlorides
so, i thought instead of overlaying function pointer on a cons, turn the car of cons into a tag!
22:27:46
dmiles
(i mean i suppose the differnce between an interpred function and a compiled function for me is whether or not i have used macroexpand on the body of the function)
22:29:41
tetrachlorides
i play with it sometimes but hard to make sense of the whole thing. lisp800 helps
22:35:03
dmiles
it be a nice project to have a lisp500/800/5000 that used ideal setf expanders and real CLOS (like from PCL)
22:35:12
phoe
borei: specifically, if you already have methods on a GF, you can't change the GF's arity.
22:35:41
phoe
(defgeneric foo (bar baz)) (defmethod foo (bar baz) 3) ;; at this point (defgeneric foo (bar baz quux)) is an error.
22:37:19
dmiles
though by the time i am done is sorta expect to have that but it'll be a hodgepodge of ECL,SBCL,ABCL,GCL,SICL etc
22:39:44
aeth
dmiles: The ones that appear to be alive (ish) are SBCL, CCL, ECL, ABCL, Clasp, CLISP, CMUCL, MKCL
22:40:17
dmiles
tetrachlorides: setf expanders is sort of a institionalized hack to ease the use of trampolines (host C functions) on places
22:45:41
dmiles
but yes a poor choice to do anything other than cherry pick a handfull of functiuons
22:45:46
aeth
dmiles: loop is just so convenient for "loop ... collect ..." or "loop ... append ..." when generating lists
22:46:06
aeth
You can go without using loop, but you're probably going to get something that's both slower and less readable
22:47:11
dmiles
*nod* well my thing agaist loop is when sometimes it was totally done by someone who looks for every reason to use loop
22:49:31
dmiles
but also of course my avoidance is sometimes it makes it harder to decompile my code afterwards.. since prolog vars and not be written more than once i have to make lots of helpers
22:49:34
tetrachlorides
i was researching lisp500 history earlier, i can't find when it was first shared (on irc?) your name comes up as interested in it
22:50:47
dmiles
"avoidance is sometimes it makes it harder to decompile my code afterwards.." / "sinc eprolog variables once a value is stored cannot be changed"
22:52:21
dmiles
tetrachlorides: yeah every once i a while i ask if there is a minimalist primordial CL someplace other than lisp500 :P
22:54:16
dmiles
SICL is is close to that at least according to everyone, though as beach once explained its a bit over circular to be considered that
22:56:11
dmiles
yeah i wish that there was some 185 or some 387 or so trampolines that get us all the way to the level of doing what SBCL does
22:57:57
aeth
You could build CL from a subset of CL, ignoring loop and CLOS and format and other things that seem mostly added on
22:58:22
aeth
(Although ignoring loop in macros would make it harder to generate lists because, as I said, collect is pretty much it)
22:59:30
tetrachlorides
should NIL be a NULL pointer, or a symbol, or a special cons cell with both halves pointing to self?
23:01:10
aeth
CLOS offers a lot of nice things, of course. And format is more concise than alternatives.
23:01:26
aeth
You could probably come up with a macro that just does the subset of loop that's hard to do elsewhere (e.g. collect)
23:01:49
phoe
CLHS somewhere has a list of all symbols exported from the CL package. Does anyone know where exactly to find it?
23:01:55
dmiles
tetrachlorides: historically everyone jsut loves to comendeer NIL to mean lots of things.. NULL,0,:FALSE .. about 70% of their way in they decide it was a bad idea
23:02:26
rme
But there are tons of CL implementations to build on. What's the benefit of implementing a limited subset of CL for bootstrapping given that you could use an existing CL for bootstrapping?
23:02:44
aeth
Shinmera: I don't use format, I use CLOS in ways that make things simpler but could be avoided if I had to, and I only use loop when alternatives are much uglier (primarily loop collect)
23:02:50
Colleen
phoe: Clhs: section 1.9 http://www.lispworks.com/documentation/HyperSpec/Body/01_i.htm
23:03:34
pjb
You just use full C to write C compilers. Even perhaps you implement them in C++ or in Common Lisp!
23:03:41
aeth
Shinmera: I don't think a game engine is easier than a language implementation because a game engine has to implement half of a language, several times over, in order to be efficient.
23:05:28
Xach
ACTION has said multiple times that there are 976 symbols, though he should have remembered it as 978 because it is massachusetts's second area code
23:11:54
aeth
Only problem is that by treaty the US or the Soviet Union have the right to claim parts of Antarctica, so if you build a town there the US or Russia might try to claim it.
23:12:16
dmiles
rme: the reason i am not using an existing CL impl to bootstrap is that i dont compile to x86
23:13:13
aeth
If #lisp officially backs Catalonian independence, can Common Lisp be the official programming language of Catalonia? And does that mean we'd need to do the whole Lisp localization thing where Catalan words are used instead of English words in symbols?
23:13:38
flip214
aeth: top-level-domains can be bought nowadays, so I guess that a (now unused) phone prefix should be available too
23:13:45
dmiles
rme: i sorta wish that there was a compiler that translated lisp to say javascript and had no missing parts
23:14:31
dmiles
rme: (i mentioning that since even with existing lisp systems that still cannot be done)
23:17:04
dmiles
i am not sure if in the end i will have actualyl acomplished things without totally cheating as much as possible
23:18:41
rme
dmiles: Your new implementation (written using CL running in the bootstrapping implementation) can generate whatever code it wants. It doesn't matter if the bootstrapping CL generates x86 or 68000 code.
23:19:51
dmiles
though technically the source of the wam_cl could be able to be translated from prolog to lisp.. meaning i could then gernate my system on SBCL
23:24:49
dmiles
oh, the benefit of implementing a limited subset of CL for bootstrapping is that you your initial subset (say hosted as python) would allow the rest of CL to be a translation of that python code
23:25:58
aeth
dmiles: the disadvantage of implementing a small subset for portability in targeting very different platforms is that the way to write efficient code varies wildly depending on the platforms, especially if the platforms are so different (like source-to-source compilation between languages)
23:27:21
aeth
Almost all of my CL code is "portable", but it's not really portable if it's unusably slow in many environments where it could theoretically run
23:27:55
dmiles
aeth: yeah anohte rexample of what you are saying.. is actualy i run collector loops must slower than i run compleetly recursive function spiting out (values .. ) as a collector
23:28:18
jmercouris
how do you guys feel about (defparameter) setting performing calculations in a top-level form?
23:29:09
aeth
defparameter and defvar might not behave as you think they should when threads are involved
23:31:01
rme
why write a few lines of code when you can import a library? it's the modern programming way!
23:31:08
jmercouris
aeth: It is a constant, but I'd like the user to be able to change it, so it's kind of not a constant...
23:31:36
aeth
rme: some libraries don't count because you probably are indirectly using them even if you have just one dependency
23:32:59
jmercouris
aeth: Anyways, do you think I will still encounter issues with threads if it is as I described?
23:33:20
jmercouris
aeth: The value is used anywhere a function requires access to a configuration file
23:33:30
aeth
jmercouris: and, yes, I wouldn't rely on a user setting *foo* to actually be realized in another thread
23:34:51
jmercouris
here's the function: https://github.com/AeroNotix/lispkit/blob/master/user.lisp#L4
23:35:01
jmercouris
and here's the top level form defparameter: https://github.com/AeroNotix/lispkit/blob/master/settings.lisp#L3
23:36:32
aeth
Personally, I'd put them in a struct or object and would not directly expose them, so you can check that the proposed new value is valid
23:37:15
aeth
That has the added advantage that if defparameter doesn't work, you can change where they're stored
23:37:38
jmercouris
hmm, sure, but I'd like to give my users the opportunity to mess things up, it is an emacsy like program after all
23:38:23
jmercouris
I mean we are not at even version 1.0 yet, so people should not expect their configs to work forever
23:39:24
aeth
jmercouris: If you just expose an accessor (calling it returns the value, setf'ing it changes the value) then you have a lot more flexibility with the API and can change it to be pretty much anything
23:39:56
aeth
jmercouris: but I would personally test modifying it at runtime in another thread, if your browser runs in a background thread from SLIME like a lot of graphical CL apps do
23:40:20
jmercouris
when that time comes, that will be a big change, and the UI will live in its own thread