dilated_dinosaur has quit [Ping timeout: 250 seconds]
efm has quit [Read error: Connection reset by peer]
markoong has joined #lisp
arduo has quit [Ping timeout: 250 seconds]
markong has quit [Ping timeout: 256 seconds]
jprajzne has joined #lisp
terpri has quit [Remote host closed the connection]
terpri has joined #lisp
markoong has quit [Ping timeout: 256 seconds]
mathrick has joined #lisp
Inline has quit [Ping timeout: 272 seconds]
Kundry_Wag has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
ym555_ has quit [Ping timeout: 240 seconds]
Kundry_Wag has quit [Ping timeout: 260 seconds]
wxie has joined #lisp
iAmDecim has joined #lisp
bitmapper has quit [Ping timeout: 260 seconds]
FennecCode has quit [Quit: ERC (IRC client for Emacs 26.2)]
jprajzne has quit [Quit: jprajzne]
wxie1 has joined #lisp
efm has joined #lisp
jprajzne has joined #lisp
wxie has quit [Ping timeout: 256 seconds]
wxie1 is now known as wxie
dtman34 has quit [Ping timeout: 250 seconds]
gko has joined #lisp
Oladon has quit [Quit: Leaving.]
wxie1 has joined #lisp
wxie has quit [Ping timeout: 240 seconds]
wxie1 is now known as wxie
v88m has joined #lisp
renzhi has joined #lisp
jprajzne has quit [Quit: jprajzne]
jprajzne has joined #lisp
Kundry_Wag has joined #lisp
KDr24 has joined #lisp
jprajzne has quit [Quit: jprajzne]
logand` has joined #lisp
jprajzne has joined #lisp
logand has quit [Ping timeout: 250 seconds]
ebzzry has joined #lisp
jprajzne has quit [Quit: jprajzne]
elderK has joined #lisp
<elderK>
Hey guys, what's the equivalent of enumerations in CL? Is there such a thing?
<elderK>
The reason I ask, instead of just using symbols, is that for efficiency, I'd like to represent something as a 2D array. Say, a transition table.
<elderK>
Each symbol would map to an integer index.
<elderK>
Failing that, I might invent yet another "state machine" macro :P
xkapastel has quit [Quit: Connection closed for inactivity]
wxie1 has joined #lisp
jprajzne has joined #lisp
wxie has quit [Ping timeout: 260 seconds]
wxie1 is now known as wxie
iAmDecim has quit [Ping timeout: 250 seconds]
SGASAU has quit [Remote host closed the connection]
<pjb>
elderK: see com.informatimago.common-lisp.cesarum.utility:defenum
<conjunctive>
This is my first try working heavily with type declarations in SBCL.
<conjunctive>
Also, working with FSet has been fantastic! Coming from Clojure I felt right at home.
<pjb>
elderK: there are other variants. see for example: ccl::defenum
mrrevolt has joined #lisp
broccolistem has joined #lisp
asarch has joined #lisp
<elderK>
Thanks pjb
<LdBeth>
good evening
<elderK>
pjb: If using a case statement, would this require translating the integer back to a symbol, and such
<elderK>
?
shifty has joined #lisp
<LdBeth>
elderK: for ccl::defenum, no
<LdBeth>
it just defines a symbol macro
<elderK>
Ah, I have not heard of symbol macros.
<elderK>
I will read up :)
broccolistem has quit [Ping timeout: 260 seconds]
wxie has quit [Ping timeout: 260 seconds]
shifty has quit [Ping timeout: 256 seconds]
<elderK>
LdBeth: defconstant defines symbol macros?
libertyprime has joined #lisp
<beach>
Good morning everyone!
Oladon has joined #lisp
<pjb>
elderK: your defenum macro expansion could include a case-<enum> macro…
<adlai>
elderK: if you want to roll-your-own, i recommend an eq table from symbols to numbers; anyone concerned about the backlinks deserves the algorithmic complexity.
<elderK>
adlai: an eq table?
<pjb>
elderK: defconstant defines constant variables. Theorically, they could be implemented as symbol-macros, but implementations define them natively, to be able to detect bindings at compilation time, and for keywords.
<elderK>
Good morning, beach!
<pjb>
elderK: well, defining constant variables as symbol-macro wouldn't let you prevent binding them.
<adlai>
elderK: instead of a 2D array containing symbols designating the elements within the enum, (make-hash-table :test #'eq) for mapping symbols to offsets within the array; then, you don't even have to allocate that array if it's prohibitively large.
shifty has joined #lisp
jprajzne has quit [Quit: jprajzne]
<adlai>
have fun doing pointer arithmetic on enumerations :)
<elderK>
adlai: I'd rather avoid a hashlookup every time I need the integer value of some symbol.
<elderK>
I need to learn more about the case form. Are the things it matches against even evaluated?
<pjb>
elderK: you have to define boundaries, outside of which the symbols are used and inside of which the integers are used.
<pjb>
elderK: I like to use conversion functions to cross thos boundaries.
<pjb>
elderK: If you define constant variables, they have to be defined at compilation-time, so you can use them with #. in case forms processing the integer values.
<pjb>
In all cases, I don't see the point of using a hash-table, conversion functions can just use case.
<adlai>
elderK: if you'd like to reoptimize an eq hashtable once you're convinced that the enum's membership set has settled, you can verify that hash-table-count and hash-table-size are sufficiently far apart, and then call rehash; however, this is all an implementation detail, and your enum lookups should happen at compile-time
jprajzne has joined #lisp
* adlai
may be talking slightly outside the spec here
<adlai>
myeah, there's no cl:rehash, although the desired side-effect is to rebuild the hashtable, without another call to make-hash-table, so that optimizers who pay attention to the membership set have an opportunity to work
<Bike>
elderK: the case macro does not evaluate the keys, no.
<Bike>
each case has a list of keys that are checked against with eql. if a clause key is T or OTHERWISE it's a default. if a clause key is some other object that counts as a list of one object. that's about it.
jprajzne has quit [Quit: jprajzne]
jprajzne has joined #lisp
<elderK>
Bike: Nuts.
<adlai>
maybe elderK is just asking "how is case implemented, when i reserve the right to use as many distinct keys as the size of some mystery 2D program text"
<Bike>
it means it can be compiled into a jump table sometimes. that's nice. but it's fundamentally a pretty static operator.
<Bike>
you could whip up something with cond if you want evaluated keys, of course
<adlai>
elderK: you may find the string-case macro implements exactly what you didn't think you were asking, if you want the enum members to exist at runtime
<elderK>
Bike: Aye. It's just I see (cond ...) as a bunch of if statements :P
<Bike>
well, good, because that's what it is
<elderK>
I see case as something "hopefully" much more efficient, somewhat like switch in C.
<Bike>
Yes
<Bike>
it is, exactly
<beach>
Those would be forms, not statements.
<Bike>
and C switch only works with constant expressions, no?
<elderK>
Correct.
GuerrillaMonkey has joined #lisp
<Bike>
so that's how cl:case works as well. C does have a more expansive concept of constant expressions, though.
<elderK>
:( Aye, but if I define something, say, (defconstant foo 3)
<adlai>
there is a string-case library that builds a table from strings at compile time, and evaluates the key at run time, although it is not supposed to be abused as a replacement for enumerations
Involuntary has quit [Ping timeout: 260 seconds]
<elderK>
and try to use that in a case, (case foo ...)
<Bike>
right, that's what I meant.
igemnace has joined #lisp
<elderK>
foo will be evaluated, no? But the keys in the case clauses wont.
<Bike>
C allows that, lisp does not.
<Bike>
you can probably (ab)use the #. syntax for that though.
<elderK>
That seems painful.
<Bike>
it's not that bad.
<adlai>
elderK: in your example, the symbol foo might never be evaluated after the compiler hits defconstant
<Bike>
(case expr (#.foo ...whatever code...))
<Bike>
the macro trying to evaluate the keys would be a problem because A) it needs a list, and B) case is actually used with literal unevaluated symbols a fair bit
jprajzne has quit [Quit: jprajzne]
<Bike>
might be interesting to think about an expansion of what constant expressions are good for, tho
jprajzne has joined #lisp
<elderK>
:( So, what's the idiomatic equivalent to a C enumeration, and switching on enumerants? Or using those enumerants as indices?
<Bike>
usually we use symbols instead of enumeration constants.
<Bike>
iirc sbcl is smart enough to reduce a case on symbols ot a jump table, so that's cool
<elderK>
That is cool.
<elderK>
So then, if I want to have a mapping between symbols and integer indices, I need a map of somesort.
<elderK>
Either a case statement say, or a cond, or a hash table.
<Bike>
yeah. well, just define a symbol->integer function that everything uses, and stress about the best way to implement it later
<elderK>
So, let's say we use #.SOME-NAME
<elderK>
What environment would that SOME-NAME be retrieved from?
<Bike>
the compilation environment
<elderK>
Right, so i'd have to ensure that my constants were visible via eval-when, correct?
<Bike>
if the implementation evaluates defconstants at compile time, as most do, that works fine. if you wanna be paranoid you can put an eval-when on
<Bike>
i mean, (defconstant +foo+ 3) will usually be fine by itself
jprajzne has quit [Quit: jprajzne]
<Bike>
anyway imma sleep bye bye
Bike has quit [Quit: leaving]
jprajzne has joined #lisp
<elderK>
Goodnight Bike, thanks for your help.
cosimone_ has quit [Quit: Quit.]
<elderK>
Well, nuts. That is disappointing :(
renzhi has quit [Ping timeout: 250 seconds]
momozor has joined #lisp
<adlai>
what are you disappointed about ?
adam4567 has quit [Quit: ERC (IRC client for Emacs 26.3)]
EvW has joined #lisp
adam4567 has joined #lisp
<aeth>
elderK: The most idiomatic equivalent to an enum is a member type, e.g. (deftype color () '(member :red :green :blue)) (typep :red 'color)
<aeth>
Of course it doesn't actually have an (accessible) associated number until you define an ECASE that maps it to a number, as Bike said.
<aeth>
A macro that generates both at the same time shouldn't be too hard.
<Xach>
trocado: RENAME merges the new with the old
<Shinmera>
"The primary value, defaulted-new-name, is the resulting name which is composed of new-name with any missing components filled in by performing a merge-pathnames operation using filespec as the defaults."
<Xach>
trocado: if you don't want that, make sure the new name is more complete
<Xach>
i think this is widely unexpected behavior, but it does allow some shortcuts if you have it memorized. like (rename-file "/My/cool/file/frob.lisp" "frob-backup") => "/My/cool/file/frob-backup.lisp"
<trocado>
I see, it actually makes sense.
<Xach>
it has internal logic at least. the problem with intuition and expectation is it's formed by whatever you learn first, and i learned a different style first (unix mv style).
v_m_v has quit [Remote host closed the connection]
scymtym has quit [Remote host closed the connection]
iAmDecim has joined #lisp
<trocado>
Xach
<trocado>
Xach: yes, that's right
v_m_v has joined #lisp
<Josh_2>
Afternoon all
bitmapper has joined #lisp
dddddd has joined #lisp
ebrasca has quit [Remote host closed the connection]
Bike has joined #lisp
<phoe>
hello
Bourne has joined #lisp
scymtym has joined #lisp
v_m_v has quit []
wxie has joined #lisp
cosimone has joined #lisp
iAmDecim has quit [Ping timeout: 265 seconds]
trocado has quit [Ping timeout: 265 seconds]
iAmDecim has joined #lisp
mn3m_ has joined #lisp
mn3m__ has quit [Ping timeout: 265 seconds]
jmercouris has quit [Remote host closed the connection]
<beach>
Hello phoe.
Bourne has quit [Read error: Connection reset by peer]
shifty has joined #lisp
EvW has joined #lisp
n1kio has joined #lisp
Bourne has joined #lisp
xaotuk has joined #lisp
ym has quit [Quit: Leaving]
xaotuk has quit [Ping timeout: 265 seconds]
xaotuk has joined #lisp
fivo has quit [Quit: WeeChat 1.9.1]
iAmDecim is now known as cyberoctopi
quazimodo has quit [Ping timeout: 256 seconds]
quazimodo has joined #lisp
xaotuk has quit [Ping timeout: 258 seconds]
davepdot_ has joined #lisp
clintm[m] has joined #lisp
nmg has quit [Remote host closed the connection]
nmg has joined #lisp
cosimone has quit [Remote host closed the connection]
cosimone has joined #lisp
davepdotorg has quit [Ping timeout: 256 seconds]
Inline has joined #lisp
xaotuk has joined #lisp
davepdot_ has quit [Remote host closed the connection]
xkapastel has joined #lisp
igemnace has quit [Quit: WeeChat 2.8]
davepdotorg has joined #lisp
efm_ has joined #lisp
efm has quit [Ping timeout: 240 seconds]
davepdotorg has quit [Remote host closed the connection]
davepdotorg has joined #lisp
davepdo__ has joined #lisp
davepdotorg has quit [Read error: Connection reset by peer]
<srandon111>
guys what is meant by "natural recursion"? and what would it be a "non-natural recursioN" ? i found a post on stackoverflow but wasn't able to understand still
<_death>
looks like an idiosyncratic term to me
<dlowe>
yeah, I would interpret as "solving a problem particularly amenable to recursion" but it's not a term of art
<Bike>
recursion on natural numbers? no, i've never heard this term either
sjl_ has joined #lisp
nmg has quit [Remote host closed the connection]
<phoe>
srandon111: which post on SO
efm_ has quit [Quit: Konversation terminated!]
sjl_ has quit [Client Quit]
<beach>
I am sure if Daniel Friedman came up with those examples, he probably also supplied a definition of the term.
<beach>
phoe: It the first answer if you Google it.
<phoe>
it seems to be related to natural numbers, and the most natural operations on these: a check whether a number is zero, adding one to a number, subtracting one from a number
<Xach>
vms14: you cannot have arguments on the shebang line with --script
<Xach>
--script must be the only argument
<vms14>
weird, but got it
terpri has quit [Remote host closed the connection]
terpri has joined #lisp
vms14 has quit [Remote host closed the connection]
pjb has joined #lisp
xaotuk has joined #lisp
mn3m_ has quit [Quit: mn3m_]
gravicappa has quit [Ping timeout: 265 seconds]
mn3m has joined #lisp
efm_ has joined #lisp
efm_ has quit [Client Quit]
efm has quit [Ping timeout: 264 seconds]
Inline has quit [Ping timeout: 265 seconds]
vhost- has joined #lisp
vhost- has quit [Changing host]
vhost- has joined #lisp
mn3m has quit [Quit: mn3m]
ArthurStrong has left #lisp [#lisp]
cyberoctopi has quit [Ping timeout: 265 seconds]
trocado has quit [Ping timeout: 265 seconds]
karlosz has joined #lisp
ahungry has joined #lisp
cyberoctopi has joined #lisp
Kundry_Wag has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
Codaraxis has quit [Ping timeout: 258 seconds]
kamog has joined #lisp
kamog has quit [Client Quit]
Cymew has quit [Ping timeout: 265 seconds]
ukari has quit [Remote host closed the connection]
<srandon111>
guys do you commonly use macros?
ukari has joined #lisp
<pjb>
srandon111: yes.
<Xach>
srandon111: yes
<dlowe>
srandon111: yes
KDr2 has joined #lisp
KDr24 has quit [Ping timeout: 256 seconds]
<srandon111>
why for example in other lisps such as clcojure the usage of macros is not encouraged ?
<srandon111>
Xach, dlowe phb
<srandon111>
* pjb
karlosz has quit [Quit: karlosz]
<dlowe>
srandon111: I guess you'll have to ask them
karlosz has joined #lisp
karlosz has quit [Remote host closed the connection]
karlosz has joined #lisp
karlosz has quit [Remote host closed the connection]
cyberoctopi has quit [Ping timeout: 256 seconds]
<fiddlerwoaroof>
srandon111: my experience with Clojure is that many of the developers come from other languages to it and, so, they don't see the value of macros
madand_ has joined #lisp
<fiddlerwoaroof>
(other, non-lisp languages)
<dlowe>
specifically, in non-lisp languages macros always break things
<fiddlerwoaroof>
Yeah
Kemwer_ has joined #lisp
Kaisyu72 has joined #lisp
mgsk__ has joined #lisp
hydan_ has joined #lisp
asedeno_ has joined #lisp
lonjil2 has joined #lisp
pent_ has joined #lisp
<fiddlerwoaroof>
Rich Hickey uses them a lot in the stuff he builds, though
<phoe>
I use it almost as often as I use #'a:curry and #'a:rcurry
momozor has quit [Quit: leaving]
shifty has quit [Ping timeout: 260 seconds]
achillesp has joined #lisp
* dlowe
wistfully wishes they had called it papply instead of curry
<splittist>
you can always use serapeum:partial (I think)
<dlowe>
I don't care that much
<dlowe>
just enough to complain about it
<dlowe>
it's a very specific level of discomfort
luni has left #lisp [#lisp]
<Shinmera>
Seems like my normal level of comfort overall
cyberoctopi has quit [Ping timeout: 260 seconds]
achillesp has quit [Remote host closed the connection]
anticrisis has joined #lisp
quantico has quit [Quit: leaving]
parjanya has joined #lisp
<phoe>
the mythical weltschmerz
<phoe>
...cl-weltschmerz is a tempting project name
efm has joined #lisp
cybercafe has joined #lisp
<LdBeth>
good mornig
<cybercafe>
hello friends
cyberoctopi has joined #lisp
<eta>
fiddlerwoaroof: thanks, that function's great :)
<LdBeth>
eta: It seems you might like to have threading macro too
<eta>
LdBeth: is that the arrow function thing?
<LdBeth>
yes
cyberoctopi has quit [Ping timeout: 264 seconds]
<pjb>
srandon111: people tend to discourage the use of what THEY cannot master. For example, in C, it is strongly discouraged to use inner functions, since it's impossible to write them. In C++ it's discouraged to use OOP, since they cannot do multiple inheritance correctly. etc.
lxbarbosa has joined #lisp
EvW1 has quit [Ping timeout: 265 seconds]
narimiran has quit [Ping timeout: 265 seconds]
pilne has joined #lisp
ggole has quit [Quit: Leaving]
dddddd has joined #lisp
rumbler3_ has quit [Remote host closed the connection]
rumbler31 has joined #lisp
<aeth>
pjb: "Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?" https://en.wikiquote.org/wiki/Brian_Kernighan
<phoe>
Lisp makes it possible to debug things that are undebuggable in other languages
rumbler31 has quit [Ping timeout: 240 seconds]
<aeth>
Lisp also makes it possible to have things be undebuggable that are debuggable in other languages. e.g. most uses of the programmable reader
<phoe>
but it also makes it possible to write 100% clusterfuck code that is impossible to debug even in Lisp
<phoe>
yes
<eta>
but only if you use HANDLER-BIND instead of HANDLER-CASE and INVOKE-DEBUGGER :p
<phoe>
not really
<phoe>
you can easily write a reader macro that reads and executes a Malbolge program
<phoe>
try debugging that
<eta>
ew
<eta>
phoe: oh yeah, you also can't debug recursive macro expansions
<srandon111>
phoe, how?
<eta>
unless you very carefully macroexpand-1 everything
<fiddlerwoaroof>
eta: macroexpansions aren't that bad with Slime's macrostepper
<eta>
fiddlerwoaroof: true
<fiddlerwoaroof>
There are a couple edge-cases
<eta>
but if you try and compile a whole file
<eta>
then you're done for
<eta>
SBCL just blows its stack and moans at you
choegusung has joined #lisp
choegusung has left #lisp [#lisp]
cosimone has quit [Quit: Quit.]
arbv_ has joined #lisp
arbv has quit [Read error: Connection reset by peer]
Jesin has quit [Quit: Leaving]
lxbarbosa has quit [Ping timeout: 246 seconds]
rippa has quit [Read error: Connection reset by peer]
Jesin has joined #lisp
Steinberg2010 has joined #lisp
<pjb>
aeth: definitely. This is why a good way to debug some code, is to rewrite it from scratch!
<pjb>
which is also a good reason why you should have modular code. So you don't have to rewrite everything, but just the bad module or function.
Lord_of_Life_ has joined #lisp
Lord_of_Life has quit [Ping timeout: 250 seconds]
Lord_of_Life_ is now known as Lord_of_Life
Steinberg2010 has quit [Ping timeout: 246 seconds]
VoidSick has joined #lisp
cyberoctopi has joined #lisp
rumbler31 has joined #lisp
logand` has quit [Remote host closed the connection]
anticrisis has quit [Quit: Leaving]
z147 has quit [Quit: z147]
efm has quit [Read error: Connection reset by peer]
Steinberg2010 has joined #lisp
dale_ has joined #lisp
dale_ is now known as dale
efm has joined #lisp
efm has quit [Client Quit]
anticrisis has joined #lisp
random-nick has quit [Ping timeout: 240 seconds]
VoidSick has quit [Quit: WeeChat 1.9.1]
tiwEllien has quit [Ping timeout: 240 seconds]
watkinsr has joined #lisp
efm has joined #lisp
akoana has joined #lisp
<jasom>
aeth: I used to use that Kernighan quote, but I now disagree with it. I think debugging and writing software are different (though not entirely orthogonal) skills. Over the past 10 years I've written very little code for work, but I've debugged others' code a heck of a lot. My debugging skills have shot way up while my development skills have atrophied a bit. I would say at this point that I am better at
<jasom>
debugging code I've never seen before than I am at writing a project from scratch.
<fiddlerwoaroof>
Yeah, my experience is that debugging is often easier than writing the code
monokrom has quit [Quit: Leaving]
<fiddlerwoaroof>
e.g. when the cleverness/intelligence was in seeing a very simple way to solve a problem
xkapastel has quit [Quit: Connection closed for inactivity]
<fiddlerwoaroof>
Or seeing the problem as an application of a more general problem
<jasom>
Also very few bugs are novel. I've on occasion suggested fixes to customers code without having ever seen the code, just from observing the symptoms.
Steinberg2010 has quit [Ping timeout: 246 seconds]
ahungry has quit [Remote host closed the connection]
cyberoctopi has quit [Ping timeout: 256 seconds]
msk_ has joined #lisp
cyberoctopi has joined #lisp
msk has quit [Ping timeout: 260 seconds]
xkapastel has joined #lisp
v0|d has quit [Ping timeout: 256 seconds]
notzmv has quit [Ping timeout: 258 seconds]
cosimone has joined #lisp
Aurora_iz_kosmos has quit [Ping timeout: 240 seconds]
<aeth>
jasom: I suppose it's more accurately about reading than debugging, as in, it's harder to read (clever) code than to write it. e.g. regex
<aeth>
I'm not sure that's true, either, though. There are definitely lots of things that take all day to write a handful of lines
<aeth>
In that case, it's a bit hard to separate writing from debugging, though
<fiddlerwoaroof>
I've used regexes so much by now that I forget people have trouble reading them :)
<aeth>
which regexes matter
<aeth>
some languages let you do multiline and even commented regex
<fiddlerwoaroof>
I mean the standard, compressed "line-noise" regexes
<fiddlerwoaroof>
e.g. (?:[a-z]{2,})? stuff
wxie has joined #lisp
cyberoctopi has quit [Ping timeout: 264 seconds]
cosimone has quit [Quit: Quit.]
<fiddlerwoaroof>
It's a bit like APL: for someone just getting started the syntax is gibberish, once you've really internalized it, it's the most efficient way to express precisely what you mean in the problem space.
<aeth>
Idk, I think regex is kind of like sh. It can't scale. Or, rather, it can scale but why would you?
<aeth>
that is, you can do neat one liners, but at some point, it's not the best tool
cosimone has joined #lisp
karlosz has quit [Quit: karlosz]
karlosz has joined #lisp
cosimone has quit [Client Quit]
wxie has quit [Ping timeout: 250 seconds]
cosimone has joined #lisp
rpg has joined #lisp
Aurora_iz_kosmos has joined #lisp
anticrisis_ has joined #lisp
anticrisis__ has joined #lisp
<fiddlerwoaroof>
Sure, but as a DSL for specifying sets of strings inside a larger program, it's really nice
anticrisis has quit [Ping timeout: 265 seconds]
anticrisis_ has quit [Ping timeout: 265 seconds]
gigetoo has quit [Ping timeout: 240 seconds]
gigetoo has joined #lisp
ayuce has joined #lisp
ayuce has quit [Remote host closed the connection]
<fiddlerwoaroof>
This is pretty nice: I can turn on http-mode in the resulting emacs buffer and get a nice colorized log of http requests next to my repl