freenode/#lisp - IRC Chatlog
Search
12:46:09
pjb
flip214: yeah, declarations are bitches. Don't do them. Or like docstrings, put all the declarations in a separate file, and load it only when compiling the production code?
14:47:45
pjb
flip214: otherwise, you could write a CDR defining an API to have access to the declarations, and implement it in the various implementations.
14:51:40
pjb
Note also that this API can exist in an implementation specific mode in some implementations.
14:52:16
pjb
But probably ad-hoc. For example, IIRC, some implementations have a specific API to access the optimization levels.
15:09:21
flip214
pjb: for my usecase it might be much easier to have CFFI always generate declarations, so that previous wrong ones get clobbered ;)
16:50:19
flip214
stylewarning: be careful what you wish for... there's a lot of fuzzy testing around ;/
16:52:09
makomo
stylewarning: the readme links to https://github.com/rigetti/cl-quil, but that gives a 404? is that repo private or?
16:52:45
makomo
the readme also says the cl-quil can be found under ./src/, so i'm not sure what the link is for?
16:54:15
stylewarning
The repos used to be separate, so it’s probably just a typo that didn’t get cleaned out
17:19:48
skidd0
i'm swapping out that macro I had issues with (from yesterday) so that I don't have to call it with every database action
17:20:51
skidd0
some documentation suggests using a open-db function that has an (unless *database* (setf *database* ..))
17:21:45
skidd0
i found a thread on reddit that's helping me understand the difference between defvar and defparameter, which i believe should be used here instead of setf
17:28:11
sjl
defparameter defines a special variable and sets it to something. defvar defines a special variable and sets it only if it didn't already exist. (unless ... (setf ...)) sets an EXISTING variable to something if it's currently set to NIL.
17:29:23
sjl
You might want something like (defvar *foo* nil) ... (unless *foo* (setf *foo* ...)) to define the variable and lazily initialize it later
17:30:29
sjl
Oh, reading scrollback, I'd guess your problem is that you're not importing the *database* symbol (or using postmodern:*database* to refer to it).
17:31:32
sjl
So you're saying (unless *database* (setf *database* ...)) but *database* is just some random symbol in your own package that happens to have the same name as one in the postmodern package.
17:32:20
sjl
You import the SYMBOL *database* from the postmodern package (packages in Common Lisp are containers for symbols. you don't import a variable, you import a SYMBOL).
17:33:57
sjl
So, to back up. You have a special variable. This variable is named by a particular symbol. In your case: the symbol *database* in the postmodern package.
17:34:45
sjl
So if you want to set the variable, you have to use its name (that symbol). You can either say postmodern:*database*, or if that's too wordy to type all the time, you can import that symbol into your own package.
17:35:06
sjl
Then when you're in your package, saying *database* refers to that postmodern:*database* symbol.
17:36:08
sjl
(or :use'ed it, because :use is essentially something like `import *` from e.g. Python)
17:37:26
sjl
Well, and because if you have a function foo in your package, and then later one of the packages you :USE adds a function `foo` and exports it, suddenly your code will be redefining their `foo` function
17:37:29
skidd0
so i'll try importing pomo:*database* with the suggested (unless *database* (setf *database* ..)) and see if it still complains about unbound
17:52:04
stylewarning
ebrasca: none that I know of. Debugging them requires working knowledge of C and some skill in good abstraction
18:11:54
ebrasca
Sometimes it gives "Unhandled memory fault at #x4." istead of "Unhandled memory fault at #x0."
18:22:43
stylewarning
Probably not without further investigation. In general a good wrapper library shouldn’t permit segfsults to happen but it’s not a perfect world
18:23:20
stylewarning
Triple check that the arguments you’re passing are correct. Do you have to initialize what you alloc’d?
18:43:35
stylewarning
ebrasca: sorry I can’t help more right now, I’m in a plane with a bad internet connection
18:44:18
skidd0
i'm writing duplicate code when i do (let ((id (if (numberp ([stuff to get id])) ([stuff to get id]) nil)
18:48:56
skidd0
so like (let* ((maybe-id ([stuff])) (for-sure-id (if (numberp maybe-id) maybe-id nil))))
18:53:23
sjl
it's almost certainly LESS expensive to LET the stuff into a variable, rather than computing it twice.
18:54:17
shka_
skidd0: if you are considering let to be expensive you probably should not be try to optimize your programs
18:55:53
skidd0
right, because i could be wasting time optimizing something when the bottleneck is elsewhere
18:57:12
Josh_2
skidd0: just write the code how feel is right, when you are complete and have something that works how you want, then you can optimize :) computers are plenty fast
18:59:43
shka_
pretty code is easier to profile anyway, and profiling is critical part of optimization
19:01:33
skidd0
my pitch is that i'm faster and more expressive in lisp (even tho i barely know it, clearly)
19:03:08
stylewarning
They care (IME) about whether other software devs buy into it, whether they can hire people, and whether you’ll just be a bus factor nightmare
19:03:16
skidd0
like last week, i'm building up this database table and importing a ton of data from an API that's paging the records. half way through, (20 mins in) i get a warning that a record in the API didn't have a number for it's ID. So, i redefnied the way the import function handles those IDs to check for a number, live, without breaking the import
19:03:53
skidd0
and yeah, that's exactly the worry i have. They're trying really hard to push and solidify all future dev inot meteor, react, mongo
19:04:29
stylewarning
Lisp is sufficiently odd that it is taken as a bad smell by folks who aren’t deep in the trenches of development. If you’re going to use something non-standard, you have to pull a lot of political weight
19:06:04
stylewarning
(Even at a company where our most advanced software is in Lisp, there’s still pushback. There’s always this lingering desire to “quarantine” it and not let it grow.)
19:07:42
stylewarning
It seems the best way to have Lisp at a company is to be in a leadership position where you call the shots AND you really have convinced yourself Lisp will be more productive than throwing up a Flask server with MySQL.
19:08:55
stylewarning
But leadership is responsible for the maintenance and outlook of the company, and “reducing risk”
19:09:28
skidd0
but in my head, the risk of the code/lang should be measured, reported, and decided on by those that work with it
19:09:34
stylewarning
(FWIW I don’t think Lisp is a very risky choice if you’re ok with training somebody for 1-2 weeks)
19:10:58
skidd0
that they have me fixing up. so, this co. has me simultaneously learning classic ASP and that meteor stack
23:26:08
phoe
"but all of the databases we use nowadays will be passé in 10 or 20 years, we'll need to rewrite anyway to make use of the newest MassiveDB and ImmutableJS or whatever current fad is the shit"
23:40:39
verisimilitude
I'm fortunate to have written only a single line of JavaScript in my life and not for something I personally cared about.
23:41:38
verisimilitude
What I think, ebrasca, is that a language many decades old still being at least near the top of things is a sign of stagnation.
23:42:01
verisimilitude
It's not necessarily that Lisp is great, but more that most other things are just pathetic.
23:51:17
_death
verisimilitude: not bad, all things considered. I think Lisp has something intrinsic in it that draws me to it, so I don't care if everything else is at stasis
0:15:04
stylewarning
Still a ways to go, but strongly typed parametric polymorphism in otherwise bog standard Lisp code is a dream
0:27:30
makomo
does the issue appear when you have all three of those constraints: constant time, constant memory, respects the lexical environment?
0:29:57
stylewarning
I don’t think you can feasibly do the first and last because it’s O(n) time to build the memory