freenode/lisp - IRC Chatlog
Search
14:44:27
dim
The standard has it that “values is the standard idiom for indicating that only one value is to be returned”
14:50:45
ggole
(values (values 1 2)) is an interesting snippet - the same operator doing quite different jobs
14:54:22
Xach
Inline: forms don't expand into multiple forms, but they may evaluate to multiple values.
15:23:49
jackdaniel
this is fun to read: https://bugs.launchpad.net/calibre/+bug/1714107 (some folks trying to convince calibre maintainers to migrate from python2 to python3, because the former is "retiring") [sorry for the offtopic, otoh it proves, that having standard is a nice quality]
15:29:27
Xach
I think there's sometimes a simplistic view of what motivates other people to change their code for you
15:30:08
beach
This is precisely what I am talking about when I give talks to industry, urging them to use standardized languages.
15:30:19
Xach
"change this to make it conform to the standard" does not always motivate someone to make a change.
15:31:02
Xach
common lisp adherence to standards (in a thorough way) has not always been very good, and it saw a surge of improvement over the last 10 or so years
15:31:43
Xach
but if you rely on something standard, but your platform does not implement the standard, you cannot always rely on "change to fit the standard" to save you, without other agreements
15:36:11
fade
the incompatibility between python 2 -> 3 was what lead me to finally use CL in anger.
15:36:30
fade
"If it's going to be a different language anyway, I may as well use one that is both fast and stable."
15:38:07
ogamita
popularity leads to legacy, legacy leads to bit rot, bit rod leads to the dark side.
15:38:40
fade
the 2 -> 3 migration has been the biggest fuckup in a language ecosystem since I've been watching such things, a period dating back to the mid 1980's.
15:39:33
fade
I've often thought that it should result in a lot of new developers for lisp, but I haven't run into too many.
15:41:59
sjl_
Porting a large Python 2 codebase to Python 3 would be painful, but much less effort than learning CL and porting it to CL. That's one possible reason.
15:43:12
pfdietz
Xach: widespread non-compliance with the standard motivated me 15 years ago or so to write ansi-tests.
15:43:33
nixfreak
hello how can I get started to created a "HOT" folder , meaning certain files get copied to a file and a script gets executed to push those files somewhere else
15:44:02
Fade
sjl -- that's true, but once you've loaded lisp into your head, you've solved all of the problems associated with the python ecosystem permanently, if only locally.
15:45:22
sjl_
Fade: sure, but the first part of that (learning Lisp) is non-trivial, and the urge to "Fix the problem and move on with my life instead of learning new tools" is often strong.
15:45:37
Fade
lisp can open and append files, and with the right extension, open a socket and move data through it.
15:46:42
minion
nixfreak: look at pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
15:46:49
fortitude
has anybody used cffi-grovel:process-grovel-file in a while? seems to be an issue with its use of uiop:ensure-pathname, but the last relevant change was from 2015
15:46:56
sjl_
I mean, I agree with you -- Python 3 and Clojure 1.3 were a big influence on me choosing a stable language like CL. But I can understand the decision to suffer through an update rather than go through a full rewrite.
17:13:45
beach
That reminds me of a student I had in the past who wrote is C code with single letter variables only. When I asked him why, he said so that the program would execute faster.
17:16:05
sjl_
uLisp is fun if you do Arduino-based stuff. I've used it for a couple things. I even hacked in floating point support, and the author eventually merged it into the main repo.
17:17:40
copec
I have a smartos box doing all the things, and I actually just want to do rpc with them
17:18:23
sjl_
The homepage says > platforms with more than 2 Kbytes of RAM arbitrary user-defined symbol names are supported.
17:19:48
copec
I want the actual control to be in a zone on the smartos box with the devices just acting as control bridges
17:23:08
didi
I can't get over the fact FORMAT doesn't have a directive to print conses. It bothers me when I want to print alists.
17:24:12
copec
although, having my kids directly program some micro controller projects with this ulisp would be fun
17:26:03
Bike
i guess you could map the alist to have actual lists beforehand, or use ~//, but it's not quite as smooth
17:26:12
anamorphic
copec: I used mqt for rpc previously with esp8266s. I would like to try it again with ulisp
17:32:59
copec
The 'protocol for updating using semantics that follow from CL would suite it wonderfully, I think.
17:43:35
copec
That thought just came to me thinking about these micro controller system images being all lisp, something something nasa doing incremental upgrades through space via lisp, and how cloud app deployment is going towards orchestration (config management) states to deploy applications
21:01:31
dim
is there a guide to port CL software to ABCL? I mean the JVM comes with many libs that you can reuse without having to load CL equivalents I'm sure (jdbc for db drivers, zip, http, s3 maybe, usocket needs a replacement, json?, uuid?, base64?)
21:24:05
jackdaniel
I think that the proper way to tackle that would be defining a protocol (so the package and exported interfaces are defined) and to provide implementation for that
21:24:56
jackdaniel
example: uffi had a specification (which had implementation called uffi), and later cffi-uffi-compat iimplemented the same protocol and ecl ffi did the same
21:25:24
jackdaniel
so they are a drop-in replacements (you may use cffi-uffi-compat instead of original uffi)
21:30:42
dim
in the case of PostgreSQL/MySQL/SQLite/MSSQL/Oracle/DB2 and other database protocols, CL typically has a separate specialized driver each time where the Java world uses JDBC, often with quality drivers that you'd want to benefit from when you're on the JVM anyway
21:31:30
dim
so even though I like your idea of protocols and their various implementations, well... it's not clear how much that'd be necessary for me here
23:02:28
v0|d
pjb: #emacs guys had no ideas, do you know a way to make (mapcar (lambda (a) (concat "x" a)) (eshell/ls)) work?
23:04:23
pjb
of course, inside eshell it prints out the list. But as a function it doesn't return anything.
23:57:11
no-defun-allowed
could give the compiler more information for type inference and only works on simple vectors
23:58:50
malice_
didi: but SVREF does not work wherever AREF works. If you feed an array to SVREF you should get a type error.
23:59:12
malice_
Maybe I didn't mean type correctness but explicit type expectation or something like that
0:01:36
aeth
On the other hand, svref only works on simple-vectors, not (simple-array foo (*))s, and (simple-vector *)s have to be (simple-array T (*))s
0:02:41
aeth
Usually if you care enough to let the compiler know it's a simple array you also are probably using (unsigned-byte 8)s or single-floats or whatever.
0:03:13
aeth
Even if svref worked, that wouldn't give enough information: the type of elements held and the length are pretty important. So you basically have to declare when doing array stuff.
0:08:52
aeth
v0|d: A vector is a 1D array. A simple-vector is a 1D simple-array (simple means not adjustable, with no fill pointer, and probably a few more things that help compilers out) that holds elements of type T. This second part makes the concept of simple-vector alone a lot less useful than it could otherwise be.
0:09:44
malice_
What are you favorite Common Lisp libraries? I was thinking of cool common lisp libraries lately and was curious what are peoples' favorites.
0:10:27
aeth
v0|d: A simple-vector is incredibly niche. A simple-array can be common in certain use cases. So you basically always have to use aref (n-dimensional arrays) or elt (sequences, including vectors) and give enough type information to ungenericify the accessor.
0:11:41
aeth
v0|d: CL arrays are actually one of the stronger points for its types, especially when working with numbers (or characters)
0:14:25
White_Flame
in ye olde days, the calculation of the slot address within an array was much more expensive, and there were far fewer non-boxed values
0:14:36
aeth
malice_: You can have 0, 1, 2, ..., array-rank-limit dimensional arrays of character, simple-character, bit, and (not standard, but in almost every implementation) (unsigned-byte 8). You also normally can have fixnum, [un]signed-bye for 16/32/64, single-float, double-float, (complex single-float), and (complex double-float).
0:15:12
aeth
malice_: You can access all of this with aref, and you can define a type to greatly simplify the rather messy syntax (that would be a bit less messy if simple-vectors could be specialized for types like simple-arrays)
0:16:11
aeth
Seems like one of the stronger array offerings in a programming language, especially if you're working with numbers or characters.
0:17:07
aeth
malice_: Oh, and if an implementation doesn't support it, it will just become a generic T array instead of failing, so you can safely use (complex double-float) everywhere unless you rely on its checking for errors.
0:19:21
aeth
And in some implementations, :type in a struct slot will help out the type inference. So now these mostly-useless, legacy, pre-CLOS stuff (structs) have a purpose.
0:20:28
aeth
i.e. Have to pass around several arrays, but with a known length and numeric/character type? Put them in a struct with the appropriate array type as the struct slot :type and then non-generic AREF will be used and things will be much more efficient. Just declare/check-type/whatever the one struct's type, not the dozen arrays.
0:20:56
aeth
(And, in fact, it probably can tell it has to be that struct type, and thus the result has to be that array type, by the accessor's name.)
0:23:37
resttime
Been trying to get back into lisp again manipulating parsing/manipulating data from a csv
0:23:57
resttime
Got confused on floats being truncated until I figured out that it's because reads were doing it on 'single-float
0:24:05
aeth
malice_: oh one more thing, I should emphasize that most of this relies on optimizations permitted but not required by the standard, but that it will run (slowly) on implementations that don't implement all of those optimizations
0:35:25
jasom
resttime: there is also the parse-float library which is probably better for untrusted inputs
0:37:22
aeth
always write 1.0d0 or 1.0f0 (or 1.0l0 or 1.0s0) because you don't know what a prior system set that global to when asdf is loading your code
0:39:31
pjb
also, remember that floating point formats are different in different programming languages. So if you need to parse eg. JSON data, which uses the Java format, don't use CL:READ!
0:40:07
resttime
This was the value I was trying to parse "-87.381425", and oh I guess I dunno how to properly parse floats from a csv
0:42:30
jcowan
Why are simple vectors niche? I don't understand that. They are a very handy data structure with different tradeoffs from lists.
0:42:30
pjb
resttime: you can transform it into a ratio: "-87.381425" --> (/ 87381425 1000000) #| --> 3495257/40000 |#
0:42:34
jasom
resttime: that will parse it as a double float; if you want to parse it as an arbitrary precision decimal, perhaps someone else can recommend a library for that; I've not had cause to use decimal libraries in lisp
0:50:18
didi
aeth: In the past, declaring the type of a variable as FIXNUM has made wonders to my program, but I must confess, unless large integers are definitely ruled out from the domain of the variable, I feel uneasy.
1:05:38
malice_
though ratios are fine. They just aren't too fast, so while this approach is pretty straightforward and simple, it's also much slower. Just something to have in mind.
1:11:34
malice_
I mean, depends on your definition of broken. Definitely something to watch out for, but when dealing with floating numbers you should be aware of that.
1:14:54
didi
I once performed trigonometric operations in series, lots of them, with hilarious results. :-(
1:22:52
didi
Fun example: (loop repeat 1000 for x = pi then (* 2 x) finally (return (tan x))) => 1.6973400402517407, tho it /should/ has been ~0.
1:36:57
pjb
malice_ should have a look at https://github.com/informatimago/lisp-vs-c (as any other programmer looking for speed).