News for hackers. Stuff that matters.
Re:Common Lisp Wiki: Naming Conventions by uncletaco on Sunday August 28, 2022 @12:27PM (#32629634)
I am and forever will be a fan of the scheme (and now clojure) convention of saying foo->bar to say foo to bar. I just think that's swell.
Re:Common Lisp Wiki: Naming Conventions by vats on Sunday August 28, 2022 @01:05PM (#32629960)
> I am and forever will be a fan of the scheme (and now clojure) convention of saying foo->bar to say foo to bar. I just think that's swell.

In his book—Lisp in Small Pieces—Christian Quienec suggests using a reversed arrow (ie. bar<-foo) so the direction of the arrow agrees with the evaluation order in a function composition. eg. (foo<-bar (bar<-foo ...)), which would have otherwise been (bar->foo (foo->bar ...)).

Re:Common Lisp Wiki: Naming Conventions by nlitened on Sunday August 28, 2022 @01:38PM (#32630254)
In Clojure you're likely to use an arrow to do multiple compositions, eg. (-> foo foo->bar bar->baz)
Re:Common Lisp Wiki: Naming Conventions by mncharity on Sunday August 28, 2022 @06:05PM (#32632542)
> bar<-foo

Or bar_from_foo , when identifier charsets prohibit <- .

Re:Common Lisp Wiki: Naming Conventions by dunefox on Sunday August 28, 2022 @02:23PM (#32630654)
That's quite nice.
Re:Common Lisp Wiki: Naming Conventions by ruricolist on Sunday August 28, 2022 @12:51PM (#32629855)
The CL convention would be to have a function called bar that converts whatever its argument into an instance of bar. Make it generic and new libraries can easily add their own conversions for their own data types.
Re:Common Lisp Wiki: Naming Conventions by lisper on Sunday August 28, 2022 @01:22PM (#32630095)
My personal convention is to call such a generic function ->bar to make it clear that what it does is coerce its argument to a different type.
Re:Common Lisp Wiki: Naming Conventions by nemoniac on Sunday August 28, 2022 @04:24PM (#32631727)
Actually I'm more of a fan of bar<-foo because you can line them up like:

    (bar<-foo (foo<-baz (baz<-quux thing)))
instead of:

    (foo->bar (baz->foo (quux->baz thing)))
Re:Common Lisp Wiki: Naming Conventions by narimiran on Monday August 29, 2022 @02:50AM (#32635405)
But you can do composition, like this:

[Racket]

    (~> thing
        quux->baz
        baz->foo
        foo->bar)